@extra-array/drop-while-right
Version:
Discards values from right, while a test passes.
51 lines (37 loc) • 1.63 kB
Markdown
Discards values from right, while a test passes.
[:package:](https://www.npmjs.com/package/@extra-array/drop-while-right)
[:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array)
[:running:](https://npm.runkit.com/@extra-array/drop-while-right)
[:vhs:](https://asciinema.org/a/339739)
[:moon:](https://www.npmjs.com/package/@extra-array/drop-while-right.min)
[:scroll:](https://unpkg.com/@extra-array/drop-while-right/)
[: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.dropWhileRight(x, ft);
// x: an array
// ft: test function (v, i, x)
```
```javascript
const array = require("extra-array");
var x = [1, 2, 3, 4, 5];
array.dropWhileRight(x, v => v >= 3);
// [ 1, 2 ]
array.dropWhileRight(x, v => v >= 4);
// [ 1, 2, 3 ]
```
<br>
<br>
## References
- [Data.List.dropWhile: Haskell](https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-List.html#v:dropWhile)
- [Array.prototype.slice: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice)
[drop]: https://github.com/nodef/extra-array/wiki/drop
[dropRight]: https://github.com/nodef/extra-array/wiki/dropRight
[dropWhile]: https://github.com/nodef/extra-array/wiki/dropWhile
[dropWhileRight]: https://github.com/nodef/extra-array/wiki/dropWhileRight
[take]: https://github.com/nodef/extra-array/wiki/take