take
take :: (Integer count, Array input) => Array outputdescription
take returns a new array only keeping the first count elements of the input array. If count is negative, take returns the last count elements.
examples
using a positive count argument
import { take } from 'conductor'
take(2, [1, 2, 3]) // [1, 2]using a negative count argument
import { take } from 'conductor'
take(-2, [1, 2, 3]) // [2, 3]using a count argument greater than the array's length
import { take } from 'conductor'
take(100, [1, 2, 3]) // [1, 2, 3]Last updated