🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

lodash.combinations

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lodash.combinations - npm Package Compare versions

Comparing version

to
18.10.0

index.js

20

package.json
{
"name": "lodash.combinations",
"version": "18.9.19",
"version": "18.10.0",
"description": "Calculates all possible combinations of a certain size.",

@@ -8,2 +8,3 @@ "keywords": [

"collection",
"combination",
"combinatorics",

@@ -15,4 +16,5 @@ "lodash",

"author": "Sergej Sintschilin <seregpie@gmail.com>",
"main": "lodash.combinations.js",
"repository": "https://github.com/SeregPie/lodash.combinations.git",
"files": [],
"main": "index.js",
"repository": "github:SeregPie/lodash.combinations",
"scripts": {

@@ -24,10 +26,12 @@ "build": "rollup -c",

"devDependencies": {
"@seregpie/rollup-plugin-resolve": "^18.6.13",
"rollup": "^0.66.0",
"rollup-plugin-babel-minify": "^6.0.0",
"rollup-plugin-buble": "^0.19.2"
"@rollup/plugin-buble": "^0.21.3",
"eslint": "7.1.0",
"eslint-config-seregpie": "^1.0.1",
"lodash": "^4.17.15",
"rollup": "^2.13.1",
"rollup-plugin-terser": "^6.1.0"
},
"peerDependencies": {
"lodash": "^4.17.11"
"lodash": "^4.0.0"
}
}

33

README.md

@@ -10,10 +10,6 @@ # lodash.combinations

| `collection` | A collection of distinct values to calculate the combinations from. |
| `n` | The Number of values to combine. |
| `n` | The number of values to combine. |
Returns a new array of combinations.
Returns a new array.
## dependencies
- [lodash](https://github.com/lodash/lodash)
## setup

@@ -24,3 +20,3 @@

```shell
npm install lodash.combinations
npm i lodash.combinations
```

@@ -52,4 +48,4 @@

```javascript
let combinations = _.combinations([{a: 11}, {b: 22}, {c: 33}], 2);
// => [[{a: 11}, {b: 22}], [{a: 11}, {c: 33}], [{b: 22}, {c: 33}]]
let combinations = _.combinations([true, {a: 1}, null], 2);
// => [[true, {a: 1}], [true, null], [{a: 1}, null]]
```

@@ -59,7 +55,7 @@

To calculate all possible combinations of all possible sizes use this code.
Calculate all possible combinations of all possible sizes.
```javascript
let combinations = _.flatMap([1, 2, 3], (v, i, a) => _.combinations(a, i + 1));
// => [[1], [2], [3], [1, 2], [1, 3], [2, 3], [1, 2, 3]]
let combinations = _.flatMap([2, 4, 6], (v, i, a) => _.combinations(a, i + 1));
// => [[2], [4], [6], [2, 4], [2, 6], [4, 6], [2, 4, 6]]
```

@@ -69,7 +65,14 @@

Accepts also array-like values.
Also accepts array-like values.
```javascript
let combinations = _.combinations('abcde', 3);
// => [['a', 'b', 'c'], ['a', 'b', 'd'], ['a', 'b', 'e'], ['a', 'c', 'd'], ['a', 'c', 'e'], ['a', 'd', 'e'], ['b', 'c', 'd'], ['b', 'c', 'e'], ['b', 'd', 'e'], ['c', 'd', 'e']]
let combinations = _('abcde').combinations(3).map(v => _.join(v, '')).value();
// => ['abc', 'abd', 'abe', 'acd', 'ace', 'ade', 'bcd', 'bce', 'bde', 'cde']
```
## see also
- [lodash.permutations](https://github.com/SeregPie/lodash.permutations)
- [lodash.multicombinations](https://github.com/SeregPie/lodash.multicombinations)
- [lodash.multipermutations](https://github.com/SeregPie/lodash.multipermutations)
- [lodash.product](https://github.com/SeregPie/lodash.product)

Sorry, the diff of this file is not supported yet