UNPKG

@extra-array/suffixes

Version:
46 lines (32 loc) 1.25 kB
Lists all possible suffixes. [:package:](https://www.npmjs.com/package/@extra-array/suffixes) [:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array) [:running:](https://npm.runkit.com/@extra-array/suffixes) [:vhs:](https://asciinema.org/a/332141) [:moon:](https://www.npmjs.com/package/@extra-array/suffixes.min) [:scroll:](https://unpkg.com/@extra-array/suffixes/) [:newspaper:](https://nodef.github.io/extra-array/) [:blue_book:](https://github.com/nodef/extra-array/wiki/) > Similar: [suffix], [suffixes], [hasSuffix]. > This is part of package [extra-array]. [extra-array]: https://www.npmjs.com/package/extra-array <br> ```javascript array.suffixes(x, [n]); // x: an array // n: number of values (-1 => any) ``` ```javascript const array = require("extra-array"); [...array.suffixes([1, 2])]; // [ [ 1, 2 ], [ 2 ], [] ] [...array.suffixes([1, 2, 3])]; // [ [ 1, 2, 3 ], [ 2, 3 ], [ 3 ], [] ] ``` <br> <br> ## References - [Data.List.tails: Haskell](https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-List.html#v:tails) [suffix]: https://github.com/nodef/extra-array/wiki/suffix [suffixes]: https://github.com/nodef/extra-array/wiki/suffixes [hasSuffix]: https://github.com/nodef/extra-array/wiki/hasSuffix