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

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 (64) hide show
  1. package/CHANGELOG.md +124 -16
  2. package/README.md +5526 -1730
  3. package/dist/{rambda.esm.js → rambda.cjs} +663 -355
  4. package/dist/rambda.js +545 -456
  5. package/dist/rambda.umd.js +563 -357
  6. package/immutable.d.ts +321 -343
  7. package/index.d.ts +321 -343
  8. package/package.json +20 -13
  9. package/rambda.js +16 -1
  10. package/src/addProp.js +3 -0
  11. package/src/append.js +5 -5
  12. package/src/ascend.js +16 -0
  13. package/src/compact.js +12 -0
  14. package/src/concat.js +1 -1
  15. package/src/count.js +7 -7
  16. package/src/countBy.js +12 -12
  17. package/src/createObjectFromKeys.js +10 -0
  18. package/src/descend.js +10 -0
  19. package/src/dropLast.js +1 -3
  20. package/src/eqProps.js +1 -2
  21. package/src/equals.js +2 -2
  22. package/src/evolve.js +2 -23
  23. package/src/filter.js +14 -14
  24. package/src/find.js +10 -10
  25. package/src/findIndex.js +9 -9
  26. package/src/findLast.js +8 -8
  27. package/src/findLastIndex.js +8 -8
  28. package/src/findNth.js +16 -0
  29. package/src/groupBy.js +14 -13
  30. package/src/includes.js +12 -13
  31. package/src/interpolate.js +29 -0
  32. package/src/intersection.js +1 -1
  33. package/src/intersperse.js +12 -12
  34. package/src/join.js +1 -1
  35. package/src/mapAsync.js +3 -3
  36. package/src/mapKeys.js +11 -0
  37. package/src/mapObjectAsync.js +9 -9
  38. package/src/mapParallelAsync.js +3 -0
  39. package/src/match.js +5 -5
  40. package/src/modifyProp.js +20 -0
  41. package/src/objectIncludes.js +12 -0
  42. package/src/partition.js +13 -37
  43. package/src/partitionObject.js +15 -0
  44. package/src/permutations.js +40 -0
  45. package/src/pipeAsync.js +7 -6
  46. package/src/pluck.js +9 -9
  47. package/src/prepend.js +1 -1
  48. package/src/propSatisfies.js +1 -3
  49. package/src/range.js +35 -12
  50. package/src/reject.js +1 -1
  51. package/src/rejectObject.js +13 -0
  52. package/src/shuffle.js +13 -0
  53. package/src/sort.js +1 -1
  54. package/src/sortBy.js +12 -10
  55. package/src/sortObject.js +15 -0
  56. package/src/sortWith.js +8 -8
  57. package/src/split.js +2 -2
  58. package/src/splitEvery.js +11 -11
  59. package/src/takeLastWhile.js +18 -18
  60. package/src/tap.js +4 -4
  61. package/src/test.js +1 -1
  62. package/src/uniqBy.js +4 -4
  63. package/src/uniqWith.js +10 -10
  64. package/src/modifyPath.js +0 -30
package/CHANGELOG.md CHANGED
@@ -1,19 +1,106 @@
1
1
  10.0.0
2
2
 
3
- - Optimize many methods to better work in TS context with `R.pipe/R.compose`. The focus was passing objects through the `pipe/compose` chain.
4
-
5
- - Add `R.piped` method from `Rambdax` since it works better with TS than `R.pipe` and `R.compose`. It supports up to 20 function inputs.
6
-
7
- _ Regarding using object as input `R.map` and `R.filter` in TypeScript - this is no longer supported in TypeScript as it has multiple issues when using inside pipes. Instead `R.mapObject` and `R.filterObject` are taken from `Rambdax` so users can migrate their code.
8
-
9
- - Regarding using string as path input in `R.omit`, `R.pick` and `R.path` - now it require explicit definition of expected return type.
3
+ CHANGELOG - 10.0.0
4
+
5
+ This is major revamp of `Rambda` library:
6
+
7
+ - `R.pipe` is the recommended method for TypeScript chaining.
8
+
9
+ - All methods should be useful to work inside `R.pipe` chain. If method doesn't have clear use case inside `R.pipe`, it is removed as part of this revamp.
10
+
11
+ - There will be only one way to use each method. For example, `R.add` can be used only with `R.add(1)(2)`, i.e. it doesn't support `R.add(1, 2)`. This helps with testing and also with TypeScript definitions. This aligns with TypeScript focused approach of this library.
12
+
13
+ - Confusing methods are removed. For example, `R.cond` and `R.ifElse` are removed as their usage inside `R.piped` makes the whole chain less readable. Such logic should be part of your codebase, not part of external library.
14
+
15
+ - All methods that expect more than 1 input, will have to be called with `R.methodName(input1)(input2)` or `R.methodName(input1, input2)(input3)`. This is to make TypeScript definitions easier to maintain.
16
+
17
+ - Optimize many methods to better work in TypeScript context with `R.pipe`. The focus was passing objects through the `R.pipe` chain.
18
+
19
+ - Add `R.pipe` supports up to 20 functions, i.e. chain can be 20 functions long.
20
+
21
+ - `R.chain` is renamed to `R.flatMap`
22
+ - `R.comparator` is renamed to `R.sortingFn`
23
+
24
+ - Remove following methods:
25
+
26
+ -- Lenses - `R.lens`, `R.lensProp`, `R.lensPath`, `R.view`, `R.set`, `R.over`
27
+ -- T, F
28
+ -- add
29
+ -- addIndex, addIndexRight
30
+ -- always
31
+ -- ap
32
+ -- applySpec
33
+ -- applyTo
34
+ -- assoc, assocPath, dissoc, dissocPath
35
+ -- binary
36
+ -- bind
37
+ -- call
38
+ -- collectBy
39
+ -- compose
40
+ -- composeWith
41
+ -- cond
42
+ -- converge
43
+ -- curry
44
+ -- difference, differenceWith
45
+ -- divide, multiply, subtract
46
+ -- endsWith/startsWith
47
+ -- flip
48
+ -- forEachObjIndexed
49
+ -- fromPairs
50
+ -- gte, lte, lt, gt
51
+ -- identical
52
+ -- ifElse
53
+ -- insert
54
+ -- juxt
55
+ -- length
56
+ -- mapObjIndexed
57
+ -- mergeAll, mergeLeft, mergeDeepLeft, mergeDeepRight
58
+ -- move
59
+ -- partitionIndexed
60
+ -- pickAll
61
+ -- pickBy
62
+ -- repeat
63
+ -- splitWhen
64
+ -- toLower/toUpper
65
+ -- unapply
66
+ -- unnest
67
+ -- update
68
+ -- without
69
+
70
+ - Add following methods:
71
+
72
+ -- R.pipeAsync
73
+ -- R.addProp
74
+ -- R.createObjectFromKeys
75
+ -- R.mapAsync
76
+ -- R.mapParallelAsync
77
+ -- R.ascend/R.descend
78
+ -- R.shuffle
79
+ -- R.permutations
80
+ -- R.compact
81
+ -- R.rejectObject
82
+ -- R.findNth
83
+ -- R.combinations
84
+ -- R.rangeDescending
85
+
86
+ - Rename following methods:
87
+
88
+ -- replaceItemAtIndex -> adjust
89
+ -- checkObjectWithSpec -> where
90
+ -- objectIncludes -> whereEq
91
+ -- modify -> modifyProp
92
+
93
+ _ Regarding using object as input with TypeScript in methods such as `R.map/filter` - this feature is no longer supported in TypeScript as it has multiple issues when using inside pipes. In JS, it still works as before. Following methods are affected:
94
+
95
+ -- R.map
96
+ -- R.mapIndexed
97
+ -- R.filter
98
+ -- R.reject
99
+
100
+ - Regarding using string as path input in `R.omit`, `R.pick` and `R.path` with TypeScript - now it require explicit definition of expected return type.
10
101
 
