Merge remote-tracking branch 'origin/master'

This commit is contained in:
Angelos Chalaris
2018-01-24 15:58:03 +02:00
2 changed files with 26 additions and 1 deletions

View File

@ -162,6 +162,7 @@ average(1, 2, 3);
* [`unzip`](#unzip)
* [`unzipWith`](#unzipwith-)
* [`without`](#without)
* [`xProd`](#xprod)
* [`zip`](#zip)
* [`zipObject`](#zipobject)
* [`zipWith`](#zipwith-)
@ -2226,6 +2227,28 @@ without([2, 1, 2, 3], 1, 2); // [3]
<br>[⬆ Back to top](#table-of-contents)
### xProd
Creates a new array out of the two supplied by creating each possible pair from the arrays.
Use `Array.map()` to produce every possible pair from the elements of the two arrays.
```js
const xProd = (a, b) => a.map(x => b.map(y => [x, y]));
```
<details>
<summary>Examples</summary>
```js
xProd([1, 2], ['a', 'b']); // [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]
```
</details>
<br>[⬆ Back to top](#table-of-contents)
### zip
Creates an array of elements, grouped based on the position in the original arrays.

File diff suppressed because one or more lines are too long