rambda 10.0.0-alpha.0 → 10.0.0-beta.3

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.
Files changed (76) hide show
  1. package/CHANGELOG.md +125 -16
  2. package/README.md +8035 -3592
  3. package/dist/{rambda.esm.js → rambda.cjs} +800 -385
  4. package/dist/rambda.js +673 -486
  5. package/dist/rambda.umd.js +701 -388
  6. package/immutable.d.ts +896 -345
  7. package/index.d.ts +896 -345
  8. package/package.json +22 -15
  9. package/rambda.js +23 -2
  10. package/src/addProp.js +3 -0
  11. package/src/addPropToObjects.js +14 -0
  12. package/src/append.js +5 -5
  13. package/src/ascend.js +16 -0
  14. package/src/compact.js +12 -0
  15. package/src/concat.js +1 -1
  16. package/src/count.js +7 -7
  17. package/src/countBy.js +12 -12
  18. package/src/createObjectFromKeys.js +10 -0
  19. package/src/defaultTo.js +2 -6
  20. package/src/descend.js +10 -0
  21. package/src/drop.js +2 -6
  22. package/src/dropLast.js +1 -3
  23. package/src/eqProps.js +1 -2
  24. package/src/equals.js +2 -2
  25. package/src/evolve.js +2 -23
  26. package/src/filter.js +14 -14
  27. package/src/find.js +10 -10
  28. package/src/findIndex.js +9 -9
  29. package/src/findLast.js +8 -8
  30. package/src/findLastIndex.js +8 -8
  31. package/src/findNth.js +16 -0
  32. package/src/flattenObject.js +76 -0
  33. package/src/groupBy.js +14 -13
  34. package/src/includes.js +12 -13
  35. package/src/interpolate.js +29 -0
  36. package/src/intersection.js +1 -1
  37. package/src/intersperse.js +12 -12
  38. package/src/join.js +1 -1
  39. package/src/map.js +13 -9
  40. package/src/mapAsync.js +3 -3
  41. package/src/mapKeys.js +11 -0
  42. package/src/mapObjectAsync.js +9 -9
  43. package/src/mapParallelAsync.js +3 -0
  44. package/src/match.js +5 -5
  45. package/src/{replaceItemAtIndex.js → modifyItemAtIndex.js} +1 -1
  46. package/src/modifyProp.js +20 -0
  47. package/src/objectIncludes.js +12 -0
  48. package/src/partition.js +13 -37
  49. package/src/partitionObject.js +15 -0
  50. package/src/path.js +24 -26
  51. package/src/pathSatisfies.js +5 -0
  52. package/src/permutations.js +40 -0
  53. package/src/pipeAsync.js +7 -6
  54. package/src/pluck.js +9 -9
  55. package/src/prepend.js +1 -1
  56. package/src/propOr.js +1 -1
  57. package/src/propSatisfies.js +1 -3
  58. package/src/range.js +29 -13
  59. package/src/reject.js +1 -1
  60. package/src/rejectObject.js +13 -0
  61. package/src/shuffle.js +13 -0
  62. package/src/sort.js +1 -1
  63. package/src/sortBy.js +20 -9
  64. package/src/sortByDescending.js +5 -0
  65. package/src/sortByPath.js +6 -0
  66. package/src/sortByPathDescending.js +6 -0
  67. package/src/sortObject.js +15 -0
  68. package/src/sortWith.js +8 -8
  69. package/src/split.js +2 -2
  70. package/src/splitEvery.js +11 -11
  71. package/src/takeLastWhile.js +18 -18
  72. package/src/tap.js +4 -4
  73. package/src/test.js +1 -1
  74. package/src/uniqBy.js +4 -4
  75. package/src/uniqWith.js +10 -10
  76. package/src/modifyPath.js +0 -30
package/src/sortWith.js CHANGED
@@ -10,14 +10,14 @@ function sortHelper(a, b, listOfSortingFns) {
10
10
  }
11
11
 
12
12
  export function sortWith(listOfSortingFns) {
13
- return list => {
14
- if (Array.isArray(list) === false) {
15
- return []
16
- }
13
+ return list => {
14
+ if (Array.isArray(list) === false) {
15
+ return []
16
+ }
17
17
 
18
- const clone = list.slice()
19
- clone.sort((a, b) => sortHelper(a, b, listOfSortingFns))
18
+ const clone = list.slice()
19
+ clone.sort((a, b) => sortHelper(a, b, listOfSortingFns))
20
20
 
21
- return clone
22
- }
21
+ return clone
22
+ }
23
23
  }
