rambda 10.3.2 → 10.3.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.
- package/CHANGELOG.md +7 -1
- package/README.md +37 -30
- package/index.d.cts +4 -18
- package/index.d.ts +4 -18
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
10.3.
|
|
1
|
+
10.3.3
|
|
2
|
+
|
|
3
|
+
- Fix wrong typing for `R.reject` - [Issue #779](https://github.com/selfrefactor/rambda/issues/779)
|
|
4
|
+
|
|
5
|
+
- Improve `R.pick` to not allow non-existing keys as input.
|
|
6
|
+
|
|
7
|
+
10.3.2
|
|
2
8
|
|
|
3
9
|
- Fix issue with wrong order of inputs in `R.createObjectFromKeys` - [Issue #779](https://github.com/selfrefactor/rambda/issues/779)
|
|
4
10
|
|
package/README.md
CHANGED
|
@@ -5885,13 +5885,13 @@ describe('R.lastIndexOf', () => {
|
|
|
5885
5885
|
```typescript
|
|
5886
5886
|
|
|
5887
5887
|
map<T extends IterableContainer, U>(
|
|
5888
|
-
|
|
5888
|
+
fn: (value: T[number], index: number) => U,
|
|
5889
5889
|
): (data: T) => Mapped<T, U>
|
|
5890
5890
|
```
|
|
5891
5891
|
|
|
5892
5892
|
It returns the result of looping through `iterable` with `fn`.
|
|
5893
5893
|
|
|
5894
|
-
|
|
5894
|
+
> :boom: This function doesn't work with objects (use R.mapObject instead)
|
|
5895
5895
|
|
|
5896
5896
|
```javascript
|
|
5897
5897
|
const fn = x => x * 2
|
|
@@ -5911,21 +5911,11 @@ const result = R.map(fn)(iterable),
|
|
|
5911
5911
|
|
|
5912
5912
|
```typescript
|
|
5913
5913
|
map<T extends IterableContainer, U>(
|
|
5914
|
-
|
|
5914
|
+
fn: (value: T[number], index: number) => U,
|
|
5915
5915
|
): (data: T) => Mapped<T, U>;
|
|
5916
5916
|
map<T extends IterableContainer, U>(
|
|
5917
|
-
|
|
5917
|
+
fn: (value: T[number]) => U,
|
|
5918
5918
|
): (data: T) => Mapped<T, U>;
|
|
5919
|
-
map<T extends IterableContainer, U>(
|
|
5920
|
-
fn: (value: T[number], index: number) => U,
|
|
5921
|
-
data: T
|
|
5922
|
-
) : Mapped<T, U>;
|
|
5923
|
-
map<T extends IterableContainer, U>(
|
|
5924
|
-
fn: (value: T[number]) => U,
|
|
5925
|
-
data: T
|
|
5926
|
-
) : Mapped<T, U>;
|
|
5927
|
-
...
|
|
5928
|
-
...
|
|
5929
5919
|
```
|
|
5930
5920
|
|
|
5931
5921
|
</details>
|
|
@@ -5979,7 +5969,7 @@ import { map, pipe } from 'rambda'
|
|
|
5979
5969
|
|
|
5980
5970
|
const list = [1, 2, 3]
|
|
5981
5971
|
|
|
5982
|
-
it('R.map', () => {
|
|
5972
|
+
it('R.map - within pipe', () => {
|
|
5983
5973
|
const result = pipe(
|
|
5984
5974
|
list,
|
|
5985
5975
|
x => x,
|
|
@@ -5990,6 +5980,20 @@ it('R.map', () => {
|
|
|
5990
5980
|
)
|
|
5991
5981
|
result // $ExpectType string[]
|
|
5992
5982
|
})
|
|
5983
|
+
|
|
5984
|
+
it('R.map - without pipe', () => {
|
|
5985
|
+
map(x => {
|
|
5986
|
+
x // $ExpectType unknown
|
|
5987
|
+
})([1, 2, 3])
|
|
5988
|
+
})
|
|
5989
|
+
|
|
5990
|
+
it('R.map - without pipe but explicitly typed', () => {
|
|
5991
|
+
const result = map<number[], string>(x => {
|
|
5992
|
+
x // $ExpectType number
|
|
5993
|
+
return String(x)
|
|
5994
|
+
})([1, 2, 3])
|
|
5995
|
+
result // $ExpectType string[]
|
|
5996
|
+
})
|
|
5993
5997
|
```
|
|
5994
5998
|
|
|
5995
5999
|
</details>
|
|
@@ -8435,7 +8439,7 @@ export function permutations(inputArray) {
|
|
|
8435
8439
|
|
|
8436
8440
|
```typescript
|
|
8437
8441
|
|
|
8438
|
-
pick<K extends PropertyKey>(propsToPick: K[]): <T
|
|
8442
|
+
pick<K extends PropertyKey>(propsToPick: K[]): <T extends Partial<Record<K, any>>>(input: K extends keyof T ? T : never) => MergeTypes<Pick<T, K>>
|
|
8439
8443
|
```
|
|
8440
8444
|
|
|
8441
8445
|
It returns a partial copy of an `input` containing only `propsToPick` properties.
|
|
@@ -8478,8 +8482,8 @@ const expected = [
|
|
|
8478
8482
|
<summary>All TypeScript definitions</summary>
|
|
8479
8483
|
|
|
8480
8484
|
```typescript
|
|
8481
|
-
pick<K extends PropertyKey>(propsToPick: K[]): <T
|
|
8482
|
-
pick<S extends string
|
|
8485
|
+
pick<K extends PropertyKey>(propsToPick: K[]): <T extends Partial<Record<K, any>>>(input: K extends keyof T ? T : never) => MergeTypes<Pick<T, K>>;
|
|
8486
|
+
pick<S extends string, Keys extends PickStringToPickPath<S>>(propsToPick: S): <T extends Partial<Record<ElementOf<Keys>, any>>>(input: ElementOf<Keys> extends keyof T ? T : never) => ElementOf<Keys> extends keyof T ? MergeTypes<Pick<T, ElementOf<Keys>>> : never;
|
|
8483
8487
|
```
|
|
8484
8488
|
|
|
8485
8489
|
</details>
|
|
@@ -8567,15 +8571,19 @@ const input = { a: 'foo', c: 3 }
|
|
|
8567
8571
|
|
|
8568
8572
|
describe('R.pick', () => {
|
|
8569
8573
|
it('with string as input', () => {
|
|
8570
|
-
const result = pipe(input, pick('a,c
|
|
8574
|
+
const result = pipe(input, pick('a,c'))
|
|
8571
8575
|
result.a // $ExpectType string
|
|
8572
8576
|
result.c // $ExpectType number
|
|
8573
8577
|
})
|
|
8574
8578
|
it('with array as input', () => {
|
|
8575
|
-
|
|
8579
|
+
const result = pipe(input, pick(['a', 'c']))
|
|
8576
8580
|
result.a // $ExpectType string
|
|
8577
8581
|
result.c // $ExpectType number
|
|
8578
8582
|
})
|
|
8583
|
+
it('throws error if some keys do not exist', () => {
|
|
8584
|
+
// @ts-expect-error
|
|
8585
|
+
pipe(input, pick('a,c,b,o'))
|
|
8586
|
+
})
|
|
8579
8587
|
})
|
|
8580
8588
|
```
|
|
8581
8589
|
|
|
@@ -9790,9 +9798,8 @@ it('R.reduce', () => {
|
|
|
9790
9798
|
```typescript
|
|
9791
9799
|
|
|
9792
9800
|
reject<T>(
|
|
9793
|
-
predicate:
|
|
9794
|
-
|
|
9795
|
-
): T[]
|
|
9801
|
+
predicate: BooleanConstructor,
|
|
9802
|
+
): (list: readonly T[]) => ("" | null | undefined | false | 0)[]
|
|
9796
9803
|
```
|
|
9797
9804
|
|
|
9798
9805
|
It has the opposite effect of `R.filter`.
|
|
@@ -9816,10 +9823,6 @@ const result = [
|
|
|
9816
9823
|
<summary>All TypeScript definitions</summary>
|
|
9817
9824
|
|
|
9818
9825
|
```typescript
|
|
9819
|
-
reject<T>(
|
|
9820
|
-
predicate: (value: T) => boolean,
|
|
9821
|
-
list: T[],
|
|
9822
|
-
): T[];
|
|
9823
9826
|
reject<T>(
|
|
9824
9827
|
predicate: BooleanConstructor,
|
|
9825
9828
|
): (list: readonly T[]) => ("" | null | undefined | false | 0)[];
|
|
@@ -9829,8 +9832,6 @@ reject<T>(
|
|
|
9829
9832
|
reject<T>(
|
|
9830
9833
|
predicate: (value: T) => boolean,
|
|
9831
9834
|
): (list: T[]) => T[];
|
|
9832
|
-
...
|
|
9833
|
-
...
|
|
9834
9835
|
```
|
|
9835
9836
|
|
|
9836
9837
|
</details>
|
|
@@ -13541,7 +13542,13 @@ describe('R.zipWith', () => {
|
|
|
13541
13542
|
|
|
13542
13543
|
## ❯ CHANGELOG
|
|
13543
13544
|
|
|
13544
|
-
10.3.
|
|
13545
|
+
10.3.3
|
|
13546
|
+
|
|
13547
|
+
- Fix wrong typing for `R.reject` - [Issue #779](https://github.com/selfrefactor/rambda/issues/779)
|
|
13548
|
+
|
|
13549
|
+
- Improve `R.pick` to not allow non-existing keys as input.
|
|
13550
|
+
|
|
13551
|
+
10.3.2
|
|
13545
13552
|
|
|
13546
13553
|
- Fix issue with wrong order of inputs in `R.createObjectFromKeys` - [Issue #779](https://github.com/selfrefactor/rambda/issues/779)
|
|
13547
13554
|
|
package/index.d.cts
CHANGED
|
@@ -506,23 +506,13 @@ export function lastIndexOf<T>(target: T): (list: T[]) => number;
|
|
|
506
506
|
|
|
507
507
|
/**
|
|
508
508
|
* It returns the result of looping through `iterable` with `fn`.
|
|
509
|
-
*
|
|
510
|
-
* It works with both array and object.
|
|
511
509
|
*/
|
|
512
510
|
export function map<T extends IterableContainer, U>(
|
|
513
|
-
|
|
511
|
+
fn: (value: T[number], index: number) => U,
|
|
514
512
|
): (data: T) => Mapped<T, U>;
|
|
515
513
|
export function map<T extends IterableContainer, U>(
|
|
516
|
-
|
|
514
|
+
fn: (value: T[number]) => U,
|
|
517
515
|
): (data: T) => Mapped<T, U>;
|
|
518
|
-
export function map<T extends IterableContainer, U>(
|
|
519
|
-
fn: (value: T[number], index: number) => U,
|
|
520
|
-
data: T
|
|
521
|
-
) : Mapped<T, U>;
|
|
522
|
-
export function map<T extends IterableContainer, U>(
|
|
523
|
-
fn: (value: T[number]) => U,
|
|
524
|
-
data: T
|
|
525
|
-
) : Mapped<T, U>;
|
|
526
516
|
|
|
527
517
|
/**
|
|
528
518
|
* Sequential asynchronous mapping with `fn` over members of `list`.
|
|
@@ -1233,8 +1223,8 @@ export function permutations<T>(list: T[]): T[][];
|
|
|
1233
1223
|
*
|
|
1234
1224
|
* String annotation of `propsToPick` is one of the differences between `Rambda` and `Ramda`.
|
|
1235
1225
|
*/
|
|
1236
|
-
export function pick<K extends PropertyKey>(propsToPick: K[]): <T
|
|
1237
|
-
export function pick<S extends string
|
|
1226
|
+
export function pick<K extends PropertyKey>(propsToPick: K[]): <T extends Partial<Record<K, any>>>(input: K extends keyof T ? T : never) => MergeTypes<Pick<T, K>>;
|
|
1227
|
+
export function pick<S extends string, Keys extends PickStringToPickPath<S>>(propsToPick: S): <T extends Partial<Record<ElementOf<Keys>, any>>>(input: ElementOf<Keys> extends keyof T ? T : never) => ElementOf<Keys> extends keyof T ? MergeTypes<Pick<T, ElementOf<Keys>>> : never;
|
|
1238
1228
|
|
|
1239
1229
|
/**
|
|
1240
1230
|
* It performs left-to-right function composition, where first argument is the input for the chain of functions.
|
|
@@ -1791,10 +1781,6 @@ export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i: numbe
|
|
|
1791
1781
|
/**
|
|
1792
1782
|
* It has the opposite effect of `R.filter`.
|
|
1793
1783
|
*/
|
|
1794
|
-
export function reject<T>(
|
|
1795
|
-
predicate: (value: T) => boolean,
|
|
1796
|
-
list: T[],
|
|
1797
|
-
): T[];
|
|
1798
1784
|
export function reject<T>(
|
|
1799
1785
|
predicate: BooleanConstructor,
|
|
1800
1786
|
): (list: readonly T[]) => ("" | null | undefined | false | 0)[];
|
package/index.d.ts
CHANGED
|
@@ -506,23 +506,13 @@ export function lastIndexOf<T>(target: T): (list: T[]) => number;
|
|
|
506
506
|
|
|
507
507
|
/**
|
|
508
508
|
* It returns the result of looping through `iterable` with `fn`.
|
|
509
|
-
*
|
|
510
|
-
* It works with both array and object.
|
|
511
509
|
*/
|
|
512
510
|
export function map<T extends IterableContainer, U>(
|
|
513
|
-
|
|
511
|
+
fn: (value: T[number], index: number) => U,
|
|
514
512
|
): (data: T) => Mapped<T, U>;
|
|
515
513
|
export function map<T extends IterableContainer, U>(
|
|
516
|
-
|
|
514
|
+
fn: (value: T[number]) => U,
|
|
517
515
|
): (data: T) => Mapped<T, U>;
|
|
518
|
-
export function map<T extends IterableContainer, U>(
|
|
519
|
-
fn: (value: T[number], index: number) => U,
|
|
520
|
-
data: T
|
|
521
|
-
) : Mapped<T, U>;
|
|
522
|
-
export function map<T extends IterableContainer, U>(
|
|
523
|
-
fn: (value: T[number]) => U,
|
|
524
|
-
data: T
|
|
525
|
-
) : Mapped<T, U>;
|
|
526
516
|
|
|
527
517
|
/**
|
|
528
518
|
* Sequential asynchronous mapping with `fn` over members of `list`.
|
|
@@ -1233,8 +1223,8 @@ export function permutations<T>(list: T[]): T[][];
|
|
|
1233
1223
|
*
|
|
1234
1224
|
* String annotation of `propsToPick` is one of the differences between `Rambda` and `Ramda`.
|
|
1235
1225
|
*/
|
|
1236
|
-
export function pick<K extends PropertyKey>(propsToPick: K[]): <T
|
|
1237
|
-
export function pick<S extends string
|
|
1226
|
+
export function pick<K extends PropertyKey>(propsToPick: K[]): <T extends Partial<Record<K, any>>>(input: K extends keyof T ? T : never) => MergeTypes<Pick<T, K>>;
|
|
1227
|
+
export function pick<S extends string, Keys extends PickStringToPickPath<S>>(propsToPick: S): <T extends Partial<Record<ElementOf<Keys>, any>>>(input: ElementOf<Keys> extends keyof T ? T : never) => ElementOf<Keys> extends keyof T ? MergeTypes<Pick<T, ElementOf<Keys>>> : never;
|
|
1238
1228
|
|
|
1239
1229
|
/**
|
|
1240
1230
|
* It performs left-to-right function composition, where first argument is the input for the chain of functions.
|
|
@@ -1791,10 +1781,6 @@ export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i: numbe
|
|
|
1791
1781
|
/**
|
|
1792
1782
|
* It has the opposite effect of `R.filter`.
|
|
1793
1783
|
*/
|
|
1794
|
-
export function reject<T>(
|
|
1795
|
-
predicate: (value: T) => boolean,
|
|
1796
|
-
list: T[],
|
|
1797
|
-
): T[];
|
|
1798
1784
|
export function reject<T>(
|
|
1799
1785
|
predicate: BooleanConstructor,
|
|
1800
1786
|
): (list: readonly T[]) => ("" | null | undefined | false | 0)[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rambda",
|
|
3
|
-
"version": "10.3.
|
|
3
|
+
"version": "10.3.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"out": "yarn populatedocs && yarn populatereadme && yarn build && yarn create-docsify",
|
|
6
6
|
"build": "yarn build:main && yarn build:web && yarn build:esm",
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@definitelytyped/dtslint": "0.0.182",
|
|
42
42
|
"@types/mocha": "10.0.10",
|
|
43
|
-
"@types/node": "24.0
|
|
44
|
-
"@vitest/coverage-v8": "4.0.0-beta.
|
|
43
|
+
"@types/node": "24.7.0",
|
|
44
|
+
"@vitest/coverage-v8": "4.0.0-beta.17",
|
|
45
45
|
"helpers-fn": "2.0.0",
|
|
46
46
|
"lodash": "4.17.21",
|
|
47
47
|
"radashi": "13.0.0-beta.ffa4778",
|
|
48
48
|
"rambdax": "11.3.1",
|
|
49
49
|
"ramda": "0.31.3",
|
|
50
|
-
"remeda": "2.
|
|
51
|
-
"rollup": "4.
|
|
52
|
-
"types-ramda": "0.
|
|
53
|
-
"typescript": "
|
|
54
|
-
"vitest": "4.0.0-beta.
|
|
50
|
+
"remeda": "2.32.0",
|
|
51
|
+
"rollup": "4.52.4",
|
|
52
|
+
"types-ramda": "0.31.0",
|
|
53
|
+
"typescript": "6.0.0-dev.20251006",
|
|
54
|
+
"vitest": "4.0.0-beta.17"
|
|
55
55
|
},
|
|
56
56
|
"jest": {
|
|
57
57
|
"testEnvironment": "node",
|