Neophobe Plebeian Mumpsimus
Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@writetome51/array-get-head-tail

2.0.0 • Public • Published

getHead(numItems, array): any[]

Returns numItems from beginning of array.

getTail(numItems, array): any[]

Returns numItems from end of array.

Neither function modifies array.

Examples

let arr = ['h', 'i', 'j', 'k', 'l', 'm', 'n', 'o'];

getHead(3, arr);  
    // --> ['h', 'i', 'j']

getTail(2, arr);  
    // --> ['n', 'o']

Installation

npm i @writetome51/array-get-head-tail

Loading

import {getHead, getTail} from '@writetome51/array-get-head-tail';

Install

npm i @writetome51/array-get-head-tail

DownloadsWeekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

2.85 kB

Total Files

5

Last publish

Collaborators

  • avatar