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