Module

x/lodash_es/mod.ts>take

lodash for deno use
Latest
function take
import { take } from "https://dotland.deno.dev/x/lodash_es@v0.0.2/mod.ts";

Creates a slice of array with n elements taken from the beginning.

Examples

_.take([1, 2, 3]); // => [1]

_.take([1, 2, 3], 2); // => [1, 2]

_.take([1, 2, 3], 5); // => [1, 2, 3]

_.take([1, 2, 3], 0); // => []

Parameters

array

The array to query.

n
guard