package/src/split.js CHANGED
@@ -1,3 +1,3 @@
1
- export function split(separator){
2
- return str => str.split(separator)
1
+ export function split(separator) {
2
+ return str => str.split(separator)
3
3
  }
package/src/splitEvery.js CHANGED
@@ -1,16 +1,16 @@
1
1
  export function splitEvery(sliceLength) {
2
- return list => {
3
- if (sliceLength < 1) {
4
- throw new Error('First argument to splitEvery must be a positive integer')
5
- }
2
+ return list => {
3
+ if (sliceLength < 1) {
4
+ throw new Error('First argument to splitEvery must be a positive integer')
5
+ }
6
6
 
7
- const willReturn = []
8
- let counter = 0
7
+ const willReturn = []
8
+ let counter = 0
9
9
 
10
- while (counter < list.length) {
11
- willReturn.push(list.slice(counter, (counter += sliceLength)))
12
- }
10
+ while (counter < list.length) {
11
+ willReturn.push(list.slice(counter, (counter += sliceLength)))
12
+ }
13
13
 
14
- return willReturn
15
- }
14
+ return willReturn
15
+ }
16
16
  }
@@ -1,20 +1,20 @@
1
1
  export function takeLastWhile(predicate) {
2
- return input => {
3
- if (input.length === 0) {
4
- return input
5
- }
6
-
7
- const toReturn = []
8
- let counter = input.length
9
-
10
- while (counter) {
11
- const item = input[--counter]
12
- if (!predicate(item)) {
13
- break
14
- }
15
- toReturn.push(item)
16
- }
17
-
18
- return toReturn.reverse()
19
- }
2
+ return input => {
3
+ if (input.length === 0) {
4
+ return input
5
+ }
6
+
7
+ const toReturn = []
8
+ let counter = input.length
9
+
10
+ while (counter) {
11
+ const item = input[--counter]
12
+ if (!predicate(item)) {
13
+ break
14
+ }
15
+ toReturn.push(item)
16
+ }
17
+
18
+ return toReturn.reverse()
19
+ }
20
20
  }
package/src/tap.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export function tap(fn) {
2
- return x => {
3
- fn(x)
2
+ return x => {
3
+ fn(x)
4
4
 
5
- return x
6
- }
5
+ return x
6
+ }
7
7
  }
package/src/test.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export function test(pattern) {
2
- return str => str.search(pattern) !== -1
2
+ return str => str.search(pattern) !== -1
3
3
  }
package/src/uniqBy.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { _Set } from '../src/_internals/set.js'
2
2
 
3
3
  export function uniqBy(fn) {
4
- return list => {
5
- const set = new _Set()
4
+ return list => {
5
+ const set = new _Set()
6
6
 
7
- return list.filter(item => set.checkUniqueness(fn(item)))
8
- }
7
+ return list.filter(item => set.checkUniqueness(fn(item)))
8
+ }
9
9
  }
package/src/uniqWith.js CHANGED
@@ -14,18 +14,18 @@ function includesWith(predicate, target, list) {
14
14
  }
15
15
 
16
16
  export function uniqWith(predicate) {
17
- return list => {
18
- let index = -1
19
- const willReturn = []
17
+ return list => {
18
+ let index = -1
19
+ const willReturn = []
20
20
 
21
- while (++index < list.length) {
22
- const value = list[index]
21
+ while (++index < list.length) {
22
+ const value = list[index]
23
23
 
24
- if (!includesWith(predicate, value, willReturn)) {
25
- willReturn.push(value)
24
+ if (!includesWith(predicate, value, willReturn)) {
25
+ willReturn.push(value)
26
+ }
26
27
  }
27
- }
28
28
 
29
- return willReturn
30
- }
29
+ return willReturn
30
+ }
31
31
  }
package/src/modifyPath.js DELETED
@@ -1,30 +0,0 @@
1
- import { createPath } from './_internals/createPath.js'
2
- import { path as pathModule } from './path.js'
3
-
4
- function assoc(prop, newValue) {
5
- return obj => Object.assign({}, obj, { [prop]: newValue })
6
- }
7
-
8
- function modifyPathFn(pathInput, fn, obj) {
9
- const path = createPath(pathInput)
10
- if (path.length === 1) {
11
- return {
12
- ...obj,
13
- [path[0]]: fn(obj[path[0]]),
14
- }
15
- }
16
- if (pathModule(path)(obj) === undefined) {
17
- return obj
18
- }
19
-
20
- const val = modifyPathFn(Array.prototype.slice.call(path, 1), fn, obj[path[0]])
21
- if (val === obj[path[0]]) {
22
- return obj
23
- }
24
-
25
- return assoc(path[0], val)(obj)
26
- }
27
-
28
- export function modifyPath(pathInput, fn) {
29
- return obj => modifyPathFn(pathInput, fn, obj)
30
- }