Identifies the element type of the array-like or iterable.
Identifies returned type of the array
An array-like object or iterable to convert to an array.
Optional
mapFn: ArrFromMapFn<T, U>Optional
thisArg: anyValue of 'this' used to invoke the mapfn.
0.9.7
arrFrom("Hello");
// [ "H", "e", "l", "l", "o" ]
arrFrom(new Set(["Hello", "Darkness", "my", "old", "friend"]));
// ["Hello", "Darkness", "my", "old", "friend"]
let map = new Map([
[ 1, "Hello" ],
[ 2, "Darkness" ],
[ 3, "my" ],
[ 4, "old" ],
[ 5, "friend"]
]);
arrFrom(map.values());
// ["Hello", "Darkness", "my", "old", "friend"]
arrFrom(map.keys());
// [ 1, 2, 3, 4, 5 ]
arrFrom(map.entries());
// [ [ 1, "Hello" ], [ 2, "Darkness" ], [ 3, "my" ], [ 4, "old" ], [ 5, "friend"] ]
// With a Mapping function
const map = new Map([
[ 1, "Hello" ],
[ 2, "Darkness" ],
[ 3, "my" ],
[ 4, "old" ],
[ 5, "friend"]
]);
arrFrom(map, ([ key, value ]) => ({ [key]: value }));
// [ {"1": "Hello"}, {"2": "Darkness"}, {"3": "my"}, {"4": "old"}, {"5": "friend"} ]
Creates an new shallow-copied array from an array-like object or an iterable.