combinations
combinations copied to clipboard
Node library to find all combinations from an array
```js var combinations = require('combinations'); var arr = ['red', 'orange', 'yellow', 'green']; combinations(arr, 2, 2) ``` Yields 12 combinations, including some that have 3 elements. Was expecting an array of...
```js const combo = (a: T[], min?: number, max?: number): T[][] => { min = min || 1; max = Math.min(max || a.length, a.length); const fn = (n: number, src:...
-- Fixed a bug discussed in #8 where 'max' was not being handled properly with arrays bigger than 4 items
A bug was found while iterating bigger arrays a new test was also added.
lets say i have three arrays var arr1 = ['red', 'orange', 'yellow',]; var arr2 = ['car', 'bus']; var arr3 = ['china']; how to get the following combinations ,order matters, each...
Min length parameter unexpected behavior when cardinality of input array is smaller than min length.
``` combinations([1], 2) ``` Should return `[]` but instead returns `[[1]]` Analog for all cases where min length > cardinality of input
package.json indicates this is MIT licensed, but there is no license file. Please add an explicit MIT license file to the repository to make it easier to identify the licensing.
### Version node v22.11.0 npm 10.9.0 ### Platform ```text Linux u24vm 6.8.0-48-generic #48-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 14:04:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux ``` ### What steps will...