Skip to content

unctionjs/takeFirst

Repository files navigation

@unction/takeFirst

Tests Stability Dependencies

number => Array | string => Array | string

Returns the first N of a list of ordered values.

takeFirst(2)([1, 2, 3]) // [1, 2]
takeFirst(1)([1, 2, 3]) // [1]
takeFirst(2)("abc") // "ab"
takeFirst(1)("abc") // "a"