11
102
  - Revert adding stopper logic in `R.reduce` - https://github.com/selfrefactor/rambda/pull/630
12
103
 
13
- - Take typings of `R.filter/R.map` from `Remeda`.
14
-
15
- - Simplify typing for non-curried methods. The goal is to make typings more readable and easier to understand and maintain. The main goal of Rambda methods is to be used inside `R.piped` chain.
16
-
17
104
  - Remove use of `Dictionary` custom interface and use more appropriate `Record<PropertyType, ...>`
18
105
 
19
106
  - Remove use of `Record<string, ...>` in favour of `Record<PropertyType, ...>`
@@ -25,10 +112,11 @@ _ Regarding using object as input `R.map` and `R.filter` in TypeScript - this is
25
112
  - head/last - empty array as input will return `undefined`, but `never`
26
113
  - assocPath - stop supporting curring of type `(x)(y)(z)`
27
114
 
28
- - Require explicit output type(s) as it is very hard to pick up the correct type in many cases.
115
+ - Stop support string inputs for some methods, since it was hard to correctly type them in TypeScript.
116
+
117
+ -- append/prepend
29
118
 
30
- -- assocPath
31
- -- dissocPath
119
+ - Change `R.range` to work with `endIndex` included instead of `endIndex` excluded, i.e. `R.range(0, 2)` will return `[0, 1, 2]` instead of `[0, 1]`. This is done because `R.rangeDescending` is added and users would wonder if end or start index is excluded.
32
120
 
33
121
  - Sync with typing of `@types/ramda`:
34
122
 
@@ -45,27 +133,47 @@ _ Regarding using object as input `R.map` and `R.filter` in TypeScript - this is
45
133
  -- forEach
46
134
  -- keys
47
135
  -- map
48
- -- mapObjIndexed
49
136
  -- mergeAll
50
- -- mergeWith
51
137
  -- modify
52
138
  -- modifyPath
53
139
  -- omit
54
140
  -- partition
141
+ -- pluck
55
142
  -- prepend
143
+ -- propEq
56
144
  -- where
57
145
  -- whereAny
58
146
 
59
147
  - Sync with typing of `remeda`:
60
148
 
61
149
  -- filter
150
+ -- reject
62
151
  -- map
152
+ -- mapObject
63
153
  -- toPairs
154
+ -- partition
64
155
 
65
156
  - Publish to JSR registry - https://jsr.io/@rambda/rambda
66
157
 
67
158
  - Replace Record<string> with Record<PropertyKey>
68
159
 
160
+ - Improve TypeScript definitions of:
161
+
162
+ -- objOf
163
+ -- pluck
164
+ -- mergeWith
165
+
166
+ - Change `Jest` with `Vitest`.
167
+
168
+ - Remove `Babel` dependency in `Rollup` build setup.
169
+
170
+ - Revert adding stopper logic in `R.reduce` - https://github.com/selfrefactor/rambda/pull/630
171
+
172
+ - Renamed methods:
173
+
174
+ -- `chain` to `flatMap`
175
+ -- `mapObjIndexed` to `mapObject`
176
+
69
177
  9.4.2
70
178
 
71
179
  - Fix TS issue when `R.take` is used as part of `R.pipe`.