@annexe/array.head
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

@annexe/head

A function that returns the first element as an array and optionally to a specified index. You can also provide an index to where you want it to stop at as a second argument.

Usage

import { head } from '@annexe/head';

const myArray = [1, 2, 3, 4, 5];
console.log(head<number>(myArray)); // logs [1]
console.log(head<number>(myArray, 2)); // logs [1, 2]

Readme

Keywords

Package Sidebar

Install

npm i @annexe/array.head

Weekly Downloads

1

Version

0.1.1

License

MIT

Unpacked Size

3.91 kB

Total Files

14

Last publish

Collaborators

  • heyjules