UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

9 lines (6 loc) 211 B
import { toInteger } from '../compat/util/toInteger.mjs'; function take(arr, count, guard) { count = guard || count === undefined ? 1 : toInteger(count); return arr.slice(0, count); } export { take };