rambda 10.3.3 → 10.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +226 -144
- package/dist/rambda.cjs +12 -2
- package/dist/rambda.js +12 -2
- package/dist/rambda.umd.js +12 -2
- package/index.d.cts +16 -9
- package/index.d.ts +16 -9
- package/package.json +9 -8
- package/src/mapParallelAsync.js +12 -2
package/README.md
CHANGED
|
@@ -21,7 +21,7 @@ const result = pipe(
|
|
|
21
21
|
//=> [6, 8]
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
You can test this example in <a href="https://rambda.
|
|
24
|
+
You can test this example in <a href="https://rambda.netlify.app/?const%20result%20%3D%20R.pipe(%0A%20%20%5B1%2C%202%2C%203%2C%204%5D%2C%0A%20%20R.filter(x%20%3D%3E%20x%20%3E%202)%2C%0A%20%20R.map(x%20%3D%3E%20x%20*%202)%2C%0A)%0A%2F%2F%20%3D%3E%20%5B6%2C%208%5D">Rambda's REPL</a>
|
|
25
25
|
|
|
26
26
|
* [API](#api)
|
|
27
27
|
* [Changelog](#-changelog)
|
|
@@ -183,7 +183,7 @@ const result = R.pipe(
|
|
|
183
183
|
// => { a: 1, b: 'foo', c: 3 }
|
|
184
184
|
```
|
|
185
185
|
|
|
186
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
186
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.pipe(%0A%09%7B%20a%3A%201%2C%20b%3A%20'foo'%20%7D%2C%0A%09R.addProp('c'%2C%203)%0A)%0A%2F%2F%20%3D%3E%20%7B%20a%3A%201%2C%20b%3A%20'foo'%2C%20c%3A%203%20%7D">Try this <strong>R.addProp</strong> example in Rambda REPL</a>
|
|
187
187
|
|
|
188
188
|
<details>
|
|
189
189
|
|
|
@@ -278,7 +278,7 @@ const result = R.pipe(
|
|
|
278
278
|
// => [{a: 1, b: 2, c: '3'}, {a: 3, b: 4, c: '7'}]
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
281
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.pipe(%0A%09%5B%0A%09%09%7Ba%3A%201%2C%20b%3A%202%7D%2C%0A%09%09%7Ba%3A%203%2C%20b%3A%204%7D%2C%0A%09%5D%2C%0A%09R.addPropToObjects(%0A%09%09'c'%2C%0A%09%09(x)%20%3D%3E%20String(x.a%20%2B%20x.b)%2C%0A%09)%0A)%0A%2F%2F%20%3D%3E%20%5B%7Ba%3A%201%2C%20b%3A%202%2C%20c%3A%20'3'%7D%2C%20%7Ba%3A%203%2C%20b%3A%204%2C%20c%3A%20'7'%7D%5D">Try this <strong>R.addPropToObjects</strong> example in Rambda REPL</a>
|
|
282
282
|
|
|
283
283
|
<details>
|
|
284
284
|
|
|
@@ -393,7 +393,7 @@ const result = R.pipe(
|
|
|
393
393
|
) // => true
|
|
394
394
|
```
|
|
395
395
|
|
|
396
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
396
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%200%2C%201%2C%202%2C%203%2C%204%20%5D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3E%20-1%0A%0Aconst%20result%20%3D%20R.pipe(%0A%09list%2C%0A%09R.all(predicate)%0A)%20%2F%2F%20%3D%3E%20true">Try this <strong>R.all</strong> example in Rambda REPL</a>
|
|
397
397
|
|
|
398
398
|
<details>
|
|
399
399
|
|
|
@@ -491,7 +491,7 @@ const result = R.pipe(
|
|
|
491
491
|
) // => [[1, 2, 3, 4]]
|
|
492
492
|
```
|
|
493
493
|
|
|
494
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
494
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%5B1%2C%202%2C%203%2C%204%5D%2C%20%5B3%2C%204%2C%205%5D%5D%0Aconst%20result%20%3D%20R.pipe(%0A%09list%2C%0A%09R.filter(R.allPass(%5BR.includes(2)%2C%20R.includes(3)%5D))%0A)%20%2F%2F%20%3D%3E%20%5B%5B1%2C%202%2C%203%2C%204%5D%5D">Try this <strong>R.allPass</strong> example in Rambda REPL</a>
|
|
495
495
|
|
|
496
496
|
<details>
|
|
497
497
|
|
|
@@ -591,7 +591,7 @@ R.any(predicate)(list)
|
|
|
591
591
|
// => true
|
|
592
592
|
```
|
|
593
593
|
|
|
594
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
594
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B1%2C%202%2C%203%5D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20*%20x%20%3E%208%0Aconst%20result%20%3D%20R.any(predicate)(list)%0A%2F%2F%20%3D%3E%20true">Try this <strong>R.any</strong> example in Rambda REPL</a>
|
|
595
595
|
|
|
596
596
|
<details>
|
|
597
597
|
|
|
@@ -688,7 +688,7 @@ const result = fn(input)
|
|
|
688
688
|
// => true
|
|
689
689
|
```
|
|
690
690
|
|
|
691
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
691
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20isBig%20%3D%20x%20%3D%3E%20x%20%3E%2020%0Aconst%20isOdd%20%3D%20x%20%3D%3E%20x%20%25%202%20%3D%3D%3D%201%0Aconst%20input%20%3D%2011%0A%0Aconst%20fn%20%3D%20R.anyPass(%0A%20%20%5BisBig%2C%20isOdd%5D%0A)%0A%0Aconst%20result%20%3D%20fn(input)%0A%2F%2F%20%3D%3E%20true">Try this <strong>R.anyPass</strong> example in Rambda REPL</a>
|
|
692
692
|
|
|
693
693
|
<details>
|
|
694
694
|
|
|
@@ -838,7 +838,7 @@ const result = R.append('foo')(['bar', 'baz'])
|
|
|
838
838
|
// => ['bar', 'baz', 'foo']
|
|
839
839
|
```
|
|
840
840
|
|
|
841
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
841
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.append('foo')(%5B'bar'%2C%20'baz'%5D)%0A%2F%2F%20%3D%3E%20%5B'bar'%2C%20'baz'%2C%20'foo'%5D">Try this <strong>R.append</strong> example in Rambda REPL</a>
|
|
842
842
|
|
|
843
843
|
<details>
|
|
844
844
|
|
|
@@ -930,7 +930,7 @@ const result = R.pipe(
|
|
|
930
930
|
// => [{a: 0}, {a: 1}, {a: 2}]
|
|
931
931
|
```
|
|
932
932
|
|
|
933
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
933
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.pipe(%0A%09%5B%7Ba%3A%201%7D%2C%20%7Ba%3A%202%7D%2C%20%7Ba%3A%200%7D%5D%2C%0A%09R.sort(R.ascend(R.prop('a')))%0A)%0A%2F%2F%20%3D%3E%20%5B%7Ba%3A%200%7D%2C%20%7Ba%3A%201%7D%2C%20%7Ba%3A%202%7D%5D">Try this <strong>R.ascend</strong> example in Rambda REPL</a>
|
|
934
934
|
|
|
935
935
|
<details>
|
|
936
936
|
|
|
@@ -1136,7 +1136,7 @@ const result = condition(input)
|
|
|
1136
1136
|
// => true
|
|
1137
1137
|
```
|
|
1138
1138
|
|
|
1139
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
1139
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20condition%20%3D%20R.checkObjectWithSpec(%7B%0A%20%20a%20%3A%20x%20%3D%3E%20typeof%20x%20%3D%3D%3D%20%22string%22%2C%0A%20%20b%20%3A%20x%20%3D%3E%20x%20%3D%3D%3D%204%0A%7D)%0Aconst%20input%20%3D%20%7B%0A%20%20a%20%3A%20%22foo%22%2C%0A%20%20b%20%3A%204%2C%0A%20%20c%20%3A%2011%2C%0A%7D%0A%0Aconst%20result%20%3D%20condition(input)%0A%2F%2F%20%3D%3E%20true">Try this <strong>R.checkObjectWithSpec</strong> example in Rambda REPL</a>
|
|
1140
1140
|
|
|
1141
1141
|
<details>
|
|
1142
1142
|
|
|
@@ -1272,7 +1272,7 @@ const result = R.pipe(
|
|
|
1272
1272
|
// => { a: ['a', 'b', 'c'], b: [1, 2, 3], c: { a: 1, b: 2, c: 0, f: false } }
|
|
1273
1273
|
```
|
|
1274
1274
|
|
|
1275
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
1275
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.pipe(%0A%09%7B%0A%09%09a%3A%20%5B%20undefined%2C%20''%2C%20'a'%2C%20'b'%2C%20'c'%5D%2C%0A%09%09b%3A%20%5B1%2C2%2C%20null%2C%200%2C%20undefined%2C%203%5D%2C%0A%09%09c%3A%20%7B%20a%3A%201%2C%20b%3A%202%2C%20c%3A%200%2C%20d%3A%20undefined%2C%20e%3A%20null%2C%20f%3A%20false%20%7D%2C%0A%09%7D%2C%0A%09x%20%3D%3E%20(%7B%0A%09%09a%3A%20R.compact(x.a)%2C%0A%09%09b%3A%20R.compact(x.b)%2C%0A%09%09c%3A%20R.compact(x.c)%0A%09%7D)%0A)%0A%2F%2F%20%3D%3E%20%7B%20a%3A%20%5B'a'%2C%20'b'%2C%20'c'%5D%2C%20b%3A%20%5B1%2C%202%2C%203%5D%2C%20c%3A%20%7B%20a%3A%201%2C%20b%3A%202%2C%20c%3A%200%2C%20f%3A%20false%20%7D%20%7D">Try this <strong>R.compact</strong> example in Rambda REPL</a>
|
|
1276
1276
|
|
|
1277
1277
|
<details>
|
|
1278
1278
|
|
|
@@ -1392,7 +1392,7 @@ const result = [
|
|
|
1392
1392
|
] => [ true, false ]
|
|
1393
1393
|
```
|
|
1394
1394
|
|
|
1395
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
1395
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20fn%20%3D%20x%20%3D%3E%20x%20%3E%205%0Aconst%20inverted%20%3D%20complement(fn)%0A%0Aconst%20result%20%3D%20%5B%0A%20%20fn(7)%2C%0A%20%20inverted(7)%0A%5D%20%3D%3E%20%5B%20true%2C%20false%20%5D">Try this <strong>R.complement</strong> example in Rambda REPL</a>
|
|
1396
1396
|
|
|
1397
1397
|
<details>
|
|
1398
1398
|
|
|
@@ -1473,7 +1473,7 @@ R.concat([1, 2])([3, 4]) // => [1, 2, 3, 4]
|
|
|
1473
1473
|
R.concat('foo')('bar') // => 'foobar'
|
|
1474
1474
|
```
|
|
1475
1475
|
|
|
1476
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
1476
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?R.concat(%5B1%2C%202%5D)(%5B3%2C%204%5D)%20%2F%2F%20%3D%3E%20%5B1%2C%202%2C%203%2C%204%5D%0Aconst%20result%20%3D%20R.concat('foo')('bar')%20%2F%2F%20%3D%3E%20'foobar'">Try this <strong>R.concat</strong> example in Rambda REPL</a>
|
|
1477
1477
|
|
|
1478
1478
|
<details>
|
|
1479
1479
|
|
|
@@ -1592,7 +1592,7 @@ const result = R.count(x => x.a !== undefined)(list)
|
|
|
1592
1592
|
// => 2
|
|
1593
1593
|
```
|
|
1594
1594
|
|
|
1595
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
1595
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%7Ba%3A%201%7D%2C%201%2C%20%7Ba%3A2%7D%5D%0Aconst%20result%20%3D%20R.count(x%20%3D%3E%20x.a%20!%3D%3D%20undefined)(list)%0A%2F%2F%20%3D%3E%202">Try this <strong>R.count</strong> example in Rambda REPL</a>
|
|
1596
1596
|
|
|
1597
1597
|
<details>
|
|
1598
1598
|
|
|
@@ -1683,7 +1683,7 @@ const expected = { a: 2, b: 2, c: 2 }
|
|
|
1683
1683
|
// => `result` is equal to `expected`
|
|
1684
1684
|
```
|
|
1685
1685
|
|
|
1686
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
1686
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%20'a'%2C%20'A'%2C%20'b'%2C%20'B'%2C%20'c'%2C%20'C'%20%5D%0A%0Aconst%20result%20%3D%20countBy(x%20%3D%3E%20x.toLowerCase())(%20list)%0Aconst%20expected%20%3D%20%7B%20a%3A%202%2C%20b%3A%202%2C%20c%3A%202%20%7D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.countBy</strong> example in Rambda REPL</a>
|
|
1687
1687
|
|
|
1688
1688
|
<details>
|
|
1689
1689
|
|
|
@@ -1781,7 +1781,7 @@ const result = R.createObjectFromKeys(
|
|
|
1781
1781
|
// => {a: 'a-0', b: 'b-1', c: 'c-2'}
|
|
1782
1782
|
```
|
|
1783
1783
|
|
|
1784
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
1784
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.createObjectFromKeys(%0A%09(x%2C%20index)%20%3D%3E%20%60%24%7Bx%7D-%24%7Bindex%7D%60%0A)(%5B'a'%2C%20'b'%2C%20'c'%5D)%0A%2F%2F%20%3D%3E%20%7Ba%3A%20'a-0'%2C%20b%3A%20'b-1'%2C%20c%3A%20'c-2'%7D">Try this <strong>R.createObjectFromKeys</strong> example in Rambda REPL</a>
|
|
1785
1785
|
|
|
1786
1786
|
<details>
|
|
1787
1787
|
|
|
@@ -1857,7 +1857,7 @@ R.defaultTo('foo'))(undefined) // => 'foo'
|
|
|
1857
1857
|
R.defaultTo('foo')('') // => 'foo'
|
|
1858
1858
|
```
|
|
1859
1859
|
|
|
1860
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
1860
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?R.defaultTo('foo')('bar')%20%2F%2F%20%3D%3E%20'bar'%0AR.defaultTo('foo'))(undefined)%20%2F%2F%20%3D%3E%20'foo'%0A%0A%2F%2F%20Important%20-%20emtpy%20string%20is%20not%20falsy%20value%0Aconst%20result%20%3D%20R.defaultTo('foo')('')%20%2F%2F%20%3D%3E%20'foo'">Try this <strong>R.defaultTo</strong> example in Rambda REPL</a>
|
|
1861
1861
|
|
|
1862
1862
|
<details>
|
|
1863
1863
|
|
|
@@ -1956,7 +1956,7 @@ const result = R.pipe(
|
|
|
1956
1956
|
// => [{a: 2}, {a: 1}, {a: 0}]
|
|
1957
1957
|
```
|
|
1958
1958
|
|
|
1959
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
1959
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.pipe(%0A%09%5B%7Ba%3A%201%7D%2C%20%7Ba%3A%202%7D%2C%20%7Ba%3A%200%7D%5D%2C%0A%09R.sort(R.descend(R.prop('a')))%0A)%0A%2F%2F%20%3D%3E%20%5B%7Ba%3A%202%7D%2C%20%7Ba%3A%201%7D%2C%20%7Ba%3A%200%7D%5D">Try this <strong>R.descend</strong> example in Rambda REPL</a>
|
|
1960
1960
|
|
|
1961
1961
|
<details>
|
|
1962
1962
|
|
|
@@ -2002,7 +2002,7 @@ It returns `howMany` items dropped from beginning of list.
|
|
|
2002
2002
|
R.drop(2)(['foo', 'bar', 'baz']) // => ['baz']
|
|
2003
2003
|
```
|
|
2004
2004
|
|
|
2005
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
2005
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.drop(2)(%5B'foo'%2C%20'bar'%2C%20'baz'%5D)%20%2F%2F%20%3D%3E%20%5B'baz'%5D">Try this <strong>R.drop</strong> example in Rambda REPL</a>
|
|
2006
2006
|
|
|
2007
2007
|
<details>
|
|
2008
2008
|
|
|
@@ -2135,7 +2135,7 @@ const result = dropLastWhile(predicate)(list);
|
|
|
2135
2135
|
// => [1, 2]
|
|
2136
2136
|
```
|
|
2137
2137
|
|
|
2138
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
2138
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B1%2C%202%2C%203%2C%204%2C%205%5D%3B%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3E%3D%203%0A%0Aconst%20result%20%3D%20dropLastWhile(predicate)(list)%3B%0A%2F%2F%20%3D%3E%20%5B1%2C%202%5D">Try this <strong>R.dropLastWhile</strong> example in Rambda REPL</a>
|
|
2139
2139
|
|
|
2140
2140
|
<details>
|
|
2141
2141
|
|
|
@@ -2219,7 +2219,7 @@ const result = R.dropRepeatsBy(
|
|
|
2219
2219
|
// => [1, 2, 3]
|
|
2220
2220
|
```
|
|
2221
2221
|
|
|
2222
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
2222
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.dropRepeatsBy(%0A%20%20Math.abs%2C%0A%20%20%5B1%2C%20-1%2C%202%2C%203%2C%20-3%5D%0A)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%2C%203%5D">Try this <strong>R.dropRepeatsBy</strong> example in Rambda REPL</a>
|
|
2223
2223
|
|
|
2224
2224
|
<details>
|
|
2225
2225
|
|
|
@@ -2247,7 +2247,7 @@ const result = R.dropRepeatsWith(R.prop('a'))(list)
|
|
|
2247
2247
|
// => [{a:1,b:2}, {a:2, b:4}]
|
|
2248
2248
|
```
|
|
2249
2249
|
|
|
2250
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
2250
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%7Ba%3A1%2Cb%3A2%7D%2C%20%7Ba%3A1%2Cb%3A3%7D%2C%20%7Ba%3A2%2C%20b%3A4%7D%5D%0Aconst%20result%20%3D%20R.dropRepeatsWith(R.prop('a'))(list)%0A%0A%2F%2F%20%3D%3E%20%5B%7Ba%3A1%2Cb%3A2%7D%2C%20%7Ba%3A2%2C%20b%3A4%7D%5D">Try this <strong>R.dropRepeatsWith</strong> example in Rambda REPL</a>
|
|
2251
2251
|
|
|
2252
2252
|
<details>
|
|
2253
2253
|
|
|
@@ -2275,7 +2275,7 @@ const result = R.dropWhile(predicate)(list)
|
|
|
2275
2275
|
// => [3, 4]
|
|
2276
2276
|
```
|
|
2277
2277
|
|
|
2278
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
2278
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B1%2C%202%2C%203%2C%204%5D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3C%203%0Aconst%20result%20%3D%20R.dropWhile(predicate)(list)%0A%2F%2F%20%3D%3E%20%5B3%2C%204%5D">Try this <strong>R.dropWhile</strong> example in Rambda REPL</a>
|
|
2279
2279
|
|
|
2280
2280
|
<details>
|
|
2281
2281
|
|
|
@@ -2394,7 +2394,7 @@ const result = R.duplicateBy(x => x, list)
|
|
|
2394
2394
|
// => [{a:1}]
|
|
2395
2395
|
```
|
|
2396
2396
|
|
|
2397
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
2397
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%7Ba%3A1%7D%2C%20%7Ba%3A2%7D%2C%20%7Ba%3A1%7D%5D%0Aconst%20result%20%3D%20R.duplicateBy(x%20%3D%3E%20x%2C%20list)%0A%0A%2F%2F%20%3D%3E%20%5B%7Ba%3A1%7D%5D">Try this <strong>R.duplicateBy</strong> example in Rambda REPL</a>
|
|
2398
2398
|
|
|
2399
2399
|
<details>
|
|
2400
2400
|
|
|
@@ -2462,7 +2462,7 @@ const result = R.eqBy(Math.abs, 5)(-5)
|
|
|
2462
2462
|
// => true
|
|
2463
2463
|
```
|
|
2464
2464
|
|
|
2465
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
2465
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.eqBy(Math.abs%2C%205)(-5)%0A%2F%2F%20%3D%3E%20true">Try this <strong>R.eqBy</strong> example in Rambda REPL</a>
|
|
2466
2466
|
|
|
2467
2467
|
<details>
|
|
2468
2468
|
|
|
@@ -2531,7 +2531,7 @@ const result = R.eqProps('a', obj1)(obj2)
|
|
|
2531
2531
|
// => true
|
|
2532
2532
|
```
|
|
2533
2533
|
|
|
2534
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
2534
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20obj1%20%3D%20%7Ba%3A%201%2C%20b%3A2%7D%0Aconst%20obj2%20%3D%20%7Ba%3A%201%2C%20b%3A3%7D%0Aconst%20result%20%3D%20R.eqProps('a'%2C%20obj1)(obj2)%0A%2F%2F%20%3D%3E%20true">Try this <strong>R.eqProps</strong> example in Rambda REPL</a>
|
|
2535
2535
|
|
|
2536
2536
|
<details>
|
|
2537
2537
|
|
|
@@ -2630,7 +2630,7 @@ R.equals(
|
|
|
2630
2630
|
) // => true
|
|
2631
2631
|
```
|
|
2632
2632
|
|
|
2633
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
2633
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?R.equals(%0A%20%20%5B1%2C%20%7Ba%3A2%7D%2C%20%5B%7Bb%3A%203%7D%5D%5D%2C%0A%20%20%5B1%2C%20%7Ba%3A2%7D%2C%20%5B%7Bb%3A%203%7D%5D%5D%0Aconst%20result%20%3D%20)%20%2F%2F%20%3D%3E%20true">Try this <strong>R.equals</strong> example in Rambda REPL</a>
|
|
2634
2634
|
|
|
2635
2635
|
<details>
|
|
2636
2636
|
|
|
@@ -3122,7 +3122,7 @@ const result = R.pipe(
|
|
|
3122
3122
|
// => result is { foo: 3, baz: 'baz' }
|
|
3123
3123
|
```
|
|
3124
3124
|
|
|
3125
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
3125
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20input%20%3D%20%7B%0A%09foo%3A%202%2C%0A%09baz%3A%20'baz'%2C%0A%7D%0Aconst%20result%20%3D%20R.pipe(%0A%09input%2C%0A%09R.evolve(%7B%0A%09%09foo%3A%20x%20%3D%3E%20x%20%2B%201%2C%0A%09%7D)%0A)%0A%2F%2F%20%3D%3E%20result%20is%20%7B%20foo%3A%203%2C%20baz%3A%20'baz'%20%7D">Try this <strong>R.evolve</strong> example in Rambda REPL</a>
|
|
3126
3126
|
|
|
3127
3127
|
<details>
|
|
3128
3128
|
|
|
@@ -3228,7 +3228,7 @@ const result = [
|
|
|
3228
3228
|
// => [true, true ]
|
|
3229
3229
|
```
|
|
3230
3230
|
|
|
3231
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
3231
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20%5B%0A%20%20R.excludes('ar')('foo')%2C%0A%20%20R.excludes(%7Ba%3A%202%7D)(%5B%7Ba%3A%201%7D%5D)%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20true%20%5D">Try this <strong>R.excludes</strong> example in Rambda REPL</a>
|
|
3232
3232
|
|
|
3233
3233
|
<details>
|
|
3234
3234
|
|
|
@@ -3321,7 +3321,7 @@ const result = R.filter(predicate)(list)
|
|
|
3321
3321
|
// => [2, 3]
|
|
3322
3322
|
```
|
|
3323
3323
|
|
|
3324
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
3324
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20predicate%20%3D%20x%20%3D%3E%20x%20%3E%201%0Aconst%20list%20%3D%20%5B1%2C%202%2C%203%5D%0Aconst%20result%20%3D%20R.filter(predicate)(list)%0A%2F%2F%20%3D%3E%20%5B2%2C%203%5D">Try this <strong>R.filter</strong> example in Rambda REPL</a>
|
|
3325
3325
|
|
|
3326
3326
|
<details>
|
|
3327
3327
|
|
|
@@ -3583,7 +3583,7 @@ const result = R.filterObject(
|
|
|
3583
3583
|
// => {a: 1, c: 3}
|
|
3584
3584
|
```
|
|
3585
3585
|
|
|
3586
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
3586
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.filterObject(%0A%09(val%2C%20prop)%20%3D%3E%20prop%20%3D%3D%3D%20'a'%20%7C%7C%20val%20%3E%201%0A)(%7Ba%3A%201%2C%20b%3A%202%2C%20c%3A3%7D)%0A%2F%2F%20%3D%3E%20%7Ba%3A%201%2C%20c%3A%203%7D">Try this <strong>R.filterObject</strong> example in Rambda REPL</a>
|
|
3587
3587
|
|
|
3588
3588
|
<details>
|
|
3589
3589
|
|
|
@@ -3691,7 +3691,7 @@ const result = R.find(predicate)(list)
|
|
|
3691
3691
|
// => {foo: 1}
|
|
3692
3692
|
```
|
|
3693
3693
|
|
|
3694
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
3694
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20predicate%20%3D%20x%20%3D%3E%20R.type(x.foo)%20%3D%3D%3D%20'Number'%0Aconst%20list%20%3D%20%5B%7Bfoo%3A%20'bar'%7D%2C%20%7Bfoo%3A%201%7D%5D%0A%0Aconst%20result%20%3D%20R.find(predicate)(list)%0A%2F%2F%20%3D%3E%20%7Bfoo%3A%201%7D">Try this <strong>R.find</strong> example in Rambda REPL</a>
|
|
3695
3695
|
|
|
3696
3696
|
<details>
|
|
3697
3697
|
|
|
@@ -3795,7 +3795,7 @@ const result = R.findIndex(predicate)(list)
|
|
|
3795
3795
|
// => 1
|
|
3796
3796
|
```
|
|
3797
3797
|
|
|
3798
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
3798
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20predicate%20%3D%20x%20%3D%3E%20R.type(x.foo)%20%3D%3D%3D%20'Number'%0Aconst%20list%20%3D%20%5B%7Bfoo%3A%20'bar'%7D%2C%20%7Bfoo%3A%201%7D%5D%0A%0Aconst%20result%20%3D%20R.findIndex(predicate)(list)%0A%2F%2F%20%3D%3E%201">Try this <strong>R.findIndex</strong> example in Rambda REPL</a>
|
|
3799
3799
|
|
|
3800
3800
|
<details>
|
|
3801
3801
|
|
|
@@ -3890,7 +3890,7 @@ const result = R.findLast(predicate)(list)
|
|
|
3890
3890
|
// => {foo: 1}
|
|
3891
3891
|
```
|
|
3892
3892
|
|
|
3893
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
3893
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20predicate%20%3D%20x%20%3D%3E%20R.type(x.foo)%20%3D%3D%3D%20'Number'%0Aconst%20list%20%3D%20%5B%7Bfoo%3A%200%7D%2C%20%7Bfoo%3A%201%7D%5D%0A%0Aconst%20result%20%3D%20R.findLast(predicate)(list)%0A%2F%2F%20%3D%3E%20%7Bfoo%3A%201%7D">Try this <strong>R.findLast</strong> example in Rambda REPL</a>
|
|
3894
3894
|
|
|
3895
3895
|
<details>
|
|
3896
3896
|
|
|
@@ -3945,7 +3945,7 @@ const result = R.findLastIndex(predicate)(list)
|
|
|
3945
3945
|
// => 1
|
|
3946
3946
|
```
|
|
3947
3947
|
|
|
3948
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
3948
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20predicate%20%3D%20x%20%3D%3E%20R.type(x.foo)%20%3D%3D%3D%20'Number'%0Aconst%20list%20%3D%20%5B%7Bfoo%3A%200%7D%2C%20%7Bfoo%3A%201%7D%5D%0A%0Aconst%20result%20%3D%20R.findLastIndex(predicate)(list)%0A%2F%2F%20%3D%3E%201">Try this <strong>R.findLastIndex</strong> example in Rambda REPL</a>
|
|
3949
3949
|
|
|
3950
3950
|
<details>
|
|
3951
3951
|
|
|
@@ -4034,7 +4034,7 @@ const result = R.findNth(predicate, 2)(list)
|
|
|
4034
4034
|
// => {foo: 2}
|
|
4035
4035
|
```
|
|
4036
4036
|
|
|
4037
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
4037
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20predicate%20%3D%20x%20%3D%3E%20R.type(x.foo)%20%3D%3D%3D%20'Number'%0Aconst%20list%20%3D%20%5B%7Bfoo%3A%200%7D%2C%20%7Bfoo%3A%201%7D%2C%20%7Bfoo%3A%202%7D%2C%20%7Bfoo%3A%203%7D%5D%0A%0Aconst%20result%20%3D%20R.findNth(predicate%2C%202)(list)%0A%2F%2F%20%3D%3E%20%7Bfoo%3A%202%7D">Try this <strong>R.findNth</strong> example in Rambda REPL</a>
|
|
4038
4038
|
|
|
4039
4039
|
<details>
|
|
4040
4040
|
|
|
@@ -4112,7 +4112,7 @@ const result = R.flatMap(duplicate)(list)
|
|
|
4112
4112
|
// => [ 1, 1, 2, 2, 3, 3 ]
|
|
4113
4113
|
```
|
|
4114
4114
|
|
|
4115
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
4115
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20duplicate%20%3D%20n%20%3D%3E%20%5B%20n%2C%20n%20%5D%0Aconst%20list%20%3D%20%5B%201%2C%202%2C%203%20%5D%0A%0Aconst%20result%20%3D%20R.flatMap(duplicate)(list)%0A%2F%2F%20%3D%3E%20%5B%201%2C%201%2C%202%2C%202%2C%203%2C%203%20%5D">Try this <strong>R.flatMap</strong> example in Rambda REPL</a>
|
|
4116
4116
|
|
|
4117
4117
|
<details>
|
|
4118
4118
|
|
|
@@ -4233,7 +4233,7 @@ const result = R.flatten<number>([
|
|
|
4233
4233
|
// => [ 1, 2, 3, 30, 300, 4 ]
|
|
4234
4234
|
```
|
|
4235
4235
|
|
|
4236
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
4236
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.flatten%3Cnumber%3E(%5B%0A%20%201%2C%0A%20%202%2C%0A%20%20%5B3%2C%2030%2C%20%5B300%5D%5D%2C%0A%20%20%5B4%5D%0A%5D)%0A%2F%2F%20%3D%3E%20%5B%201%2C%202%2C%203%2C%2030%2C%20300%2C%204%20%5D">Try this <strong>R.flatten</strong> example in Rambda REPL</a>
|
|
4237
4237
|
|
|
4238
4238
|
<details>
|
|
4239
4239
|
|
|
@@ -4331,7 +4331,7 @@ const result = R.flattenObject(
|
|
|
4331
4331
|
// => [3, 1, 2] or [2, 3, 1] or ...
|
|
4332
4332
|
```
|
|
4333
4333
|
|
|
4334
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
4334
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.flattenObject(%0A%09%5B1%2C%202%2C%203%5D%0A)%0A%2F%2F%20%3D%3E%20%5B3%2C%201%2C%202%5D%20or%20%5B2%2C%203%2C%201%5D%20or%20...">Try this <strong>R.flattenObject</strong> example in Rambda REPL</a>
|
|
4335
4335
|
|
|
4336
4336
|
<details>
|
|
4337
4337
|
|
|
@@ -4555,7 +4555,7 @@ const result = R.groupBy(groupFn, list)
|
|
|
4555
4555
|
// => { '1': ['a', 'b'], '2': ['aa', 'bb'] }
|
|
4556
4556
|
```
|
|
4557
4557
|
|
|
4558
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
4558
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%20'a'%2C%20'b'%2C%20'aa'%2C%20'bb'%20%5D%0Aconst%20groupFn%20%3D%20x%20%3D%3E%20x.length%0A%0Aconst%20result%20%3D%20R.groupBy(groupFn%2C%20list)%0A%2F%2F%20%3D%3E%20%7B%20'1'%3A%20%5B'a'%2C%20'b'%5D%2C%20'2'%3A%20%5B'aa'%2C%20'bb'%5D%20%7D">Try this <strong>R.groupBy</strong> example in Rambda REPL</a>
|
|
4559
4559
|
|
|
4560
4560
|
<details>
|
|
4561
4561
|
|
|
@@ -4672,7 +4672,7 @@ const result = [
|
|
|
4672
4672
|
// => [1, 'f']
|
|
4673
4673
|
```
|
|
4674
4674
|
|
|
4675
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
4675
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20%5B%0A%20%20R.head(%5B1%2C%202%2C%203%5D)%2C%0A%20%20R.head('foo')%0A%5D%0A%2F%2F%20%3D%3E%20%5B1%2C%20'f'%5D">Try this <strong>R.head</strong> example in Rambda REPL</a>
|
|
4676
4676
|
|
|
4677
4677
|
<details>
|
|
4678
4678
|
|
|
@@ -4795,7 +4795,7 @@ const result = [
|
|
|
4795
4795
|
// => [true, true ]
|
|
4796
4796
|
```
|
|
4797
4797
|
|
|
4798
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
4798
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20%5B%0A%20%20R.includes('oo')('foo')%2C%0A%20%20R.includes(%7Ba%3A%201%7D)(%5B%7Ba%3A%201%7D%5D)%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20true%20%5D">Try this <strong>R.includes</strong> example in Rambda REPL</a>
|
|
4799
4799
|
|
|
4800
4800
|
<details>
|
|
4801
4801
|
|
|
@@ -4927,7 +4927,7 @@ const result = R.indexBy(
|
|
|
4927
4927
|
// => {abc: {id: 'abc', title: 'B'}, xyz: {id: 'xyz', title: 'A'}}
|
|
4928
4928
|
```
|
|
4929
4929
|
|
|
4930
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
4930
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.indexBy(%0A%09'id'%0A)(%5B%7Bid%3A%20'xyz'%2C%20title%3A%20'A'%7D%2C%20%7Bid%3A%20'abc'%2C%20title%3A%20'B'%7D%5D)%0A%2F%2F%20%3D%3E%20%7Babc%3A%20%7Bid%3A%20'abc'%2C%20title%3A%20'B'%7D%2C%20xyz%3A%20%7Bid%3A%20'xyz'%2C%20title%3A%20'A'%7D%7D">Try this <strong>R.indexBy</strong> example in Rambda REPL</a>
|
|
4931
4931
|
|
|
4932
4932
|
<details>
|
|
4933
4933
|
|
|
@@ -5029,7 +5029,7 @@ const result = [
|
|
|
5029
5029
|
// => [0, 1]
|
|
5030
5030
|
```
|
|
5031
5031
|
|
|
5032
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
5032
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20%5B%0A%20%20R.indexOf(%7Ba%3A1%7D)(%5B%7Ba%3A1%7D%2C%20%7Ba%3A2%7D%5D)%2C%0A%20%20R.indexOf(2)(%5B1%2C%202%2C%203%5D)%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5B0%2C%201%5D">Try this <strong>R.indexOf</strong> example in Rambda REPL</a>
|
|
5033
5033
|
|
|
5034
5034
|
<details>
|
|
5035
5035
|
|
|
@@ -5129,7 +5129,7 @@ const result = [
|
|
|
5129
5129
|
// => [[1, 2], 'fo']
|
|
5130
5130
|
```
|
|
5131
5131
|
|
|
5132
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
5132
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20%5B%0A%20%20R.init(%5B1%2C%202%2C%203%5D)%20%2C%0A%20%20R.init('foo')%20%20%2F%2F%20%3D%3E%20'fo'%0A%5D%0A%2F%2F%20%3D%3E%20%5B%5B1%2C%202%5D%2C%20'fo'%5D">Try this <strong>R.init</strong> example in Rambda REPL</a>
|
|
5133
5133
|
|
|
5134
5134
|
<details>
|
|
5135
5135
|
|
|
@@ -5235,7 +5235,7 @@ const result = R.innerJoin(predicate, list1)(list2)
|
|
|
5235
5235
|
// => [4, 5]
|
|
5236
5236
|
```
|
|
5237
5237
|
|
|
5238
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
5238
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list1%20%3D%20%5B1%2C%202%2C%203%2C%204%2C%205%5D%0Aconst%20list2%20%3D%20%5B4%2C%205%2C%206%5D%0Aconst%20predicate%20%3D%20(x%2C%20y)%20%3D%3E%20x%20%3E%3D%20y%0Aconst%20result%20%3D%20R.innerJoin(predicate%2C%20list1)(list2)%0A%2F%2F%20%3D%3E%20%5B4%2C%205%5D">Try this <strong>R.innerJoin</strong> example in Rambda REPL</a>
|
|
5239
5239
|
|
|
5240
5240
|
<details>
|
|
5241
5241
|
|
|
@@ -5357,7 +5357,7 @@ const expected = 'foo is BAR even 1 more'
|
|
|
5357
5357
|
// => `result` is equal to `expected`
|
|
5358
5358
|
```
|
|
5359
5359
|
|
|
5360
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
5360
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20inputWithTags%20%3D%20'foo%20is%20%7B%7Bbar%7D%7D%20even%20%7B%7Ba%7D%7D%20more'%0Aconst%20templateArguments%20%3D%20%7B%22bar%22%3A%22BAR%22%2C%20a%3A%201%7D%0A%0Aconst%20result%20%3D%20R.interpolate(inputWithTags%2C%20templateArguments)%0Aconst%20expected%20%3D%20'foo%20is%20BAR%20even%201%20more'%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.interpolate</strong> example in Rambda REPL</a>
|
|
5361
5361
|
|
|
5362
5362
|
<details>
|
|
5363
5363
|
|
|
@@ -5466,7 +5466,7 @@ const result = R.intersection(listA)(listB)
|
|
|
5466
5466
|
// => [{ id : 3 }, { id : 4 }]
|
|
5467
5467
|
```
|
|
5468
5468
|
|
|
5469
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
5469
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20listA%20%3D%20%5B%20%7B%20id%20%3A%201%20%7D%2C%20%7B%20id%20%3A%202%20%7D%2C%20%7B%20id%20%3A%203%20%7D%2C%20%7B%20id%20%3A%204%20%7D%20%5D%0Aconst%20listB%20%3D%20%5B%20%7B%20id%20%3A%203%20%7D%2C%20%7B%20id%20%3A%204%20%7D%2C%20%7B%20id%20%3A%205%20%7D%2C%20%7B%20id%20%3A%206%20%7D%20%5D%0A%0Aconst%20result%20%3D%20R.intersection(listA)(listB)%0A%2F%2F%20%3D%3E%20%5B%7B%20id%20%3A%203%20%7D%2C%20%7B%20id%20%3A%204%20%7D%5D">Try this <strong>R.intersection</strong> example in Rambda REPL</a>
|
|
5470
5470
|
|
|
5471
5471
|
<details>
|
|
5472
5472
|
|
|
@@ -5561,7 +5561,7 @@ const result = R.intersperse(separator)(list)
|
|
|
5561
5561
|
// => [0, 10, 1, 10, 2, 10, 3]
|
|
5562
5562
|
```
|
|
5563
5563
|
|
|
5564
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
5564
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%200%2C%201%2C%202%2C%203%20%5D%0Aconst%20separator%20%3D%2010%0Aconst%20result%20%3D%20R.intersperse(separator)(list)%0A%2F%2F%20%3D%3E%20%5B0%2C%2010%2C%201%2C%2010%2C%202%2C%2010%2C%203%5D">Try this <strong>R.intersperse</strong> example in Rambda REPL</a>
|
|
5565
5565
|
|
|
5566
5566
|
<details>
|
|
5567
5567
|
|
|
@@ -5656,7 +5656,7 @@ It returns a string of all `list` instances joined with a `glue`.
|
|
|
5656
5656
|
R.join('-', [1, 2, 3]) // => '1-2-3'
|
|
5657
5657
|
```
|
|
5658
5658
|
|
|
5659
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
5659
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.join('-'%2C%20%5B1%2C%202%2C%203%5D)%20%20%2F%2F%20%3D%3E%20'1-2-3'">Try this <strong>R.join</strong> example in Rambda REPL</a>
|
|
5660
5660
|
|
|
5661
5661
|
<details>
|
|
5662
5662
|
|
|
@@ -5721,7 +5721,7 @@ const result = [
|
|
|
5721
5721
|
// => [3, 'o']
|
|
5722
5722
|
```
|
|
5723
5723
|
|
|
5724
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
5724
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20%5B%0A%20%20R.last(%5B1%2C%202%2C%203%5D)%2C%0A%20%20R.last('foo')%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5B3%2C%20'o'%5D">Try this <strong>R.last</strong> example in Rambda REPL</a>
|
|
5725
5725
|
|
|
5726
5726
|
<details>
|
|
5727
5727
|
|
|
@@ -5800,7 +5800,7 @@ const result = [
|
|
|
5800
5800
|
// => [4, -1]
|
|
5801
5801
|
```
|
|
5802
5802
|
|
|
5803
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
5803
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B1%2C%202%2C%203%2C%201%2C%202%2C%203%5D%0Aconst%20result%20%3D%20%5B%0A%20%20R.lastIndexOf(2)(list)%2C%0A%20%20R.lastIndexOf(4)(list)%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5B4%2C%20-1%5D">Try this <strong>R.lastIndexOf</strong> example in Rambda REPL</a>
|
|
5804
5804
|
|
|
5805
5805
|
<details>
|
|
5806
5806
|
|
|
@@ -5903,7 +5903,7 @@ const result = R.map(fn)(iterable),
|
|
|
5903
5903
|
// => [2, 4]
|
|
5904
5904
|
```
|
|
5905
5905
|
|
|
5906
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
5906
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20fn%20%3D%20x%20%3D%3E%20x%20*%202%0A%0Aconst%20iterable%20%3D%20%5B1%2C%202%5D%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20R.map(fn)(iterable)%2C%0A%2F%2F%20%3D%3E%20%5B2%2C%204%5D">Try this <strong>R.map</strong> example in Rambda REPL</a>
|
|
5907
5907
|
|
|
5908
5908
|
<details>
|
|
5909
5909
|
|
|
@@ -6022,7 +6022,7 @@ const result = await R.mapAsync(fn)([1, 2, 3])
|
|
|
6022
6022
|
// `result` resolves after 3 seconds to `[2, 3, 4]`
|
|
6023
6023
|
```
|
|
6024
6024
|
|
|
6025
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
6025
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?async%20function%20fn(x)%7B%0A%20%20await%20R.delay(1000)%0A%0A%20%20return%20x%2B1%0A%7D%0A%0Aconst%20result%20%3D%20await%20R.mapAsync(fn)(%5B1%2C%202%2C%203%5D)%0A%2F%2F%20%60result%60%20resolves%20after%203%20seconds%20to%20%60%5B2%2C%203%2C%204%5D%60">Try this <strong>R.mapAsync</strong> example in Rambda REPL</a>
|
|
6026
6026
|
|
|
6027
6027
|
<details>
|
|
6028
6028
|
|
|
@@ -6166,7 +6166,7 @@ const result = R.mapKeys(
|
|
|
6166
6166
|
// => { A1: 1, B2: 2 }
|
|
6167
6167
|
```
|
|
6168
6168
|
|
|
6169
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
6169
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.mapKeys(%0A%09(key%2C%20value)%20%3D%3E%20key.toUpperCase()%2Bvalue%0A%09)(%0A%09%7B%20a%3A%201%2C%20b%3A%202%20%7D%0A)%0A%2F%2F%20%3D%3E%20%7B%20A1%3A%201%2C%20B2%3A%202%20%7D">Try this <strong>R.mapKeys</strong> example in Rambda REPL</a>
|
|
6170
6170
|
|
|
6171
6171
|
<details>
|
|
6172
6172
|
|
|
@@ -6257,7 +6257,7 @@ const result = R.mapObject(fn)(obj)
|
|
|
6257
6257
|
// => {a: 'a-1', b: 'b-2'}
|
|
6258
6258
|
```
|
|
6259
6259
|
|
|
6260
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
6260
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20fn%20%3D%20(val%2C%20prop)%20%3D%3E%20%60%24%7Bprop%7D-%24%7Bval%7D%60%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20R.mapObject(fn)(obj)%0A%2F%2F%20%3D%3E%20%7Ba%3A%20'a-1'%2C%20b%3A%20'b-2'%7D">Try this <strong>R.mapObject</strong> example in Rambda REPL</a>
|
|
6261
6261
|
|
|
6262
6262
|
<details>
|
|
6263
6263
|
|
|
@@ -6493,22 +6493,22 @@ it('R.mapObjectAsync', async () => {
|
|
|
6493
6493
|
```typescript
|
|
6494
6494
|
|
|
6495
6495
|
mapParallelAsync<T extends IterableContainer, U>(
|
|
6496
|
-
fn: (value: T[number]
|
|
6496
|
+
fn: (value: T[number]) => Promise<U>,
|
|
6497
|
+
batchSize?: number,
|
|
6497
6498
|
): (data: T) => Promise<Mapped<T, U>>
|
|
6498
6499
|
```
|
|
6499
6500
|
|
|
6500
6501
|
Wrapper around `Promise.all` for asynchronous mapping with `fn` over members of `list`.
|
|
6502
|
+
There is optional `batchSize` parameter to allow parallel execution to run in batches. In this case, the whole batch must complete before the next batch starts.
|
|
6501
6503
|
|
|
6502
6504
|
<details>
|
|
6503
6505
|
|
|
6504
6506
|
<summary>All TypeScript definitions</summary>
|
|
6505
6507
|
|
|
6506
6508
|
```typescript
|
|
6507
|
-
mapParallelAsync<T extends IterableContainer, U>(
|
|
6508
|
-
fn: (value: T[number], index: number) => Promise<U>,
|
|
6509
|
-
): (data: T) => Promise<Mapped<T, U>>;
|
|
6510
6509
|
mapParallelAsync<T extends IterableContainer, U>(
|
|
6511
6510
|
fn: (value: T[number]) => Promise<U>,
|
|
6511
|
+
batchSize?: number,
|
|
6512
6512
|
): (data: T) => Promise<Mapped<T, U>>;
|
|
6513
6513
|
```
|
|
6514
6514
|
|
|
@@ -6519,8 +6519,18 @@ mapParallelAsync<T extends IterableContainer, U>(
|
|
|
6519
6519
|
<summary><strong>R.mapParallelAsync</strong> source</summary>
|
|
6520
6520
|
|
|
6521
6521
|
```javascript
|
|
6522
|
-
export function mapParallelAsync(fn)
|
|
6523
|
-
|
|
6522
|
+
export function mapParallelAsync(fn, batchSize){
|
|
6523
|
+
if(!batchSize) return async list => Promise.all(list.map(fn))
|
|
6524
|
+
|
|
6525
|
+
return async list => {
|
|
6526
|
+
const result = []
|
|
6527
|
+
for(let i = 0; i < list.length; i += batchSize){
|
|
6528
|
+
const batch = list.slice(i, i + batchSize)
|
|
6529
|
+
const batchResult = await Promise.all(batch.map((x, j) => fn(x, i + j)))
|
|
6530
|
+
result.push(...batchResult)
|
|
6531
|
+
}
|
|
6532
|
+
return result
|
|
6533
|
+
}
|
|
6524
6534
|
}
|
|
6525
6535
|
```
|
|
6526
6536
|
|
|
@@ -6556,6 +6566,17 @@ test('pipeAsync', async () => {
|
|
|
6556
6566
|
)
|
|
6557
6567
|
expect(result).toEqual([ 2,3,4 ])
|
|
6558
6568
|
})
|
|
6569
|
+
|
|
6570
|
+
test('with batchSize', async () => {
|
|
6571
|
+
const fn = async (x, i) => {
|
|
6572
|
+
await delay(100)
|
|
6573
|
+
return `${x}:${i}`
|
|
6574
|
+
}
|
|
6575
|
+
const result = await mapParallelAsync(fn, 2)([1, 2, 3, 4, 5])
|
|
6576
|
+
expect(result).toEqual(
|
|
6577
|
+
['1:0', '2:1', '3:2', '4:3', '5:4']
|
|
6578
|
+
)
|
|
6579
|
+
})
|
|
6559
6580
|
```
|
|
6560
6581
|
|
|
6561
6582
|
</details>
|
|
@@ -6566,46 +6587,53 @@ test('pipeAsync', async () => {
|
|
|
6566
6587
|
|
|
6567
6588
|
```typescript
|
|
6568
6589
|
|
|
6569
|
-
mapPropObject<T extends object, K extends keyof T, Value>(
|
|
6570
|
-
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6590
|
+
mapPropObject<T extends object, K extends keyof T, Value extends unknown>(
|
|
6591
|
+
prop: K,
|
|
6592
|
+
valueMapper: (
|
|
6593
|
+
listItem: T[K] extends ReadonlyArray<infer ElementType> ? ElementType : never,
|
|
6594
|
+
list: T[K] extends ReadonlyArray<any> ? T[K] : never,
|
|
6595
|
+
) => Value,
|
|
6575
6596
|
): (data: T) => T[K] extends ReadonlyArray<any>
|
|
6576
|
-
|
|
6577
|
-
|
|
6597
|
+
? MergeTypes<Omit<T, K> & { [P in K]: Value[] }>
|
|
6598
|
+
: never
|
|
6578
6599
|
```
|
|
6579
6600
|
|
|
6580
|
-
|
|
6601
|
+
Convenience method, when one needs to maps over a object property that is a list.
|
|
6581
6602
|
|
|
6582
6603
|
```javascript
|
|
6583
6604
|
const result = pipe(
|
|
6584
6605
|
{ a: [1,2,3], b: 'foo' },
|
|
6585
|
-
mapPropObject(x => {
|
|
6586
|
-
x // $ExpectType { a: number; b: string; }
|
|
6606
|
+
mapPropObject('a',x => {
|
|
6587
6607
|
return {
|
|
6588
6608
|
a: x,
|
|
6589
6609
|
flag: x > 2,
|
|
6590
6610
|
}
|
|
6591
|
-
}
|
|
6611
|
+
}),
|
|
6592
6612
|
)
|
|
6593
6613
|
// => { a: [{ a: 1, flag: false },{ a: 2, flag: false }, { a: 3, flag: true }], b: 'foo' }
|
|
6594
6614
|
```
|
|
6595
6615
|
|
|
6596
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
6616
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20pipe(%0A%09%7B%20a%3A%20%5B1%2C2%2C3%5D%2C%20b%3A%20'foo'%20%7D%2C%0A%09mapPropObject('a'%2Cx%20%3D%3E%20%7B%0A%09%09return%20%7B%0A%09%09%09a%3A%20x%2C%0A%09%09%09flag%3A%20x%20%3E%202%2C%0A%09%09%7D%0A%09%7D)%2C%0A)%0A%2F%2F%20%3D%3E%20%7B%20a%3A%20%5B%7B%20a%3A%201%2C%20flag%3A%20false%20%7D%2C%7B%20a%3A%202%2C%20flag%3A%20false%20%7D%2C%20%7B%20a%3A%203%2C%20flag%3A%20true%20%7D%5D%2C%20b%3A%20'foo'%20%7D">Try this <strong>R.mapPropObject</strong> example in Rambda REPL</a>
|
|
6597
6617
|
|
|
6598
6618
|
<details>
|
|
6599
6619
|
|
|
6600
6620
|
<summary>All TypeScript definitions</summary>
|
|
6601
6621
|
|
|
6602
6622
|
```typescript
|
|
6603
|
-
mapPropObject<T extends object, K extends keyof T, Value>(
|
|
6623
|
+
mapPropObject<T extends object, K extends keyof T, Value extends unknown>(
|
|
6624
|
+
prop: K,
|
|
6625
|
+
valueMapper: (
|
|
6626
|
+
listItem: T[K] extends ReadonlyArray<infer ElementType> ? ElementType : never,
|
|
6627
|
+
list: T[K] extends ReadonlyArray<any> ? T[K] : never,
|
|
6628
|
+
) => Value,
|
|
6629
|
+
): (data: T) => T[K] extends ReadonlyArray<any>
|
|
6630
|
+
? MergeTypes<Omit<T, K> & { [P in K]: Value[] }>
|
|
6631
|
+
: never;
|
|
6632
|
+
mapPropObject<T extends object, K extends keyof T, Value extends unknown>(
|
|
6633
|
+
prop: K,
|
|
6604
6634
|
valueMapper: (
|
|
6605
|
-
|
|
6606
|
-
data: T[K],
|
|
6635
|
+
listItem: T[K] extends ReadonlyArray<infer ElementType> ? ElementType : never,
|
|
6607
6636
|
) => Value,
|
|
6608
|
-
prop: K,
|
|
6609
6637
|
): (data: T) => T[K] extends ReadonlyArray<any>
|
|
6610
6638
|
? MergeTypes<Omit<T, K> & { [P in K]: Value[] }>
|
|
6611
6639
|
: never;
|
|
@@ -6664,24 +6692,52 @@ it('happy', () => {
|
|
|
6664
6692
|
<summary><strong>TypeScript</strong> test</summary>
|
|
6665
6693
|
|
|
6666
6694
|
```typescript
|
|
6667
|
-
import { mapPropObject, pipe } from 'rambda'
|
|
6695
|
+
import { map, mapPropObject, pipe } from 'rambda'
|
|
6668
6696
|
|
|
6669
6697
|
describe('R.mapPropObject', () => {
|
|
6670
6698
|
it('iterable with one arguments', () => {
|
|
6671
6699
|
const result = pipe(
|
|
6672
6700
|
{ a: [1,2,3], b: 'foo' },
|
|
6673
|
-
mapPropObject(x => {
|
|
6701
|
+
mapPropObject('a', x => {
|
|
6674
6702
|
x // $ExpectType number
|
|
6675
6703
|
return {
|
|
6676
6704
|
a: x,
|
|
6677
6705
|
flag: x > 2,
|
|
6678
6706
|
}
|
|
6679
|
-
}
|
|
6707
|
+
}),
|
|
6680
6708
|
)
|
|
6681
6709
|
|
|
6682
6710
|
result.a // $ExpectType { a: number; flag: boolean; }[]
|
|
6683
6711
|
result.b // $ExpectType string
|
|
6684
6712
|
})
|
|
6713
|
+
|
|
6714
|
+
it('iterable with two arguments', () => {
|
|
6715
|
+
const result = pipe(
|
|
6716
|
+
{ a: [1,2,3], b: 'foo' },
|
|
6717
|
+
mapPropObject('a', (x, list) => {
|
|
6718
|
+
x // $ExpectType number
|
|
6719
|
+
list // $ExpectType number[]
|
|
6720
|
+
return list.length
|
|
6721
|
+
}),
|
|
6722
|
+
)
|
|
6723
|
+
result.a // $ExpectType number[]
|
|
6724
|
+
result.b // $ExpectType string
|
|
6725
|
+
})
|
|
6726
|
+
|
|
6727
|
+
it('more complex example', () => {
|
|
6728
|
+
const result = pipe(
|
|
6729
|
+
[{a:[true, false, true], b: 'foo'}],
|
|
6730
|
+
map(
|
|
6731
|
+
mapPropObject( 'a',(a) => {
|
|
6732
|
+
a // $ExpectType boolean
|
|
6733
|
+
return {a, b: 2}
|
|
6734
|
+
})
|
|
6735
|
+
)
|
|
6736
|
+
)
|
|
6737
|
+
|
|
6738
|
+
result[0].a[0].a // $ExpectType boolean
|
|
6739
|
+
result[0].a[0].b // $ExpectType number
|
|
6740
|
+
})
|
|
6685
6741
|
})
|
|
6686
6742
|
```
|
|
6687
6743
|
|
|
@@ -6706,7 +6762,7 @@ const result = [
|
|
|
6706
6762
|
// => [[], ['ba', 'na', 'na']]
|
|
6707
6763
|
```
|
|
6708
6764
|
|
|
6709
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
6765
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20%5B%0A%20%20R.match('a'%2C%20'foo')%2C%0A%20%20R.match(%2F(%5Ba-z%5Da)%2Fg%2C%20'bananas')%0A%5D%0A%2F%2F%20%3D%3E%20%5B%5B%5D%2C%20%5B'ba'%2C%20'na'%2C%20'na'%5D%5D">Try this <strong>R.match</strong> example in Rambda REPL</a>
|
|
6710
6766
|
|
|
6711
6767
|
<details>
|
|
6712
6768
|
|
|
@@ -6792,7 +6848,7 @@ const compareFn = Math.abs
|
|
|
6792
6848
|
R.maxBy(compareFn, 5, -7) // => -7
|
|
6793
6849
|
```
|
|
6794
6850
|
|
|
6795
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
6851
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20compareFn%20%3D%20Math.abs%0A%0Aconst%20result%20%3D%20R.maxBy(compareFn%2C%205%2C%20-7)%20%2F%2F%20%3D%3E%20-7">Try this <strong>R.maxBy</strong> example in Rambda REPL</a>
|
|
6796
6852
|
|
|
6797
6853
|
<details>
|
|
6798
6854
|
|
|
@@ -6975,7 +7031,7 @@ const compareFn = Math.abs
|
|
|
6975
7031
|
R.minBy(compareFn, -5, 2) // => -5
|
|
6976
7032
|
```
|
|
6977
7033
|
|
|
6978
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
7034
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20compareFn%20%3D%20Math.abs%0A%0Aconst%20result%20%3D%20R.minBy(compareFn%2C%20-5%2C%202)%20%2F%2F%20%3D%3E%20-5">Try this <strong>R.minBy</strong> example in Rambda REPL</a>
|
|
6979
7035
|
|
|
6980
7036
|
<details>
|
|
6981
7037
|
|
|
@@ -7032,7 +7088,7 @@ const result = R.pipe(
|
|
|
7032
7088
|
) // => [1, 3, 3]
|
|
7033
7089
|
```
|
|
7034
7090
|
|
|
7035
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
7091
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.pipe(%0A%09%5B1%2C%202%2C%203%5D%2C%0A%09R.modifyItemAtIndex(1%2C%20x%20%3D%3E%20x%20%2B%201)%0A)%20%2F%2F%20%3D%3E%20%5B1%2C%203%2C%203%5D">Try this <strong>R.modifyItemAtIndex</strong> example in Rambda REPL</a>
|
|
7036
7092
|
|
|
7037
7093
|
<details>
|
|
7038
7094
|
|
|
@@ -7113,7 +7169,7 @@ const result = R.modifyPath('a.b.c', x=> x+1, {a:{b: {c:1}}})
|
|
|
7113
7169
|
// => {a:{b: {c:2}}}
|
|
7114
7170
|
```
|
|
7115
7171
|
|
|
7116
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
7172
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.modifyPath('a.b.c'%2C%20x%3D%3E%20x%2B1%2C%20%7Ba%3A%7Bb%3A%20%7Bc%3A1%7D%7D%7D)%0A%2F%2F%20%3D%3E%20%7Ba%3A%7Bb%3A%20%7Bc%3A2%7D%7D%7D">Try this <strong>R.modifyPath</strong> example in Rambda REPL</a>
|
|
7117
7173
|
|
|
7118
7174
|
<details>
|
|
7119
7175
|
|
|
@@ -7256,7 +7312,7 @@ const result = R.modifyProp('age', x => x + 1)(person)
|
|
|
7256
7312
|
// => {name: 'foo', age: 21}
|
|
7257
7313
|
```
|
|
7258
7314
|
|
|
7259
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
7315
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20person%20%3D%20%7B%0A%20%20name%20%3A%20'foo'%2C%0A%20%20age%20%20%3A%2020%2C%0A%7D%0Aconst%20result%20%3D%20R.modifyProp('age'%2C%20x%20%3D%3E%20x%20%2B%201)(person)%0A%2F%2F%20%3D%3E%20%7Bname%3A%20'foo'%2C%20age%3A%2021%7D">Try this <strong>R.modifyProp</strong> example in Rambda REPL</a>
|
|
7260
7316
|
|
|
7261
7317
|
<details>
|
|
7262
7318
|
|
|
@@ -7379,7 +7435,7 @@ const result = R.none(predicate)(arr)
|
|
|
7379
7435
|
// => true
|
|
7380
7436
|
```
|
|
7381
7437
|
|
|
7382
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
7438
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%200%2C%201%2C%202%2C%203%2C%204%20%5D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3E%206%0A%0Aconst%20result%20%3D%20R.none(predicate)(arr)%0A%2F%2F%20%3D%3E%20true">Try this <strong>R.none</strong> example in Rambda REPL</a>
|
|
7383
7439
|
|
|
7384
7440
|
<details>
|
|
7385
7441
|
|
|
@@ -7475,7 +7531,7 @@ const result = objectIncludes(specification)(input)
|
|
|
7475
7531
|
// => true
|
|
7476
7532
|
```
|
|
7477
7533
|
|
|
7478
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
7534
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20specification%20%3D%20%7B%20a%20%3A%20%7B%20b%20%3A%201%20%7D%20%7D%0Aconst%20input%20%3D%20%7B%0A%20%20a%20%3A%20%7B%20b%20%3A%201%20%7D%2C%0A%20%20c%20%3A%202%0A%7D%0A%0Aconst%20result%20%3D%20objectIncludes(specification)(input)%0A%2F%2F%20%3D%3E%20true">Try this <strong>R.objectIncludes</strong> example in Rambda REPL</a>
|
|
7479
7535
|
|
|
7480
7536
|
<details>
|
|
7481
7537
|
|
|
@@ -7599,7 +7655,7 @@ const result = R.objOf('foo')('bar')
|
|
|
7599
7655
|
// => {foo: 'bar'}
|
|
7600
7656
|
```
|
|
7601
7657
|
|
|
7602
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
7658
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.objOf('foo')('bar')%0A%2F%2F%20%3D%3E%20%7Bfoo%3A%20'bar'%7D">Try this <strong>R.objOf</strong> example in Rambda REPL</a>
|
|
7603
7659
|
|
|
7604
7660
|
<details>
|
|
7605
7661
|
|
|
@@ -7685,7 +7741,7 @@ const result = [
|
|
|
7685
7741
|
// => [{b: 2}, {b: 2}]
|
|
7686
7742
|
```
|
|
7687
7743
|
|
|
7688
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
7744
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%2C%20c%3A%203%7D%0Aconst%20propsToOmit%20%3D%20'a%2Cc%2Cd'%0Aconst%20propsToOmitList%20%3D%20%5B'a'%2C%20'c'%2C%20'd'%5D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.omit(propsToOmit%2C%20obj)%2C%0A%20%20R.omit(propsToOmitList%2C%20obj)%0A%5D%0A%2F%2F%20%3D%3E%20%5B%7Bb%3A%202%7D%2C%20%7Bb%3A%202%7D%5D">Try this <strong>R.omit</strong> example in Rambda REPL</a>
|
|
7689
7745
|
|
|
7690
7746
|
<details>
|
|
7691
7747
|
|
|
@@ -7827,7 +7883,7 @@ const expected = [[3], [1, 2]]
|
|
|
7827
7883
|
// `result` is equal to `expected`
|
|
7828
7884
|
```
|
|
7829
7885
|
|
|
7830
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
7886
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B1%2C%202%2C%203%5D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3E%202%0A%0Aconst%20result%20%3D%20R.partition(predicate)(list)%0A%0Aconst%20expected%20%3D%20%5B%5B3%5D%2C%20%5B1%2C%202%5D%5D%0A%2F%2F%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.partition</strong> example in Rambda REPL</a>
|
|
7831
7887
|
|
|
7832
7888
|
<details>
|
|
7833
7889
|
|
|
@@ -7952,7 +8008,7 @@ const expected = [{c: 3}, {a: 1, b: 2}]
|
|
|
7952
8008
|
// `result` is equal to `expected`
|
|
7953
8009
|
```
|
|
7954
8010
|
|
|
7955
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
8011
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%2C%20c%3A%203%7D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3E%202%0A%0Aconst%20result%20%3D%20R.partition(predicate)(obj)%0A%0Aconst%20expected%20%3D%20%5B%7Bc%3A%203%7D%2C%20%20%7Ba%3A%201%2C%20b%3A%202%7D%5D%0A%2F%2F%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.partitionObject</strong> example in Rambda REPL</a>
|
|
7956
8012
|
|
|
7957
8013
|
<details>
|
|
7958
8014
|
|
|
@@ -8096,7 +8152,7 @@ const result = [
|
|
|
8096
8152
|
// => [1, 1, undefined]
|
|
8097
8153
|
```
|
|
8098
8154
|
|
|
8099
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
8155
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20obj%20%3D%20%7Ba%3A%20%7Bb%3A%201%7D%7D%0Aconst%20pathToSearch%20%3D%20'a.b'%0Aconst%20pathToSearchList%20%3D%20%5B'a'%2C%20'b'%5D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.path(pathToSearch%2C%20obj)%2C%0A%20%20R.path(pathToSearchList%2C%20obj)%2C%0A%20%20R.path('a.b.c.d'%2C%20obj)%0A%5D%0A%2F%2F%20%3D%3E%20%5B1%2C%201%2C%20undefined%5D">Try this <strong>R.path</strong> example in Rambda REPL</a>
|
|
8100
8156
|
|
|
8101
8157
|
<details>
|
|
8102
8158
|
|
|
@@ -8252,7 +8308,7 @@ const result = R.pathSatisfies(
|
|
|
8252
8308
|
// => true
|
|
8253
8309
|
```
|
|
8254
8310
|
|
|
8255
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
8311
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.pathSatisfies(%0A%20%20x%20%3D%3E%20x%20%3E%200%2C%0A%20%20%5B'a'%2C%20'b'%2C%20'c'%5D%2C%0A%20%20%7Ba%3A%20%7Bb%3A%20%7Bc%3A%201%7D%7D%7D%0A)%0A%2F%2F%20%3D%3E%20true">Try this <strong>R.pathSatisfies</strong> example in Rambda REPL</a>
|
|
8256
8312
|
|
|
8257
8313
|
<details>
|
|
8258
8314
|
|
|
@@ -8372,7 +8428,7 @@ const result = R.permutations(
|
|
|
8372
8428
|
// => [[1, 2], [2, 1]]
|
|
8373
8429
|
```
|
|
8374
8430
|
|
|
8375
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
8431
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.permutations(%0A%09%5B1%2C%202%5D%0A)%0A%2F%2F%20%3D%3E%20%5B%5B1%2C%202%5D%2C%20%5B2%2C%201%5D%5D">Try this <strong>R.permutations</strong> example in Rambda REPL</a>
|
|
8376
8432
|
|
|
8377
8433
|
<details>
|
|
8378
8434
|
|
|
@@ -8475,7 +8531,7 @@ const expected = [
|
|
|
8475
8531
|
// => `result` is equal to `expected`
|
|
8476
8532
|
```
|
|
8477
8533
|
|
|
8478
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
8534
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20obj%20%3D%20%7B%0A%20%20a%20%3A%201%2C%0A%20%20b%20%3A%20false%2C%0A%20%20foo%3A%20'cherry'%0A%7D%0Aconst%20propsToPick%20%3D%20'a%2Cfoo'%0Aconst%20propsToPickList%20%3D%20%5B'a'%2C%20'foo'%5D%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.pick(propsToPick)(obj)%2C%0A%20%20R.pick(propsToPickList)(obj)%2C%0A%20%20R.pick('a%2Cbar')(obj)%2C%0A%20%20R.pick('bar')(obj)%2C%0A%5D%0A%0Aconst%20expected%20%3D%20%5B%0A%20%20%7Ba%3A1%2C%20foo%3A%20'cherry'%7D%2C%0A%20%20%7Ba%3A1%2C%20foo%3A%20'cherry'%7D%2C%0A%20%20%7Ba%3A1%7D%2C%0A%20%20%7B%7D%2C%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.pick</strong> example in Rambda REPL</a>
|
|
8479
8535
|
|
|
8480
8536
|
<details>
|
|
8481
8537
|
|
|
@@ -8614,7 +8670,7 @@ const result = R.pipe(
|
|
|
8614
8670
|
// => [20, 30]
|
|
8615
8671
|
```
|
|
8616
8672
|
|
|
8617
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
8673
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.pipe(%0A%20%20%5B1%2C%202%2C%203%5D%2C%0A%20%20R.filter(x%20%3D%3E%20x%20%3E%201)%2C%0A%20%20R.map(x%20%3D%3E%20x*10)%2C%0A)%0A%2F%2F%20%3D%3E%20%5B20%2C%2030%5D">Try this <strong>R.pipe</strong> example in Rambda REPL</a>
|
|
8618
8674
|
|
|
8619
8675
|
<details>
|
|
8620
8676
|
|
|
@@ -8967,7 +9023,7 @@ const result = await R.pipeAsync(
|
|
|
8967
9023
|
// `result` resolves to `RAMBDAX_DELAY104`
|
|
8968
9024
|
```
|
|
8969
9025
|
|
|
8970
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
9026
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20await%20R.pipeAsync(%0A%20%20100%2C%0A%20%20async%20x%20%3D%3E%20%7B%0A%20%20%20%20await%20R.delay(100)%0A%20%20%20%20return%20x%20%2B%202%0A%20%20%7D%2C%0A%20%20x%20%3D%3E%20x%20%2B2%2C%0A%20%20async%20x%20%3D%3E%20%7B%0A%20%20%20%20const%20delayed%20%3D%20await%20R.delay(100)%0A%20%20%20%20return%20delayed%20%2B%20x%0A%20%20%7D%0A)%0A%2F%2F%20%60result%60%20resolves%20to%20%60RAMBDAX_DELAY104%60">Try this <strong>R.pipeAsync</strong> example in Rambda REPL</a>
|
|
8971
9027
|
|
|
8972
9028
|
<details>
|
|
8973
9029
|
|
|
@@ -9083,7 +9139,7 @@ const result = R.pluck(property)(list)
|
|
|
9083
9139
|
// => [1, 2]
|
|
9084
9140
|
```
|
|
9085
9141
|
|
|
9086
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
9142
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%7Ba%3A%201%7D%2C%20%7Ba%3A%202%7D%2C%20%7Bb%3A%203%7D%5D%0Aconst%20property%20%3D%20'a'%0A%0Aconst%20result%20%3D%20R.pluck(property)(list)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%5D">Try this <strong>R.pluck</strong> example in Rambda REPL</a>
|
|
9087
9143
|
|
|
9088
9144
|
<details>
|
|
9089
9145
|
|
|
@@ -9189,7 +9245,7 @@ const result = R.prepend('foo', ['bar', 'baz'])
|
|
|
9189
9245
|
// => ['foo', 'bar', 'baz']
|
|
9190
9246
|
```
|
|
9191
9247
|
|
|
9192
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
9248
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.prepend('foo'%2C%20%5B'bar'%2C%20'baz'%5D)%0A%2F%2F%20%3D%3E%20%5B'foo'%2C%20'bar'%2C%20'baz'%5D">Try this <strong>R.prepend</strong> example in Rambda REPL</a>
|
|
9193
9249
|
|
|
9194
9250
|
<details>
|
|
9195
9251
|
|
|
@@ -9253,7 +9309,7 @@ const result = [
|
|
|
9253
9309
|
// => [100, undefined]
|
|
9254
9310
|
```
|
|
9255
9311
|
|
|
9256
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
9312
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20%5B%0A%20%20R.prop('x')(%7Bx%3A%20100%7D)%2C%0A%20%20R.prop('x')(%7Ba%3A%201%7D)%0A%5D%0A%2F%2F%20%3D%3E%20%5B100%2C%20undefined%5D">Try this <strong>R.prop</strong> example in Rambda REPL</a>
|
|
9257
9313
|
|
|
9258
9314
|
<details>
|
|
9259
9315
|
|
|
@@ -9327,7 +9383,7 @@ const result = [
|
|
|
9327
9383
|
// => [true, false]
|
|
9328
9384
|
```
|
|
9329
9385
|
|
|
9330
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
9386
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20obj%20%3D%20%7B%20foo%3A%20'bar'%20%7D%0Aconst%20secondObj%20%3D%20%7B%20foo%3A%201%20%7D%0A%0Aconst%20propToFind%20%3D%20'foo'%0Aconst%20valueToMatch%20%3D%20'bar'%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.propEq(propToFind%2C%20valueToMatch)(obj)%2C%0A%20%20R.propEq(propToFind%2C%20valueToMatch)(secondObj)%0A%5D%0A%2F%2F%20%3D%3E%20%5Btrue%2C%20false%5D">Try this <strong>R.propEq</strong> example in Rambda REPL</a>
|
|
9331
9387
|
|
|
9332
9388
|
<details>
|
|
9333
9389
|
|
|
@@ -9413,7 +9469,7 @@ const result = [
|
|
|
9413
9469
|
// => [1, 'DEFAULT_VALUE']
|
|
9414
9470
|
```
|
|
9415
9471
|
|
|
9416
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
9472
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20obj%20%3D%20%7Ba%3A%201%7D%0Aconst%20defaultValue%20%3D%20'DEFAULT_VALUE'%0Aconst%20property%20%3D%20'a'%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.propOr(defaultValue%2C%20property)(obj)%2C%0A%20%20R.propOr(defaultValue%2C%20'foo')(obj)%0A%5D%0A%2F%2F%20%3D%3E%20%5B1%2C%20'DEFAULT_VALUE'%5D">Try this <strong>R.propOr</strong> example in Rambda REPL</a>
|
|
9417
9473
|
|
|
9418
9474
|
<details>
|
|
9419
9475
|
|
|
@@ -9501,7 +9557,7 @@ const result = R.propSatisfies(predicate, property, obj)
|
|
|
9501
9557
|
// => true
|
|
9502
9558
|
```
|
|
9503
9559
|
|
|
9504
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
9560
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20obj%20%3D%20%7Ba%3A%20%7Bb%3A1%7D%7D%0Aconst%20property%20%3D%20'a'%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%3F.b%20%3D%3D%3D%201%0A%0Aconst%20result%20%3D%20R.propSatisfies(predicate%2C%20property%2C%20obj)%0A%2F%2F%20%3D%3E%20true">Try this <strong>R.propSatisfies</strong> example in Rambda REPL</a>
|
|
9505
9561
|
|
|
9506
9562
|
<details>
|
|
9507
9563
|
|
|
@@ -9588,7 +9644,7 @@ If `start` is greater than `end`, then the result will be in descending order.
|
|
|
9588
9644
|
// => [[0, 1, 2, 3, 4], [5, 4, 3, 2, 1]]
|
|
9589
9645
|
```
|
|
9590
9646
|
|
|
9591
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
9647
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20%5BR.range(0)(5)%2C%20R.range(5)(0)%5D%0A%2F%2F%20%3D%3E%20%5B%5B0%2C%201%2C%202%2C%203%2C%204%5D%2C%20%5B5%2C%204%2C%203%2C%202%2C%201%5D%5D">Try this <strong>R.range</strong> example in Rambda REPL</a>
|
|
9592
9648
|
|
|
9593
9649
|
<details>
|
|
9594
9650
|
|
|
@@ -9695,7 +9751,7 @@ const result = R.reduce(reducer, initialValue, list)
|
|
|
9695
9751
|
// => 60
|
|
9696
9752
|
```
|
|
9697
9753
|
|
|
9698
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
9754
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B1%2C%202%2C%203%5D%0Aconst%20initialValue%20%3D%2010%0Aconst%20reducer%20%3D%20(prev%2C%20current)%20%3D%3E%20prev%20*%20current%0A%0Aconst%20result%20%3D%20R.reduce(reducer%2C%20initialValue%2C%20list)%0A%2F%2F%20%3D%3E%2060">Try this <strong>R.reduce</strong> example in Rambda REPL</a>
|
|
9699
9755
|
|
|
9700
9756
|
<details>
|
|
9701
9757
|
|
|
@@ -9816,7 +9872,7 @@ const result = [
|
|
|
9816
9872
|
// => [[1], {a: 1}]
|
|
9817
9873
|
```
|
|
9818
9874
|
|
|
9819
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
9875
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B1%2C%202%2C%203%2C%204%5D%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3E%201%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.reject(predicate)(list)%2C%0A%20%20R.reject(predicate)(obj)%0A%5D%0A%2F%2F%20%3D%3E%20%5B%5B1%5D%2C%20%7Ba%3A%201%7D%5D">Try this <strong>R.reject</strong> example in Rambda REPL</a>
|
|
9820
9876
|
|
|
9821
9877
|
<details>
|
|
9822
9878
|
|
|
@@ -9969,7 +10025,7 @@ const result = R.rejectObject(
|
|
|
9969
10025
|
// => {b: 2}
|
|
9970
10026
|
```
|
|
9971
10027
|
|
|
9972
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
10028
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.rejectObject(%0A%09(val%2C%20prop)%20%3D%3E%20prop%20%3D%3D%3D%20'a'%20%7C%7C%20val%20%3E%201%0A)(%7Ba%3A%201%2C%20b%3A%202%2C%20c%3A3%7D)%0A%2F%2F%20%3D%3E%20%7Bb%3A%202%7D">Try this <strong>R.rejectObject</strong> example in Rambda REPL</a>
|
|
9973
10029
|
|
|
9974
10030
|
<details>
|
|
9975
10031
|
|
|
@@ -10075,7 +10131,7 @@ const result = [
|
|
|
10075
10131
|
// => ['f|1|o', 'f|1||1|']
|
|
10076
10132
|
```
|
|
10077
10133
|
|
|
10078
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
10134
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20%5B%0A%09R.replace('o'%2C%20'%7C1%7C')('foo')%2C%0A%09R.replace(%2Fo%2Fg%2C%20'%7C1%7C')('foo')%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5B'f%7C1%7Co'%2C%20'f%7C1%7C%7C1%7C'%5D">Try this <strong>R.replace</strong> example in Rambda REPL</a>
|
|
10079
10135
|
|
|
10080
10136
|
<details>
|
|
10081
10137
|
|
|
@@ -10158,7 +10214,7 @@ const result = [
|
|
|
10158
10214
|
// => 'f|1||1|'
|
|
10159
10215
|
```
|
|
10160
10216
|
|
|
10161
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
10217
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20%5B%0A%09R.replaceAll(%5B'o'%2C%20%2Fa%2Fg%5D%2C%20'%7C1%7C')('foa')%2C%0A%5D%0A%2F%2F%20%3D%3E%20'f%7C1%7C%7C1%7C'">Try this <strong>R.replaceAll</strong> example in Rambda REPL</a>
|
|
10162
10218
|
|
|
10163
10219
|
<details>
|
|
10164
10220
|
|
|
@@ -10250,7 +10306,7 @@ const result = R.shuffle(
|
|
|
10250
10306
|
// => [3, 1, 2] or [2, 3, 1] or ...
|
|
10251
10307
|
```
|
|
10252
10308
|
|
|
10253
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
10309
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.shuffle(%0A%09%5B1%2C%202%2C%203%5D%0A)%0A%2F%2F%20%3D%3E%20%5B3%2C%201%2C%202%5D%20or%20%5B2%2C%203%2C%201%5D%20or%20...">Try this <strong>R.shuffle</strong> example in Rambda REPL</a>
|
|
10254
10310
|
|
|
10255
10311
|
<details>
|
|
10256
10312
|
|
|
@@ -10335,7 +10391,7 @@ const expected = [
|
|
|
10335
10391
|
// => `result` is equal to `expected`
|
|
10336
10392
|
```
|
|
10337
10393
|
|
|
10338
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
10394
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%0A%20%20%7Ba%3A%202%7D%2C%0A%20%20%7Ba%3A%203%7D%2C%0A%20%20%7Ba%3A%201%7D%0A%5D%0Aconst%20sortFn%20%3D%20(x%2C%20y)%20%3D%3E%20%7B%0A%20%20return%20x.a%20%3E%20y.a%20%3F%201%20%3A%20-1%0A%7D%0A%0Aconst%20result%20%3D%20R.sort(sortFn%2C%20list)%0Aconst%20expected%20%3D%20%5B%0A%20%20%7Ba%3A%201%7D%2C%0A%20%20%7Ba%3A%202%7D%2C%0A%20%20%7Ba%3A%203%7D%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.sort</strong> example in Rambda REPL</a>
|
|
10339
10395
|
|
|
10340
10396
|
<details>
|
|
10341
10397
|
|
|
@@ -10442,7 +10498,7 @@ const expected = [
|
|
|
10442
10498
|
// => `result` is equal to `expected`
|
|
10443
10499
|
```
|
|
10444
10500
|
|
|
10445
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
10501
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%0A%20%20%7Ba%3A%202%7D%2C%0A%20%20%7Ba%3A%203%7D%2C%0A%20%20%7Ba%3A%201%7D%0A%5D%0Aconst%20sortFn%20%3D%20x%20%3D%3E%20x.a%0A%0Aconst%20result%20%3D%20R.sortBy(sortFn)(list)%0Aconst%20expected%20%3D%20%5B%0A%20%20%7Ba%3A%201%7D%2C%0A%20%20%7Ba%3A%202%7D%2C%0A%20%20%7Ba%3A%203%7D%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.sortBy</strong> example in Rambda REPL</a>
|
|
10446
10502
|
|
|
10447
10503
|
<details>
|
|
10448
10504
|
|
|
@@ -10542,7 +10598,7 @@ describe('R.sortBy', () => {
|
|
|
10542
10598
|
|
|
10543
10599
|
```typescript
|
|
10544
10600
|
|
|
10545
|
-
sortByDescending<T>(sortFn: (
|
|
10601
|
+
sortByDescending<T>(sortFn: (x: T) => Ord): (list: T[]) => T[]
|
|
10546
10602
|
```
|
|
10547
10603
|
|
|
10548
10604
|
```javascript
|
|
@@ -10562,14 +10618,14 @@ const expected = [
|
|
|
10562
10618
|
// => `result` is equal to `expected`
|
|
10563
10619
|
```
|
|
10564
10620
|
|
|
10565
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
10621
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%0A%20%20%7Ba%3A%202%7D%2C%0A%20%20%7Ba%3A%203%7D%2C%0A%20%20%7Ba%3A%201%7D%0A%5D%0Aconst%20sortFn%20%3D%20x%20%3D%3E%20x.a%0A%0Aconst%20result%20%3D%20R.sortByDescending(sortFn)(list)%0Aconst%20expected%20%3D%20%5B%0A%20%20%7Ba%3A%203%7D%2C%0A%20%20%7Ba%3A%202%7D%2C%0A%20%20%7Ba%3A%201%7D%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.sortByDescending</strong> example in Rambda REPL</a>
|
|
10566
10622
|
|
|
10567
10623
|
<details>
|
|
10568
10624
|
|
|
10569
10625
|
<summary>All TypeScript definitions</summary>
|
|
10570
10626
|
|
|
10571
10627
|
```typescript
|
|
10572
|
-
sortByDescending<T>(sortFn: (
|
|
10628
|
+
sortByDescending<T>(sortFn: (x: T) => Ord): (list: T[]) => T[];
|
|
10573
10629
|
```
|
|
10574
10630
|
|
|
10575
10631
|
</details>
|
|
@@ -10588,6 +10644,24 @@ export function sortByDescending(sortFn) {
|
|
|
10588
10644
|
|
|
10589
10645
|
</details>
|
|
10590
10646
|
|
|
10647
|
+
<details>
|
|
10648
|
+
|
|
10649
|
+
<summary><strong>Tests</strong></summary>
|
|
10650
|
+
|
|
10651
|
+
```javascript
|
|
10652
|
+
import { sortByDescending } from './sortByDescending.js'
|
|
10653
|
+
import { path } from './path.js'
|
|
10654
|
+
|
|
10655
|
+
const list = [{ a: { b: 3 } }, { a: { b: 1 } }, { a: { b: 2 } }]
|
|
10656
|
+
const sorted = [{ a: { b: 3 } }, { a: { b: 2 } }, { a: { b: 1 } }]
|
|
10657
|
+
|
|
10658
|
+
test('happy', () => {
|
|
10659
|
+
expect(sortByDescending(path('a.b'))(list)).toEqual(sorted)
|
|
10660
|
+
})
|
|
10661
|
+
```
|
|
10662
|
+
|
|
10663
|
+
</details>
|
|
10664
|
+
|
|
10591
10665
|
[](#sortByDescending)
|
|
10592
10666
|
|
|
10593
10667
|
### sortByPath
|
|
@@ -10616,7 +10690,7 @@ const expected = [
|
|
|
10616
10690
|
// => `result` is equal to `expected`
|
|
10617
10691
|
```
|
|
10618
10692
|
|
|
10619
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
10693
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%0A%09%7Ba%3A%20%7Bb%3A%202%7D%2C%20id%3A1%7D%2C%0A%09%7Ba%3A%20%7Bb%3A%201%7D%2C%20id%3A2%7D%2C%0A%09%7Ba%3A%20%7Bb%3A%203%7D%2C%20id%3A3%7D%2C%0A%5D%0Aconst%20result%20%3D%20R.sortByPath('a.b')(list)%0Aconst%20expected%20%3D%20%5B%0A%09%7Ba%3A%20%7Bb%3A%201%7D%2C%20id%3A2%7D%2C%0A%09%7Ba%3A%20%7Bb%3A%202%7D%2C%20id%3A1%7D%2C%0A%09%7Ba%3A%20%7Bb%3A%203%7D%2C%20id%3A3%7D%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.sortByPath</strong> example in Rambda REPL</a>
|
|
10620
10694
|
|
|
10621
10695
|
<details>
|
|
10622
10696
|
|
|
@@ -10737,7 +10811,7 @@ const expected = [
|
|
|
10737
10811
|
// => `result` is equal to `expected`
|
|
10738
10812
|
```
|
|
10739
10813
|
|
|
10740
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
10814
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%0A%09%7Ba%3A%20%7Bb%3A%202%7D%2C%20id%3A1%7D%2C%0A%09%7Ba%3A%20%7Bb%3A%201%7D%2C%20id%3A2%7D%2C%0A%09%7Ba%3A%20%7Bb%3A%203%7D%2C%20id%3A3%7D%2C%0A%5D%0Aconst%20result%20%3D%20R.sortByPathDescending('a.b')(list)%0Aconst%20expected%20%3D%20%5B%0A%09%7Ba%3A%20%7Bb%3A%203%7D%2C%20id%3A3%7D%0A%09%7Ba%3A%20%7Bb%3A%202%7D%2C%20id%3A1%7D%2C%0A%09%7Ba%3A%20%7Bb%3A%201%7D%2C%20id%3A2%7D%2C%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.sortByPathDescending</strong> example in Rambda REPL</a>
|
|
10741
10815
|
|
|
10742
10816
|
<details>
|
|
10743
10817
|
|
|
@@ -10816,7 +10890,7 @@ const result = R.sortObject(predicate)({a:1, b: 4, c: 2})
|
|
|
10816
10890
|
// => {b: 4, c: 2, a: 1}
|
|
10817
10891
|
```
|
|
10818
10892
|
|
|
10819
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
10893
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20predicate%20%3D%20(propA%2C%20propB%2C%20valueA%2C%20valueB)%20%3D%3E%20valueA%20%3E%20valueB%20%3F%20-1%20%3A%201%0A%0Aconst%20result%20%3D%20R.sortObject(predicate)(%7Ba%3A1%2C%20b%3A%204%2C%20c%3A%202%7D)%0A%2F%2F%20%3D%3E%20%7Bb%3A%204%2C%20c%3A%202%2C%20a%3A%201%7D">Try this <strong>R.sortObject</strong> example in Rambda REPL</a>
|
|
10820
10894
|
|
|
10821
10895
|
<details>
|
|
10822
10896
|
|
|
@@ -10963,7 +11037,7 @@ const expected = [
|
|
|
10963
11037
|
// => `result` is equal to `expected`
|
|
10964
11038
|
```
|
|
10965
11039
|
|
|
10966
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
11040
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.sortWith(%5B%0A%20%20%20%20(a%2C%20b)%20%3D%3E%20a.a%20%3D%3D%3D%20b.a%20%3F%200%20%3A%20a.a%20%3E%20b.a%20%3F%201%20%3A%20-1%2C%0A%20%20%20%20(a%2C%20b)%20%3D%3E%20a.b%20%3D%3D%3D%20b.b%20%3F%200%20%3A%20a.b%20%3E%20b.b%20%3F%201%20%3A%20-1%2C%0A%5D)(%5B%0A%20%20%7Ba%3A%201%2C%20b%3A%202%7D%2C%0A%20%20%7Ba%3A%202%2C%20b%3A%201%7D%2C%0A%20%20%7Ba%3A%202%2C%20b%3A%202%7D%2C%0A%20%20%7Ba%3A%201%2C%20b%3A%201%7D%2C%0A%5D)%0Aconst%20expected%20%3D%20%5B%0A%20%20%7Ba%3A%201%2C%20b%3A%201%7D%2C%0A%20%20%7Ba%3A%201%2C%20b%3A%202%7D%2C%0A%20%20%7Ba%3A%202%2C%20b%3A%201%7D%2C%0A%20%20%7Ba%3A%202%2C%20b%3A%202%7D%2C%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.sortWith</strong> example in Rambda REPL</a>
|
|
10967
11041
|
|
|
10968
11042
|
<details>
|
|
10969
11043
|
|
|
@@ -11188,7 +11262,7 @@ const expected = [
|
|
|
11188
11262
|
// => `result` is equal to `expected`
|
|
11189
11263
|
```
|
|
11190
11264
|
|
|
11191
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
11265
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20%5B%0A%20%20R.splitEvery(2)(%5B1%2C%202%2C%203%5D)%2C%0A%20%20R.splitEvery(3)('foobar')%0A%5D%0A%0Aconst%20expected%20%3D%20%5B%0A%20%20%5B%5B1%2C%202%5D%2C%20%5B3%5D%5D%2C%0A%20%20%5B'foo'%2C%20'bar'%5D%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.splitEvery</strong> example in Rambda REPL</a>
|
|
11192
11266
|
|
|
11193
11267
|
<details>
|
|
11194
11268
|
|
|
@@ -11279,7 +11353,7 @@ const result = R.symmetricDifference(x)(y)
|
|
|
11279
11353
|
// => [ 1, 2, 5, 6 ]
|
|
11280
11354
|
```
|
|
11281
11355
|
|
|
11282
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
11356
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20x%20%3D%20%5B%201%2C%202%2C%203%2C%204%20%5D%0Aconst%20y%20%3D%20%5B%203%2C%204%2C%205%2C%206%20%5D%0A%0Aconst%20result%20%3D%20R.symmetricDifference(x)(y)%0A%2F%2F%20%3D%3E%20%5B%201%2C%202%2C%205%2C%206%20%5D">Try this <strong>R.symmetricDifference</strong> example in Rambda REPL</a>
|
|
11283
11357
|
|
|
11284
11358
|
<details>
|
|
11285
11359
|
|
|
@@ -11376,7 +11450,7 @@ const result = [
|
|
|
11376
11450
|
// => [[2, 3], 'oo']
|
|
11377
11451
|
```
|
|
11378
11452
|
|
|
11379
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
11453
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20%5B%0A%20%20R.tail(%5B1%2C%202%2C%203%5D)%2C%0A%20%20R.tail('foo')%0A%5D%0A%2F%2F%20%3D%3E%20%5B%5B2%2C%203%5D%2C%20'oo'%5D">Try this <strong>R.tail</strong> example in Rambda REPL</a>
|
|
11380
11454
|
|
|
11381
11455
|
<details>
|
|
11382
11456
|
|
|
@@ -11475,7 +11549,7 @@ const result = [
|
|
|
11475
11549
|
// => [[1, 2], 'fo']
|
|
11476
11550
|
```
|
|
11477
11551
|
|
|
11478
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
11552
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20howMany%20%3D%202%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.take(howMany)(%5B1%2C%202%2C%203%5D)%2C%0A%20%20R.take(howMany%2C%20'foobar')%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5B%5B1%2C%202%5D%2C%20'fo'%5D">Try this <strong>R.take</strong> example in Rambda REPL</a>
|
|
11479
11553
|
|
|
11480
11554
|
<details>
|
|
11481
11555
|
|
|
@@ -11568,7 +11642,7 @@ const result = [
|
|
|
11568
11642
|
// => [[2, 3], 'ar']
|
|
11569
11643
|
```
|
|
11570
11644
|
|
|
11571
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
11645
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20howMany%20%3D%202%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.takeLast(howMany)(%5B1%2C%202%2C%203%5D)%2C%0A%20%20R.takeLast(howMany)('foobar')%2C%0A%5D%0A%2F%2F%20%3D%3E%20%5B%5B2%2C%203%5D%2C%20'ar'%5D">Try this <strong>R.takeLast</strong> example in Rambda REPL</a>
|
|
11572
11646
|
|
|
11573
11647
|
<details>
|
|
11574
11648
|
|
|
@@ -11656,7 +11730,7 @@ const result = R.takeLastWhile(x => x > 2)([1, 2, 3, 4])
|
|
|
11656
11730
|
// => [3, 4]
|
|
11657
11731
|
```
|
|
11658
11732
|
|
|
11659
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
11733
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.takeLastWhile(x%20%3D%3E%20x%20%3E%202)(%5B1%2C%202%2C%203%2C%204%5D)%0A%2F%2F%20%3D%3E%20%5B3%2C%204%5D">Try this <strong>R.takeLastWhile</strong> example in Rambda REPL</a>
|
|
11660
11734
|
|
|
11661
11735
|
<details>
|
|
11662
11736
|
|
|
@@ -11745,7 +11819,7 @@ const result = R.takeWhile(predicate)(list)
|
|
|
11745
11819
|
// => [1, 2]
|
|
11746
11820
|
```
|
|
11747
11821
|
|
|
11748
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
11822
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B1%2C%202%2C%203%2C%204%5D%0Aconst%20predicate%20%3D%20x%20%3D%3E%20x%20%3C%203%0A%0Aconst%20result%20%3D%20R.takeWhile(predicate)(list)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%5D">Try this <strong>R.takeWhile</strong> example in Rambda REPL</a>
|
|
11749
11823
|
|
|
11750
11824
|
<details>
|
|
11751
11825
|
|
|
@@ -11855,7 +11929,7 @@ const result = R.pipe(
|
|
|
11855
11929
|
// => `2` and `3` will be logged
|
|
11856
11930
|
```
|
|
11857
11931
|
|
|
11858
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
11932
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B1%2C%202%2C%203%5D%0A%0Aconst%20result%20%3D%20R.pipe(%0A%09list%2C%0A%20%20R.filter(x%20%3D%3E%20x%20%3E%201)%2C%0A%20%20R.tap(console.log)%2C%0A%20%20R.map(x%20%3D%3E%20x%20*%202)%0A)%0A%2F%2F%20%3D%3E%20%602%60%20and%20%603%60%20will%20be%20logged">Try this <strong>R.tap</strong> example in Rambda REPL</a>
|
|
11859
11933
|
|
|
11860
11934
|
<details>
|
|
11861
11935
|
|
|
@@ -11899,7 +11973,7 @@ R.test(/^f/)('foo')
|
|
|
11899
11973
|
// => true
|
|
11900
11974
|
```
|
|
11901
11975
|
|
|
11902
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
11976
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.test(%2F%5Ef%2F)('foo')%0A%2F%2F%20%3D%3E%20true">Try this <strong>R.test</strong> example in Rambda REPL</a>
|
|
11903
11977
|
|
|
11904
11978
|
<details>
|
|
11905
11979
|
|
|
@@ -11977,7 +12051,7 @@ const result = R.transformPropObject(fn, 'a')(obj)
|
|
|
11977
12051
|
// => {a: false, b: 2}
|
|
11978
12052
|
```
|
|
11979
12053
|
|
|
11980
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
12054
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20fn%20%3D%20(x)%20%3D%3E%20x%20%3E%202%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20R.transformPropObject(fn%2C%20'a')(obj)%0A%2F%2F%20%3D%3E%20%7Ba%3A%20false%2C%20b%3A%202%7D">Try this <strong>R.transformPropObject</strong> example in Rambda REPL</a>
|
|
11981
12055
|
|
|
11982
12056
|
<details>
|
|
11983
12057
|
|
|
@@ -12038,7 +12112,7 @@ const result = [
|
|
|
12038
12112
|
// => [false, 'bar']
|
|
12039
12113
|
```
|
|
12040
12114
|
|
|
12041
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
12115
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20fn%20%3D%20x%20%3D%3E%20x.foo%0A%0Aconst%20result%20%3D%20%5B%0A%20%20R.tryCatch(fn%2C%20false)(null)%2C%0A%20%20R.tryCatch(fn%2C%20false)(%7Bfoo%3A%20'bar'%7D)%0A%5D%0A%2F%2F%20%3D%3E%20%5Bfalse%2C%20'bar'%5D">Try this <strong>R.tryCatch</strong> example in Rambda REPL</a>
|
|
12042
12116
|
|
|
12043
12117
|
<details>
|
|
12044
12118
|
|
|
@@ -12169,7 +12243,7 @@ const delay = ms => new Promise(resolve => {
|
|
|
12169
12243
|
R.type(delay) // => 'Promise'
|
|
12170
12244
|
```
|
|
12171
12245
|
|
|
12172
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
12246
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.type(()%20%3D%3E%20%7B%7D)%20%2F%2F%20%3D%3E%20'Function'%0AR.type(async%20()%20%3D%3E%20%7B%7D)%20%2F%2F%20%3D%3E%20'Async'%0AR.type(%5B%5D)%20%2F%2F%20%3D%3E%20'Array'%0AR.type(%7B%7D)%20%2F%2F%20%3D%3E%20'Object'%0AR.type('foo')%20%2F%2F%20%3D%3E%20'String'%0AR.type(1)%20%2F%2F%20%3D%3E%20'Number'%0AR.type(true)%20%2F%2F%20%3D%3E%20'Boolean'%0AR.type(null)%20%2F%2F%20%3D%3E%20'Null'%0AR.type(%2F%5BA-z%5D%2F)%20%2F%2F%20%3D%3E%20'RegExp'%0AR.type('foo'*1)%20%2F%2F%20%3D%3E%20'NaN'%0A%0Aconst%20delay%20%3D%20ms%20%3D%3E%20new%20Promise(resolve%20%3D%3E%20%7B%0A%20%20setTimeout(function%20()%20%7B%0A%20%20%20%20resolve()%0A%20%20%7D%2C%20ms)%0A%7D)%0AR.type(delay)%20%2F%2F%20%3D%3E%20'Promise'">Try this <strong>R.type</strong> example in Rambda REPL</a>
|
|
12173
12247
|
|
|
12174
12248
|
<details>
|
|
12175
12249
|
|
|
@@ -12419,7 +12493,7 @@ const result = R.union([1,2,3])([3,4,5]);
|
|
|
12419
12493
|
// => [1, 2, 3, 4, 5]
|
|
12420
12494
|
```
|
|
12421
12495
|
|
|
12422
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
12496
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20result%20%3D%20R.union(%5B1%2C2%2C3%5D)(%5B3%2C4%2C5%5D)%3B%0A%2F%2F%20%3D%3E%20%5B1%2C%202%2C%203%2C%204%2C%205%5D">Try this <strong>R.union</strong> example in Rambda REPL</a>
|
|
12423
12497
|
|
|
12424
12498
|
<details>
|
|
12425
12499
|
|
|
@@ -12528,7 +12602,7 @@ R.uniq(list)
|
|
|
12528
12602
|
// => [1, {a: 1}, {a: 2}]
|
|
12529
12603
|
```
|
|
12530
12604
|
|
|
12531
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
12605
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B1%2C%201%2C%20%7Ba%3A%201%7D%2C%20%7Ba%3A%202%7D%2C%20%7Ba%3A1%7D%5D%0A%0Aconst%20result%20%3D%20R.uniq(list)%0A%2F%2F%20%3D%3E%20%5B1%2C%20%7Ba%3A%201%7D%2C%20%7Ba%3A%202%7D%5D">Try this <strong>R.uniq</strong> example in Rambda REPL</a>
|
|
12532
12606
|
|
|
12533
12607
|
<details>
|
|
12534
12608
|
|
|
@@ -12635,7 +12709,7 @@ const result = R.uniqBy(x => x)(list)
|
|
|
12635
12709
|
// => [{a:1}, {a:2}]
|
|
12636
12710
|
```
|
|
12637
12711
|
|
|
12638
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
12712
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%7Ba%3A1%7D%2C%20%7Ba%3A2%7D%2C%20%7Ba%3A1%7D%5D%0Aconst%20result%20%3D%20R.uniqBy(x%20%3D%3E%20x)(list)%0A%0A%2F%2F%20%3D%3E%20%5B%7Ba%3A1%7D%2C%20%7Ba%3A2%7D%5D">Try this <strong>R.uniqBy</strong> example in Rambda REPL</a>
|
|
12639
12713
|
|
|
12640
12714
|
<details>
|
|
12641
12715
|
|
|
@@ -12741,7 +12815,7 @@ const result = R.uniqWith(predicate)(list)
|
|
|
12741
12815
|
// => `result` is equal to `expected`
|
|
12742
12816
|
```
|
|
12743
12817
|
|
|
12744
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
12818
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list%20%3D%20%5B%0A%20%20%7Bid%3A%200%2C%20title%3A'foo'%7D%2C%0A%20%20%7Bid%3A%201%2C%20title%3A'bar'%7D%2C%0A%20%20%7Bid%3A%202%2C%20title%3A'baz'%7D%2C%0A%20%20%7Bid%3A%203%2C%20title%3A'foo'%7D%2C%0A%20%20%7Bid%3A%204%2C%20title%3A'bar'%7D%2C%0A%5D%0A%0Aconst%20expected%20%3D%20%5B%0A%20%20%7Bid%3A%200%2C%20title%3A'foo'%7D%2C%0A%20%20%7Bid%3A%201%2C%20title%3A'bar'%7D%2C%0A%20%20%7Bid%3A%202%2C%20title%3A'baz'%7D%2C%0A%5D%0A%0Aconst%20predicate%20%3D%20(x%2Cy)%20%3D%3E%20x.title%20%3D%3D%3D%20y.title%0A%0Aconst%20result%20%3D%20R.uniqWith(predicate)(list)%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.uniqWith</strong> example in Rambda REPL</a>
|
|
12745
12819
|
|
|
12746
12820
|
<details>
|
|
12747
12821
|
|
|
@@ -12892,7 +12966,7 @@ const result = [
|
|
|
12892
12966
|
// => [11, 5]
|
|
12893
12967
|
```
|
|
12894
12968
|
|
|
12895
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
12969
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20fn%20%3D%20R.unless(%0A%20%20x%20%3D%3E%20x%20%3E%202%2C%0A%20%20x%20%3D%3E%20x%20%2B%2010%0A)%0A%0Aconst%20result%20%3D%20%5B%0A%20%20fn(1)%2C%0A%20%20fn(5)%0A%5D%0A%2F%2F%20%3D%3E%20%5B11%2C%205%5D">Try this <strong>R.unless</strong> example in Rambda REPL</a>
|
|
12896
12970
|
|
|
12897
12971
|
<details>
|
|
12898
12972
|
|
|
@@ -13007,7 +13081,7 @@ const expected = [{a:1, b:2}, {a:1, b:3}]
|
|
|
13007
13081
|
// => `result` is equal to `expected`
|
|
13008
13082
|
```
|
|
13009
13083
|
|
|
13010
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
13084
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20obj%20%3D%20%7B%0A%20%20a%3A%201%2C%0A%20%20b%3A%20%5B2%2C%203%5D%2C%0A%7D%0Aconst%20result%20%3D%20R.unwind('b')(obj)%0Aconst%20expected%20%3D%20%5B%7Ba%3A1%2C%20b%3A2%7D%2C%20%7Ba%3A1%2C%20b%3A3%7D%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.unwind</strong> example in Rambda REPL</a>
|
|
13011
13085
|
|
|
13012
13086
|
<details>
|
|
13013
13087
|
|
|
@@ -13116,7 +13190,7 @@ const result = R.update(index, newValue)(list)
|
|
|
13116
13190
|
// => [1, 2, 88, 4, 5]
|
|
13117
13191
|
```
|
|
13118
13192
|
|
|
13119
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
13193
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20index%20%3D%202%0Aconst%20newValue%20%3D%2088%0Aconst%20list%20%3D%20%5B1%2C%202%2C%203%2C%204%2C%205%5D%0A%0Aconst%20result%20%3D%20R.update(index%2C%20newValue)(list)%0A%2F%2F%20%3D%3E%20%5B1%2C%202%2C%2088%2C%204%2C%205%5D">Try this <strong>R.update</strong> example in Rambda REPL</a>
|
|
13120
13194
|
|
|
13121
13195
|
<details>
|
|
13122
13196
|
|
|
@@ -13217,7 +13291,7 @@ const expected = [
|
|
|
13217
13291
|
// => `result` is equal to `expected`
|
|
13218
13292
|
```
|
|
13219
13293
|
|
|
13220
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
13294
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20predicate%20%3D%20x%20%3D%3E%20typeof%20x%20%3D%3D%3D%20'number'%0Aconst%20fn%20%3D%20R.when(predicate)(x%20%3D%3E%20x%20%2B%201)%0A%0Aconst%20positiveInput%20%3D%2088%0Aconst%20negativeInput%20%3D%20'foo'%0A%0Aconst%20result%20%3D%20%5B%0A%20%20fn(positiveInput)%2C%0A%20%20fn(negativeInput)%2C%0A%5D%0A%0Aconst%20expected%20%3D%20%5B%0A%20%2089%2C%0A%20%20'foo1'%2C%0A%5D%0A%2F%2F%20%3D%3E%20%60result%60%20is%20equal%20to%20%60expected%60">Try this <strong>R.when</strong> example in Rambda REPL</a>
|
|
13221
13295
|
|
|
13222
13296
|
<details>
|
|
13223
13297
|
|
|
@@ -13335,7 +13409,7 @@ R.zip([...x, 3])(['A', 'B'])
|
|
|
13335
13409
|
// => [[1, 'A'], [2, 'B']]
|
|
13336
13410
|
```
|
|
13337
13411
|
|
|
13338
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
13412
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20x%20%3D%20%5B1%2C%202%5D%0Aconst%20y%20%3D%20%5B'A'%2C%20'B'%5D%0AR.zip(x)(y)%0A%2F%2F%20%3D%3E%20%5B%5B1%2C%20'A'%5D%2C%20%5B2%2C%20'B'%5D%5D%0A%0A%2F%2F%20truncates%20to%20shortest%20list%0Aconst%20result%20%3D%20R.zip(%5B...x%2C%203%5D)(%5B'A'%2C%20'B'%5D)%0A%2F%2F%20%3D%3E%20%5B%5B1%2C%20'A'%5D%2C%20%5B2%2C%20'B'%5D%5D">Try this <strong>R.zip</strong> example in Rambda REPL</a>
|
|
13339
13413
|
|
|
13340
13414
|
<details>
|
|
13341
13415
|
|
|
@@ -13453,7 +13527,7 @@ const result = R.zipWith((x, y) => x + y, list1)(list2)
|
|
|
13453
13527
|
// => [110, 220]
|
|
13454
13528
|
```
|
|
13455
13529
|
|
|
13456
|
-
<a title="redirect to Rambda Repl site" href="https://rambda.
|
|
13530
|
+
<a title="redirect to Rambda Repl site" href="https://rambda.netlify.app?const%20list1%20%3D%20%5B%2010%2C%2020%2C%2030%2C%2040%20%5D%0Aconst%20list2%20%3D%20%5B%20100%2C%20200%20%5D%0A%0Aconst%20result%20%3D%20R.zipWith((x%2C%20y)%20%3D%3E%20x%20%2B%20y%2C%20list1)(list2)%0A%2F%2F%20%3D%3E%20%5B110%2C%20220%5D">Try this <strong>R.zipWith</strong> example in Rambda REPL</a>
|
|
13457
13531
|
|
|
13458
13532
|
<details>
|
|
13459
13533
|
|
|
@@ -13542,6 +13616,14 @@ describe('R.zipWith', () => {
|
|
|
13542
13616
|
|
|
13543
13617
|
## ❯ CHANGELOG
|
|
13544
13618
|
|
|
13619
|
+
10.3.4
|
|
13620
|
+
|
|
13621
|
+
- Fix wrong typing for `R.sortByDescending` - [Issue #797](https://github.com/selfrefactor/rambda/issues/797)
|
|
13622
|
+
|
|
13623
|
+
- Improve `R.mapParallelAsync` typings to allow optional `batchSize` parameter.
|
|
13624
|
+
|
|
13625
|
+
- Change order of inputs in `R.mapPropObject`
|
|
13626
|
+
|
|
13545
13627
|
10.3.3
|
|
13546
13628
|
|
|
13547
13629
|
- Fix wrong typing for `R.reject` - [Issue #779](https://github.com/selfrefactor/rambda/issues/779)
|