https://github.com/neox5/subarrayjs
https://github.com/neox5/subarrayjs
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/neox5/subarrayjs
- Owner: neox5
- Created: 2020-07-23T11:57:26.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T14:58:58.000Z (over 2 years ago)
- Last Synced: 2025-03-18T14:19:21.147Z (4 months ago)
- Language: TypeScript
- Size: 641 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# sub-arrays-js
Generates sub arrays from array
# Table of Contents
- [Status](#status)
- [Installation](#installation)
- [Usage](#usage)
- [Options](#options)
- [License](#license)# Status
[](https://www.npmjs.com/package/sub-arrays-js)
[](#license)# Installation
- Add with [yarn](https://yarnpkg.com/): `yarn add sub-arrays-js`
- Add with [npm](https://www.npmjs.com/): `npm install sub-arrays-js`# Usage
```js
import { subArrays } from "sub-arrays-js";function run() {
const src = [1,2,3,4];
const sub = subArrays(src, 1, src.length, true);
console.log(sub);
}
``````
[[1], [2], [3], [4], [1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4], [1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4], [1, 2, 3, 4]]
```# Options
```
subArrays(source, , , ): any[][]
```- `source(any[])` - Source Array
- `minLength(number)` - Minimum sub array length (default: 1)
- `maxLength(number)` - Maximum sub array length (default: source.length)
- `ordered(boolean)` - Order sub arrays by length (default: false)## License

- **[MIT license](http://opensource.org/licenses/mit-license.php)**