Skip to content

A.take does not return empty array when n greater than length of array (as documented) #102

@josh-

Description

@josh-

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 [].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions