To use the flatMapDepth
function from Lodash library in TypeScript, you need to follow these steps:
npm install --save lodash
command in your terminal.flatMapDepth
function from the Lodash library in your TypeScript file as shown below:index.ts39 chars2 lines
flatMapDepth
function in your code as shown below:index.ts135 chars5 lines
Here, the flatMapDepth
function takes two arguments:
The output of the above code will be [1, 2, 3, 4, 5, 6]
which is a flattened array up to 2 levels.
gistlibby LogSnag