rambda 9.4.1 → 9.4.2

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 CHANGED
@@ -1,9 +1,24 @@
1
- 9.4.2
1
+ 9.4.2
2
2
 
3
- - Fix bug with `R.differenceWith` when two arrays has same length - [Issue #750](https://github.com/selfrefactor/rambda/issues/757)
3
+ - Fix TS issue when `R.take` is used as part of `R.pipe`.
4
+
5
+ Moving away from `Ramda` types which are problematic in this case:
6
+
7
+ ```typescript
8
+ const data = ['foo', 'bar', 'baz', 'qux']
9
+ const result = piped(
10
+ data,
11
+ filter(
12
+ x => x.length >= 2
13
+ ),
14
+ takeLast(2),
15
+ )
16
+ ```
4
17
 
5
18
  9.4.1
6
19
 
20
+ - Fix bug with `R.differenceWith` when two arrays has same length - [Issue #750](https://github.com/selfrefactor/rambda/issues/757)
21
+
7
22
  - Allow path input to not be transformed when string numbers are there - [Issue #750](https://github.com/selfrefactor/rambda/issues/750)
8
23
 
9
24
  9.4.0
package/README.md CHANGED
@@ -14347,7 +14347,7 @@ describe('R.tail', () => {
14347
14347
 
14348
14348
  ```typescript
14349
14349
 
14350
- take<T>(howMany: number, input: T[]): T[]
14350
+ take<T>(howMany: number, input: T): T extends string ? string : T
14351
14351
  ```
14352
14352
 
14353
14353
  It returns the first `howMany` elements of `input`.
@@ -14359,12 +14359,8 @@ It returns the first `howMany` elements of `input`.
14359
14359
  <summary>All TypeScript definitions</summary>
14360
14360
 
14361
14361
  ```typescript
14362
- take<T>(howMany: number, input: T[]): T[];
14363
- take(howMany: number, input: string): string;
14364
- take<T>(howMany: number): {
14365
- <T>(input: T[]): T[];
14366
- (input: string): string;
14367
- };
14362
+ take<T>(howMany: number, input: T): T extends string ? string : T;
14363
+ take<T>(howMany: number) : (input: T) => T extends string ? string : T;
14368
14364
  ```
14369
14365
 
14370
14366
  </details>
@@ -14440,7 +14436,7 @@ describe('R.take - array', () => {
14440
14436
  result // $ExpectType number[]
14441
14437
  })
14442
14438
  it('curried', () => {
14443
- const result = take(howMany)(list)
14439
+ const result = take<number[]>(howMany)(list)
14444
14440
 
14445
14441
  result // $ExpectType number[]
14446
14442
  })
@@ -14453,7 +14449,7 @@ describe('R.take - string', () => {
14453
14449
  result // $ExpectType string
14454
14450
  })
14455
14451
  it('curried', () => {
14456
- const result = take(howMany)(str)
14452
+ const result = take<string>(howMany)(str)
14457
14453
 
14458
14454
  result // $ExpectType string
14459
14455
  })
@@ -14468,7 +14464,7 @@ describe('R.take - string', () => {
14468
14464
 
14469
14465
  ```typescript
14470
14466
 
14471
- takeLast<T>(howMany: number, input: T[]): T[]
14467
+ takeLast<T>(howMany: number, input: T): T extends string ? string : T
14472
14468
  ```
14473
14469
 
14474
14470
  It returns the last `howMany` elements of `input`.
@@ -14480,12 +14476,8 @@ It returns the last `howMany` elements of `input`.
14480
14476
  <summary>All TypeScript definitions</summary>
14481
14477
 
14482
14478
  ```typescript
14483
- takeLast<T>(howMany: number, input: T[]): T[];
14484
- takeLast(howMany: number, input: string): string;
14485
- takeLast<T>(howMany: number): {
14486
- <T>(input: T[]): T[];
14487
- (input: string): string;
14488
- };
14479
+ takeLast<T>(howMany: number, input: T): T extends string ? string : T;
14480
+ takeLast<T>(howMany: number) : (input: T) => T extends string ? string : T;
14489
14481
  ```
14490
14482
 
14491
14483
  </details>
@@ -14556,7 +14548,7 @@ test('with negative index', () => {
14556
14548
  <summary><strong>TypeScript</strong> test</summary>
14557
14549
 
14558
14550
  ```typescript
14559
- import {takeLast} from 'rambda'
14551
+ import {filter, piped, takeLast} from 'rambda'
14560
14552
 
14561
14553
  const list = [1, 2, 3, 4]
14562
14554
  const str = 'foobar'
@@ -14569,10 +14561,21 @@ describe('R.takeLast - array', () => {
14569
14561
  result // $ExpectType number[]
14570
14562
  })
14571
14563
  it('curried', () => {
14572
- const result = takeLast(howMany)(list)
14564
+ const result = takeLast<number[]>(howMany)(list)
14573
14565
 
14574
14566
  result // $ExpectType number[]
14575
14567
  })
14568
+ it('real case', () => {
14569
+ const data = ['foo', 'bar', 'baz', 'qux']
14570
+ const result = piped(
14571
+ data,
14572
+ filter(
14573
+ x => x.length >= 100
14574
+ ),
14575
+ takeLast(2),
14576
+ )
14577
+ result // $ExpectType string[]
14578
+ })
14576
14579
  })
14577
14580
 
14578
14581
  describe('R.takeLast - string', () => {
@@ -14582,7 +14585,7 @@ describe('R.takeLast - string', () => {
14582
14585
  result // $ExpectType string
14583
14586
  })
14584
14587
  it('curried', () => {
14585
- const result = takeLast(howMany)(str)
14588
+ const result = takeLast<string>(howMany)(str)
14586
14589
 
14587
14590
  result // $ExpectType string
14588
14591
  })
@@ -17243,12 +17246,27 @@ describe('R.zipWith', () => {
17243
17246
 
17244
17247
  ## ❯ CHANGELOG
17245
17248
 
17246
- 9.4.2
17249
+ 9.4.2
17247
17250
 
17248
- - Fix bug with `R.differenceWith` when two arrays has same length - [Issue #750](https://github.com/selfrefactor/rambda/issues/757)
17251
+ - Fix TS issue when `R.take` is used as part of `R.pipe`.
17252
+
17253
+ Moving away from `Ramda` types which are problematic in this case:
17254
+
17255
+ ```typescript
17256
+ const data = ['foo', 'bar', 'baz', 'qux']
17257
+ const result = piped(
17258
+ data,
17259
+ filter(
17260
+ x => x.length >= 2
17261
+ ),
17262
+ takeLast(2),
17263
+ )
17264
+ ```
17249
17265
 
17250
17266
  9.4.1
17251
17267
 
17268
+ - Fix bug with `R.differenceWith` when two arrays has same length - [Issue #750](https://github.com/selfrefactor/rambda/issues/757)
17269
+
17252
17270
  - Allow path input to not be transformed when string numbers are there - [Issue #750](https://github.com/selfrefactor/rambda/issues/750)
17253
17271
 
17254
17272
  9.4.0
package/immutable.d.ts CHANGED
@@ -1642,22 +1642,14 @@ export function tail(input: string): string;
1642
1642
  /**
1643
1643
  * It returns the first `howMany` elements of `input`.
1644
1644
  */
1645
- export function take<T>(howMany: number, input: readonly T[]): readonly T[];
1646
- export function take(howMany: number, input: string): string;
1647
- export function take<T>(howMany: number): {
1648
- <T>(input: readonly T[]): readonly T[];
1649
- (input: string): string;
1650
- };
1645
+ export function take<T>(howMany: number, input: T): T extends string ? string : T;
1646
+ export function take<T>(howMany: number) : (input: T) => T extends string ? string : T;
1651
1647
 
1652
1648
  /**
1653
1649
  * It returns the last `howMany` elements of `input`.
1654
1650
  */
1655
- export function takeLast<T>(howMany: number, input: readonly T[]): readonly T[];
1656
- export function takeLast(howMany: number, input: string): string;
1657
- export function takeLast<T>(howMany: number): {
1658
- <T>(input: readonly T[]): readonly T[];
1659
- (input: string): string;
1660
- };
1651
+ export function takeLast<T>(howMany: number, input: T): T extends string ? string : T;
1652
+ export function takeLast<T>(howMany: number) : (input: T) => T extends string ? string : T;
1661
1653
 
1662
1654
  export function takeLastWhile(predicate: (x: string) => boolean, input: string): string;
1663
1655
  export function takeLastWhile(predicate: (x: string) => boolean): (input: string) => string;
package/index.d.ts CHANGED
@@ -1642,22 +1642,14 @@ export function tail(input: string): string;
1642
1642
  /**
1643
1643
  * It returns the first `howMany` elements of `input`.
1644
1644
  */
1645
- export function take<T>(howMany: number, input: T[]): T[];
1646
- export function take(howMany: number, input: string): string;
1647
- export function take<T>(howMany: number): {
1648
- <T>(input: T[]): T[];
1649
- (input: string): string;
1650
- };
1645
+ export function take<T>(howMany: number, input: T): T extends string ? string : T;
1646
+ export function take<T>(howMany: number) : (input: T) => T extends string ? string : T;
1651
1647
 
1652
1648
  /**
1653
1649
  * It returns the last `howMany` elements of `input`.
1654
1650
  */
1655
- export function takeLast<T>(howMany: number, input: T[]): T[];
1656
- export function takeLast(howMany: number, input: string): string;
1657
- export function takeLast<T>(howMany: number): {
1658
- <T>(input: T[]): T[];
1659
- (input: string): string;
1660
- };
1651
+ export function takeLast<T>(howMany: number, input: T): T extends string ? string : T;
1652
+ export function takeLast<T>(howMany: number) : (input: T) => T extends string ? string : T;
1661
1653
 
1662
1654
  export function takeLastWhile(predicate: (x: string) => boolean, input: string): string;
1663
1655
  export function takeLastWhile(predicate: (x: string) => boolean): (input: string) => string;
package/package.json CHANGED
@@ -1,22 +1,14 @@
1
1
  {
2
2
  "name": "rambda",
3
- "version": "9.4.1",
3
+ "version": "9.4.2",
4
4
  "scripts": {
5
- "before": "yarn out && yarn docs",
6
- "benchmark": "cd ../rambda-scripts && RAMBDA_RUN_ALL=ON RAMBDA_RUN_INDEXES=ON yarn benchmark",
7
- "benchmark:all": "yarn build:step && cd ../rambda-scripts && yarn benchmark:all",
8
- "benchmark:check": "yarn build:step && METHOD=compose yarn benchmark:check:apply",
9
- "benchmark:check:apply": "cd ../rambda-scripts && yarn check-benchmark",
5
+ "out": "yarn populatedocs && yarn populatereadme && yarn immutable && yarn build && yarn create-docsify",
6
+ "x": "yarn populatedocs:x && yarn populatereadme:x && yarn immutable:x && yarn create-docsify:x",
10
7
  "build": "yarn build:main && yarn build:web",
11
8
  "build:main": "cross-env NODE_ENV=build rollup -c files/rollup.config.mjs",
12
- "build:step": "yarn populatereadme && yarn build:main",
13
9
  "build:web": "cross-env NODE_ENV=build rollup -c files/rollup.web.config.mjs",
14
- "d": "yarn out && run d",
15
- "docs": "npx docsify-cli init ./docs && yarn fix-docsify",
16
- "fix-docsify": "cd ../rambda-scripts && yarn fix-docsify:rambda",
17
10
  "immutable": "cd ../rambda-scripts && yarn immutable:rambda",
18
11
  "immutable:x": "cd ../rambda-scripts && yarn immutable:rambdax",
19
- "out": "yarn populatedocs && yarn populatereadme && yarn immutable && yarn build",
20
12
  "populatedocs": "cd ../rambda-scripts && yarn populate:docs",
21
13
  "populatedocs:x": "cd ../rambda-scripts && yarn populate:docs:rambdax",
22
14
  "populatereadme": "cd ../rambda-scripts && yarn populate:readme",
@@ -25,9 +17,9 @@
25
17
  "test:all": "jest source/*.spec.js -u --bail=false",
26
18
  "test:ci": "jest source/*.spec.js --coverage --no-cache -w 1",
27
19
  "test:typings": "dtslint --localTs ./node_modules/typescript/lib --expectOnly ./source",
28
- "ts": "yarn test:typings",
29
- "usedby": "cd ../rambda-scripts && yarn usedby",
30
- "x": "yarn populatedocs:x && yarn populatereadme:x && yarn immutable:x"
20
+ "create-docsify": "cd ../rambda-scripts && yarn create-docsify",
21
+ "create-docsify:x": "cd ../rambda-scripts && yarn create-docsify:rambdax",
22
+ "ts": "yarn test:typings"
31
23
  },
32
24
  "depFn": [
33
25
  "@definitelytyped/dtslint"