sub-arrays-js
v0.0.3
Published
Generate sub arrays from array
Downloads
2
Readme
sub-arrays-js
Generates sub arrays from array
Table of Contents
Status
Installation
Usage
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, <minLength>, <maxLength>, <ordered>): any[][]
source(any[])
- Source ArrayminLength(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)