The docs for A.take state:
|
/** Returns a new array including the first `n` elements of the provided array, or an empty array if `n` is either negative or greater than the length of the provided array. */ |
however if n is greater than the length of the array, the whole array is returned instead of an empty array.
for example:
console.log(A.take([1, 2, 3], 10));
logs [ 1, 2, 3 ] whereas it should log [].
when using a negative n this does correctly print out an empty array.
for example:
console.log(A.take([1, 2, 3], -10));
logs [].
The docs for
A.takestate:ts-belt/src/Array/index.ts
Line 147 in c825d97
however if
nis greater than the length of the array, the whole array is returned instead of an empty array.for example:
logs
[ 1, 2, 3 ]whereas it should log[].when using a negative
nthis does correctly print out an empty array.for example:
logs
[].