@extra-array/drop
Version:
Discards first n values only.
52 lines (38 loc) • 1.56 kB
Markdown
Discards first n values only.
[:package:](https://www.npmjs.com/package/@extra-array/drop)
[:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array)
[:running:](https://npm.runkit.com/@extra-array/drop)
[:vhs:](https://asciinema.org/a/332039)
[:moon:](https://www.npmjs.com/package/@extra-array/drop.min)
[:scroll:](https://unpkg.com/@extra-array/drop/)
[:newspaper:](https://nodef.github.io/extra-array/)
[:blue_book:](https://github.com/nodef/extra-array/wiki/)
> Alternatives: [drop], [dropRight], [dropWhile], [dropWhileRight].<br>
> Similar: [take], [drop].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
<br>
```javascript
array.drop(x, [n]);
// x: an array
// n: number of values (1)
```
```javascript
const array = require("extra-array");
var x = [1, 2, 3, 4, 5];
array.drop(x, 2);
// [ 3, 4, 5 ]
array.drop(x, 3);
// [ 4, 5 ]
```
<br>
<br>
## References
- [Data.List.drop: Haskell](https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-List.html#v:drop)
- [Array.prototype.slice: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice)
- [_.drop: lodash](https://lodash.com/docs/4.17.15#drop)
[drop]: https://github.com/nodef/extra-array/wiki/drop
[dropWhile]: https://github.com/nodef/extra-array/wiki/dropWhile
[take]: https://github.com/nodef/extra-array/wiki/take
[dropRight]: https://github.com/nodef/extra-array/wiki/dropRight
[dropWhileRight]: https://github.com/nodef/extra-array/wiki/dropWhileRight