Merge remote-tracking branch 'origin/master'
This commit is contained in:
23
README.md
23
README.md
@ -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
Reference in New Issue
Block a user