An array containing the results of the map
function.
const result = filteredMap(
[1, 2, 3, 4, 5],
(value) => value > 3,
(value) => value * 10
) // type: number[]
console.log(result) // [40, 50]
import { isNumber } from 'uft'
const result = filteredMap(
['foo', 2, 3, null],
isNumber,
(value) => {
value // type: number
return value ** 2
}
) // type: number[]
console.log(result) // [4, 9]
Generated using TypeDoc
Applies a
filter
function to the elements of the given array, and then creates a new array using the return values from calling amap
function with each of the filtered elements.