take

Returns the first N elements of the array.

Type

type take = (count: number) => <E>(array: Array<E>) => Array<E>

Example

import {take} from 'fnxt/array';

const array = [0, 1, 2, 3, 4];
const result = take(2)(array);

console.log(result);
// Output: [0, 1]

See Also