PHP WebShell

Текущая директория: /opt/BitGoJS/node_modules/lodash.combinations

Просмотр файла: README.md

# lodash.combinations

`_.combinations(collection, n)`

Calculates all possible combinations of a certain size.

| argument | description |
| ---: | :--- |
| `collection` | A collection of distinct values to calculate the combinations from. |
| `n` | The Number of values to combine. |

Returns a new array of combinations.

## dependencies

- [lodash](https://github.com/lodash/lodash)

## setup

### npm

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

### ES module

```javascript
import 'lodash.combinations';
import _ from 'lodash';
```

### Node

```javascript
require('lodash.combinations');
let _ = require('lodash');
```

### browser

```html
<script src="https://unpkg.com/lodash"></script>
<script src="https://unpkg.com/lodash.combinations"></script>
```

## usage

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

---

To calculate all possible combinations of all possible sizes use this code.

```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]]
```

---

Accepts also 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']]
```

Выполнить команду


Для локальной разработки. Не используйте в интернете!