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)
|
* [`unzip`](#unzip)
|
||||||
* [`unzipWith`](#unzipwith-)
|
* [`unzipWith`](#unzipwith-)
|
||||||
* [`without`](#without)
|
* [`without`](#without)
|
||||||
|
* [`xProd`](#xprod)
|
||||||
* [`zip`](#zip)
|
* [`zip`](#zip)
|
||||||
* [`zipObject`](#zipobject)
|
* [`zipObject`](#zipobject)
|
||||||
* [`zipWith`](#zipwith-)
|
* [`zipWith`](#zipwith-)
|
||||||
@ -2226,6 +2227,28 @@ without([2, 1, 2, 3], 1, 2); // [3]
|
|||||||
<br>[⬆ Back to top](#table-of-contents)
|
<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
|
### zip
|
||||||
|
|
||||||
Creates an array of elements, grouped based on the position in the original arrays.
|
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