Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/neox5/subarrayjs
https://github.com/neox5/subarrayjs
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/neox5/subarrayjs
- Owner: neox5
- Created: 2020-07-23T11:57:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T14:58:58.000Z (about 2 years ago)
- Last Synced: 2024-10-07T19:09:23.229Z (3 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
[![npm](https://img.shields.io/npm/v/sub-arrays-js)](https://www.npmjs.com/package/sub-arrays-js)
[![npm](https://img.shields.io/npm/l/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
![NPM](https://img.shields.io/npm/l/sub-arrays-js)
- **[MIT license](http://opensource.org/licenses/mit-license.php)**