UNPKG

@extra-array/init

Version:
47 lines (33 loc) 1.21 kB
Gets values except last. [:package:](https://www.npmjs.com/package/@extra-array/init) [:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array) [:running:](https://npm.runkit.com/@extra-array/init) [:vhs:](https://asciinema.org/a/332068) [:moon:](https://www.npmjs.com/package/@extra-array/init.min) [:scroll:](https://unpkg.com/@extra-array/init/) [:newspaper:](https://nodef.github.io/extra-array/) [:blue_book:](https://github.com/nodef/extra-array/wiki/) > Similar: [head], [tail], [init], [last]. > This is part of package [extra-array]. [extra-array]: https://www.npmjs.com/package/extra-array <br> ```javascript array.init(x); // x: an array ``` ```javascript const array = require("extra-array"); array.init([1, 2, 3]); // [1, 2] array.init([1]); // [] ``` <br> <br> ## References - [Data.List.init: Haskell](https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-List.html#v:init) - [_.initial: lodash](https://lodash.com/docs/4.17.15#initial) [head]: https://github.com/nodef/extra-array/wiki/head [tail]: https://github.com/nodef/extra-array/wiki/tail [init]: https://github.com/nodef/extra-array/wiki/init [last]: https://github.com/nodef/extra-array/wiki/last