rambda 7.3.0 → 7.4.0

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/README.md CHANGED
@@ -9,6 +9,7 @@
9
9
  ![Library size](https://img.shields.io/bundlephobia/minzip/rambda)
10
10
  [![install size](https://packagephobia.com/badge?p=rambda)](https://packagephobia.com/result?p=rambda)
11
11
  [![nest badge](https://nest.land/badge.svg)](https://nest.land/package/rambda)
12
+ [![HitCount](https://hits.dwyl.com/selfrefactor/rambda.svg?style=flat-square)](http://hits.dwyl.com/selfrefactor/rambda)
12
13
 
13
14
  ## ❯ Example use
14
15
 
@@ -64,17 +65,7 @@ Ramda.add(1)('foo') // => will not trigger warning in VSCode
64
65
 
65
66
  The size of a library affects not only the build bundle size but also the dev bundle size and build time. This is important advantage, expecially for big projects.
66
67
 
67
- ### Tree-shaking
68
-
69
- Currently **Rambda** is more tree-shakable than **Ramda** - proven in the following [repo](https://github.com/selfrefactor/rambda-tree-shaking).
70
-
71
- The repo holds two `Angular9` applications: one with small example code of *Ramda* and the other - same code but with *Rambda* as import library.
72
-
73
- The test shows that **Rambda** bundle size is **2 MB** less than its **Ramda** counterpart.
74
-
75
- There is also [Webpack/Rollup/Parcel/Esbuild tree-shaking example including several libraries](https://github.com/mischnic/tree-shaking-example) including `Ramda`, `Rambda` and `Rambdax`.
76
-
77
- > actually tree-shaking is the initial reason for creation of `Rambda`
68
+ <!-- ### Tree-shaking -->
78
69
 
79
70
  ### Dot notation for `R.path`, `R.paths`, `R.assocPath` and `R.lensPath`
80
71
 
@@ -345,157 +336,10 @@ method | Rambda | Ramda | Lodash
345
336
 
346
337
  ### add
347
338
 
348
- ```typescript
349
-
350
- add(a: number, b: number): number
351
- ```
352
-
353
339
  It adds `a` and `b`.
354
340
 
355
341
  <a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20result%20%3D%20R.add(2%2C%203)%20%2F%2F%20%3D%3E%20%205">Try this <strong>R.add</strong> example in Rambda REPL</a>
356
342
 
357
- <details>
358
-
359
- <summary>All Typescript definitions</summary>
360
-
361
- ```typescript
362
- add(a: number, b: number): number;
363
- add(a: number): (b: number) => number;
364
- ```
365
-
366
- </details>
367
-
368
- <details>
369
-
370
- <summary><strong>R.add</strong> source</summary>
371
-
372
- ```javascript
373
- export function add(a, b){
374
- if (arguments.length === 1) return _b => add(a, _b)
375
-
376
- return Number(a) + Number(b)
377
- }
378
- ```
379
-
380
- </details>
381
-
382
- <details>
383
-
384
- <summary><strong>Tests</strong></summary>
385
-
386
- ```javascript
387
- import { add as addRamda } from 'ramda'
388
-
389
- import { compareCombinations } from './_internals/testUtils.js'
390
- import { add } from './add.js'
391
-
392
- test('with number', () => {
393
- expect(add(2, 3)).toBe(5)
394
- expect(add(7)(10)).toBe(17)
395
- })
396
-
397
- test('string is bad input', () => {
398
- expect(add('foo', 'bar')).toBeNaN()
399
- })
400
-
401
- test('ramda specs', () => {
402
- expect(add('1', '2')).toBe(3)
403
- expect(add(1, '2')).toBe(3)
404
- expect(add(true, false)).toBe(1)
405
- expect(add(null, null)).toBe(0)
406
- expect(add(undefined, undefined)).toBeNaN()
407
- expect(add(new Date(1), new Date(2))).toBe(3)
408
- })
409
-
410
- const possibleInputs = [
411
- /foo/,
412
- 'foo',
413
- true,
414
- 3,
415
- NaN,
416
- 4,
417
- [],
418
- Promise.resolve(1),
419
- ]
420
-
421
- describe('brute force', () => {
422
- compareCombinations({
423
- fn : add,
424
- fnRamda : addRamda,
425
- firstInput : possibleInputs,
426
- secondInput : possibleInputs,
427
- callback : errorsCounters => {
428
- expect(errorsCounters).toMatchInlineSnapshot(`
429
- Object {
430
- "ERRORS_MESSAGE_MISMATCH": 0,
431
- "ERRORS_TYPE_MISMATCH": 0,
432
- "RESULTS_MISMATCH": 0,
433
- "SHOULD_NOT_THROW": 0,
434
- "SHOULD_THROW": 0,
435
- "TOTAL_TESTS": 64,
436
- }
437
- `)
438
- },
439
- })
440
- })
441
- ```
442
-
443
- </details>
444
-
445
- <details>
446
-
447
- <summary><strong>Typescript</strong> test</summary>
448
-
449
- ```typescript
450
- import {add} from 'rambda'
451
-
452
- describe('R.add', () => {
453
- it('happy', () => {
454
- const result = add(4, 1)
455
-
456
- result // $ExpectType number
457
- })
458
- it('curried', () => {
459
- const result = add(4)(1)
460
-
461
- result // $ExpectType number
462
- })
463
- })
464
- ```
465
-
466
- </details>
467
-
468
- <details>
469
-
470
- <summary>Rambda is fastest. Ramda is 21.52% slower and Lodash is 82.15% slower</summary>
471
-
472
- ```text
473
- const R = require('../../dist/rambda.js')
474
-
475
- const add = [
476
- {
477
- label : 'Rambda',
478
- fn : () => {
479
- R.add(1, 1)
480
- },
481
- },
482
- {
483
- label : 'Ramda',
484
- fn : () => {
485
- Ramda.add(1, 1)
486
- },
487
- },
488
- {
489
- label : 'Lodash',
490
- fn : () => {
491
- _.add(1, 1)
492
- },
493
- },
494
- ]
495
- ```
496
-
497
- </details>
498
-
499
343
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#add)
500
344
 
501
345
  ### adjust
@@ -596,41 +440,6 @@ test('when index is out of bounds', () => {
596
440
 
597
441
  </details>
598
442
 
599
- <details>
600
-
601
- <summary>Rambda is slower than Ramda with 8.48%</summary>
602
-
603
- ```text
604
- const R = require('../../dist/rambda.js')
605
-
606
- const list = [ 0, 1, 2 ]
607
- const fn = x => x + 1
608
- const index = 1
609
-
610
- const adjust = [
611
- {
612
- label : 'Rambda',
613
- fn : () => {
614
- R.adjust(
615
- index, fn, list
616
- )
617
- R.adjust(index, fn)(list)
618
- },
619
- },
620
- {
621
- label : 'Ramda',
622
- fn : () => {
623
- Ramda.adjust(
624
- index, fn, list
625
- )
626
- Ramda.adjust(index, fn)(list)
627
- },
628
- },
629
- ]
630
- ```
631
-
632
- </details>
633
-
634
443
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#adjust)
635
444
 
636
445
  ### all
@@ -727,50 +536,6 @@ describe('all', () => {
727
536
 
728
537
  </details>
729
538
 
730
- <details>
731
-
732
- <summary>Rambda is faster than Ramda with 1.81%</summary>
733
-
734
- ```text
735
- const R = require('../../dist/rambda.js')
736
-
737
- const {
738
- uniqListOfObjects,
739
- uniqListOfStrings,
740
- rangeOfNumbers,
741
- uniqListOfLists,
742
- } = require('./_utils.js')
743
-
744
- const limit = 100
745
-
746
- const modes = [
747
- [ uniqListOfObjects(limit), x => Object.keys(x).length > 2 ],
748
- [ uniqListOfStrings(limit), x => x.length > 0 ],
749
- [ uniqListOfLists(limit), x => x.length > 0 ],
750
- [ rangeOfNumbers(limit), x => x > -1 ],
751
- ]
752
-
753
- const applyBenchmark = (fn, input) => fn(input[ 1 ], input[ 0 ])
754
-
755
- const tests = [
756
- {
757
- label : 'Rambda',
758
- fn : R.all,
759
- },
760
- {
761
- label : 'Ramda',
762
- fn : Ramda.all,
763
- },
764
- ]
765
-
766
- tests,
767
- applyBenchmark,
768
- modes,
769
- }
770
- ```
771
-
772
- </details>
773
-
774
539
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#all)
775
540
 
776
541
  ### allPass
@@ -908,61 +673,6 @@ describe('allPass', () => {
908
673
 
909
674
  </details>
910
675
 
911
- <details>
912
-
913
- <summary>Rambda is faster than Ramda with 91.09%</summary>
914
-
915
- ```text
916
- const R = require('../../dist/rambda.js')
917
-
918
- const { random } = require('rambdax')
919
-
920
- const limit = 100
921
- const min = 10
922
- const max = 1200
923
- function createListOfFunctions(fn, fnLimit){
924
- return Array(fnLimit)
925
- .fill(null)
926
- .map(() => fn())
927
- }
928
-
929
- const modes = [
930
- [
931
- { foo : 1500 },
932
- createListOfFunctions(() => x => Number(x.foo) > random(min, max),
933
- limit),
934
- ],
935
- [
936
- '1500',
937
- createListOfFunctions(() => x => Number(x) > random(min, max), limit),
938
- ],
939
- [
940
- [ 1, 2, 1500 ],
941
- createListOfFunctions(() => x => x[ 2 ] > random(min, max), limit),
942
- ],
943
- [ 1500, createListOfFunctions(() => x => x > random(min, max), limit) ],
944
- ]
945
-
946
- const applyBenchmark = (fn, input) => fn(input[ 1 ])(input[ 0 ])
947
- const tests = [
948
- {
949
- label : 'Rambda',
950
- fn : R.allPass,
951
- },
952
- {
953
- label : 'Ramda',
954
- fn : Ramda.allPass,
955
- },
956
- ]
957
-
958
- tests,
959
- modes,
960
- applyBenchmark,
961
- }
962
- ```
963
-
964
- </details>
965
-
966
676
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#allPass)
967
677
 
968
678
  ### always
@@ -1076,40 +786,6 @@ describe('R.any', () => {
1076
786
 
1077
787
  </details>
1078
788
 
1079
- <details>
1080
-
1081
- <summary>Rambda is fastest. Ramda is 92.87% slower and Lodash is 45.82% slower</summary>
1082
-
1083
- ```text
1084
- const R = require('../../dist/rambda.js')
1085
-
1086
- const input = [ 1, 2, 3, 4 ]
1087
- const fn = val => val > 2
1088
-
1089
- const any = [
1090
- {
1091
- label : 'Rambda',
1092
- fn : () => {
1093
- R.any(fn, input)
1094
- },
1095
- },
1096
- {
1097
- label : 'Ramda',
1098
- fn : () => {
1099
- Ramda.any(fn, input)
1100
- },
1101
- },
1102
- {
1103
- label : 'Lodash.some',
1104
- fn : () => {
1105
- _.some(input, fn)
1106
- },
1107
- },
1108
- ]
1109
- ```
1110
-
1111
- </details>
1112
-
1113
789
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#any)
1114
790
 
1115
791
  ### anyPass
@@ -1260,33 +936,6 @@ describe('anyPass', () => {
1260
936
 
1261
937
  </details>
1262
938
 
1263
- <details>
1264
-
1265
- <summary>Rambda is faster than Ramda with 98.25%</summary>
1266
-
1267
- ```text
1268
- const R = require('../../dist/rambda.js')
1269
-
1270
- const rules = [ x => typeof x === 'boolean', x => x > 20, x => x * 7 < 100 ]
1271
-
1272
- const anyPass = [
1273
- {
1274
- label : 'Rambda',
1275
- fn : () => {
1276
- R.anyPass(rules)(11)
1277
- },
1278
- },
1279
- {
1280
- label : 'Ramda',
1281
- fn : () => {
1282
- Ramda.anyPass(rules)(11)
1283
- },
1284
- },
1285
- ]
1286
- ```
1287
-
1288
- </details>
1289
-
1290
939
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#anyPass)
1291
940
 
1292
941
  ### append
@@ -1383,33 +1032,6 @@ describe('R.append', () => {
1383
1032
 
1384
1033
  </details>
1385
1034
 
1386
- <details>
1387
-
1388
- <summary>Rambda is faster than Ramda with 2.07%</summary>
1389
-
1390
- ```text
1391
- const R = require('../../dist/rambda.js')
1392
-
1393
- const append = [
1394
- {
1395
- label : 'Rambda',
1396
- fn : () => {
1397
- R.append(0)([ 1, 2, 3, 4 ])
1398
- R.append('bar')('foo')
1399
- },
1400
- },
1401
- {
1402
- label : 'Ramda',
1403
- fn : () => {
1404
- Ramda.append(0)([ 1, 2, 3, 4 ])
1405
- Ramda.append('bar')('foo')
1406
- },
1407
- },
1408
- ]
1409
- ```
1410
-
1411
- </details>
1412
-
1413
1035
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#append)
1414
1036
 
1415
1037
  ### apply
@@ -1948,51 +1570,6 @@ describe('applySpec', () => {
1948
1570
 
1949
1571
  </details>
1950
1572
 
1951
- <details>
1952
-
1953
- <summary>Rambda is faster than Ramda with 80.43%</summary>
1954
-
1955
- ```text
1956
- const R = require('../../dist/rambda.js')
1957
-
1958
- const curryN = [
1959
- {
1960
- label : 'Rambda',
1961
- fn : () => {
1962
- const data = {
1963
- a : {
1964
- b : { c : 1 },
1965
- d : 2,
1966
- },
1967
- }
1968
- const spec = {
1969
- c : R.path([ 'a', 'b', 'c' ]),
1970
- d : R.path([ 'a', 'd' ]),
1971
- }
1972
- R.applySpec(spec, data)
1973
- },
1974
- },
1975
- {
1976
- label : 'Ramda',
1977
- fn : () => {
1978
- const data = {
1979
- a : {
1980
- b : { c : 1 },
1981
- d : 2,
1982
- },
1983
- }
1984
- const spec = {
1985
- c : Ramda.path([ 'a', 'b', 'c' ]),
1986
- d : Ramda.path([ 'a', 'd' ]),
1987
- }
1988
- Ramda.applySpec(spec, data)
1989
- },
1990
- },
1991
- ]
1992
- ```
1993
-
1994
- </details>
1995
-
1996
1573
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#applySpec)
1997
1574
 
1998
1575
  ### assoc
@@ -3033,39 +2610,6 @@ describe('R.defaultTo with Ramda spec', () => {
3033
2610
 
3034
2611
  </details>
3035
2612
 
3036
- <details>
3037
-
3038
- <summary>Rambda is faster than Ramda with 48.91%</summary>
3039
-
3040
- ```text
3041
- const R = require('../../dist/rambda.js')
3042
-
3043
- const input = [ null, undefined, 5 ]
3044
-
3045
- const defaultTo = [
3046
- {
3047
- label : 'Rambda',
3048
- fn : () => {
3049
- R.defaultTo(3, input[ 0 ])
3050
- },
3051
- },
3052
- {
3053
- label : 'Ramda',
3054
- fn : () => {
3055
- Ramda.defaultTo(3, input[ 0 ])
3056
- },
3057
- },
3058
- {
3059
- label : 'Rambda with multiple arguments',
3060
- fn : () => {
3061
- R.defaultTo(3, ...input)
3062
- },
3063
- },
3064
- ]
3065
- ```
3066
-
3067
- </details>
3068
-
3069
2613
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#defaultTo)
3070
2614
 
3071
2615
  ### difference
@@ -3299,33 +2843,6 @@ describe('R.drop - string', () => {
3299
2843
 
3300
2844
  </details>
3301
2845
 
3302
- <details>
3303
-
3304
- <summary>Rambda is faster than Ramda with 82.35%</summary>
3305
-
3306
- ```text
3307
- const R = require('../../dist/rambda.js')
3308
-
3309
- const input = [ 1, 2, 3, 4 ]
3310
-
3311
- const drop = [
3312
- {
3313
- label : 'Rambda',
3314
- fn : () => {
3315
- R.drop(3, input)
3316
- },
3317
- },
3318
- {
3319
- label : 'Ramda',
3320
- fn : () => {
3321
- Ramda.drop(3, input)
3322
- },
3323
- },
3324
- ]
3325
- ```
3326
-
3327
- </details>
3328
-
3329
2846
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#drop)
3330
2847
 
3331
2848
  ### dropLast
@@ -3443,33 +2960,6 @@ describe('R.dropLast - string', () => {
3443
2960
 
3444
2961
  </details>
3445
2962
 
3446
- <details>
3447
-
3448
- <summary>Rambda is faster than Ramda with 86.74%</summary>
3449
-
3450
- ```text
3451
- const R = require('../../dist/rambda.js')
3452
-
3453
- const input = [ 1, 2, 3, 4 ]
3454
-
3455
- const dropLast = [
3456
- {
3457
- label : 'Rambda',
3458
- fn : () => {
3459
- R.dropLast(3, input)
3460
- },
3461
- },
3462
- {
3463
- label : 'Ramda',
3464
- fn : () => {
3465
- Ramda.dropLast(3, input)
3466
- },
3467
- },
3468
- ]
3469
- ```
3470
-
3471
- </details>
3472
-
3473
2963
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#dropLast)
3474
2964
 
3475
2965
  ### dropLastWhile
@@ -3561,7 +3051,7 @@ describe('brute force', () => {
3561
3051
  firstInput : possibleLists,
3562
3052
  callback : errorsCounters => {
3563
3053
  expect(errorsCounters).toMatchInlineSnapshot(`
3564
- Object {
3054
+ {
3565
3055
  "ERRORS_MESSAGE_MISMATCH": 0,
3566
3056
  "ERRORS_TYPE_MISMATCH": 0,
3567
3057
  "RESULTS_MISMATCH": 1,
@@ -3871,7 +3361,7 @@ describe('brute force', () => {
3871
3361
  secondInput : possibleIterables,
3872
3362
  callback : errorsCounters => {
3873
3363
  expect(errorsCounters).toMatchInlineSnapshot(`
3874
- Object {
3364
+ {
3875
3365
  "ERRORS_MESSAGE_MISMATCH": 0,
3876
3366
  "ERRORS_TYPE_MISMATCH": 0,
3877
3367
  "RESULTS_MISMATCH": 0,
@@ -4047,19 +3537,7 @@ function parseDate(maybeDate){
4047
3537
  function parseRegex(maybeRegex){
4048
3538
  if (maybeRegex.constructor !== RegExp) return [ false ]
4049
3539
 
4050
- return [ true, maybeRegex.toString() ]
4051
- }
4052
-
4053
- function equalsSets(a, b){
4054
- if (a.size !== b.size){
4055
- return false
4056
- }
4057
- const aList = _arrayFromIterator(a.values())
4058
- const bList = _arrayFromIterator(b.values())
4059
-
4060
- const filtered = aList.filter(aInstance => _indexOf(aInstance, bList) === -1)
4061
-
4062
- return filtered.length === 0
3540
+ return [ true, maybeRegex.toString() ]
4063
3541
  }
4064
3542
 
4065
3543
  export function equals(a, b){
@@ -4470,7 +3948,7 @@ describe('brute force', () => {
4470
3948
  secondInput : possibleInputs,
4471
3949
  callback : errorsCounters => {
4472
3950
  expect(errorsCounters).toMatchInlineSnapshot(`
4473
- Object {
3951
+ {
4474
3952
  "ERRORS_MESSAGE_MISMATCH": 0,
4475
3953
  "ERRORS_TYPE_MISMATCH": 0,
4476
3954
  "RESULTS_MISMATCH": 5,
@@ -4514,43 +3992,6 @@ describe('R.equals', () => {
4514
3992
 
4515
3993
  </details>
4516
3994
 
4517
- <details>
4518
-
4519
- <summary>Lodash is fastest. Rambda is 58.37% slower and Ramda is 96.73% slower</summary>
4520
-
4521
- ```text
4522
- const R = require('../../dist/rambda.js')
4523
-
4524
- const limit = 10000
4525
-
4526
- const strings = Array(limit)
4527
- .fill(null)
4528
- .map(() => Math.floor(Math.random() * 1000))
4529
-
4530
- const equals = [
4531
- {
4532
- label : 'Rambda',
4533
- fn : () => {
4534
- strings.forEach(x => R.equals(x, 'ss'))
4535
- },
4536
- },
4537
- {
4538
- label : 'Ramda',
4539
- fn : () => {
4540
- strings.forEach(x => Ramda.equals(x, 'ss'))
4541
- },
4542
- },
4543
- {
4544
- label : 'Lodash',
4545
- fn : () => {
4546
- strings.forEach(x => _.isEqual(x, 'ss'))
4547
- },
4548
- },
4549
- ]
4550
- ```
4551
-
4552
- </details>
4553
-
4554
3995
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#equals)
4555
3996
 
4556
3997
  ### evolve
@@ -4753,7 +4194,7 @@ describe('brute force', () => {
4753
4194
  firstInput : possibleRules,
4754
4195
  callback : errorsCounters => {
4755
4196
  expect(errorsCounters).toMatchInlineSnapshot(`
4756
- Object {
4197
+ {
4757
4198
  "ERRORS_MESSAGE_MISMATCH": 0,
4758
4199
  "ERRORS_TYPE_MISMATCH": 4,
4759
4200
  "RESULTS_MISMATCH": 0,
@@ -5056,39 +4497,6 @@ describe('R.filter with objects', () => {
5056
4497
 
5057
4498
  </details>
5058
4499
 
5059
- <details>
5060
-
5061
- <summary>Lodash is fastest. Rambda is 6.7% slower and Ramda is 72.03% slower</summary>
5062
-
5063
- ```text
5064
- const R = require('../../dist/rambda.js')
5065
-
5066
- const arr = [ 1, 2, 3, 4 ]
5067
- const fn = x => x > 2
5068
- const filter = [
5069
- {
5070
- label : 'Rambda',
5071
- fn : () => {
5072
- R.filter(fn, arr)
5073
- },
5074
- },
5075
- {
5076
- label : 'Ramda',
5077
- fn : () => {
5078
- Ramda.filter(fn, arr)
5079
- },
5080
- },
5081
- {
5082
- label : 'Lodash',
5083
- fn : () => {
5084
- _.filter(arr, fn)
5085
- },
5086
- },
5087
- ]
5088
- ```
5089
-
5090
- </details>
5091
-
5092
4500
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#filter)
5093
4501
 
5094
4502
  ### find
@@ -5191,40 +4599,6 @@ describe('R.find', () => {
5191
4599
 
5192
4600
  </details>
5193
4601
 
5194
- <details>
5195
-
5196
- <summary>Rambda is fastest. Ramda is 85.14% slower and Lodash is 42.65% slower</summary>
5197
-
5198
- ```text
5199
- const R = require('../../dist/rambda.js')
5200
-
5201
- const fn = x => x > 2
5202
- const list = [ 1, 2, 3, 4 ]
5203
-
5204
- const find = [
5205
- {
5206
- label : 'Rambda',
5207
- fn : () => {
5208
- R.find(fn, list)
5209
- },
5210
- },
5211
- {
5212
- label : 'Ramda',
5213
- fn : () => {
5214
- Ramda.find(fn, list)
5215
- },
5216
- },
5217
- {
5218
- label : 'Lodash',
5219
- fn : () => {
5220
- _.find(list, fn)
5221
- },
5222
- },
5223
- ]
5224
- ```
5225
-
5226
- </details>
5227
-
5228
4602
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#find)
5229
4603
 
5230
4604
  ### findIndex
@@ -5320,40 +4694,6 @@ describe('R.findIndex', () => {
5320
4694
 
5321
4695
  </details>
5322
4696
 
5323
- <details>
5324
-
5325
- <summary>Rambda is fastest. Ramda is 86.48% slower and Lodash is 72.27% slower</summary>
5326
-
5327
- ```text
5328
- const R = require('../../dist/rambda.js')
5329
-
5330
- const fn = x => x > 2
5331
- const list = [ 1, 2, 3, 4 ]
5332
-
5333
- const findIndex = [
5334
- {
5335
- label : 'Rambda',
5336
- fn : () => {
5337
- R.findIndex(fn, list)
5338
- },
5339
- },
5340
- {
5341
- label : 'Ramda',
5342
- fn : () => {
5343
- Ramda.findIndex(fn, list)
5344
- },
5345
- },
5346
- {
5347
- label : 'Lodash',
5348
- fn : () => {
5349
- _.findIndex(list, fn)
5350
- },
5351
- },
5352
- ]
5353
- ```
5354
-
5355
- </details>
5356
-
5357
4697
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#findIndex)
5358
4698
 
5359
4699
  ### findLast
@@ -5702,47 +5042,6 @@ describe('flatten', () => {
5702
5042
 
5703
5043
  </details>
5704
5044
 
5705
- <details>
5706
-
5707
- <summary>Lodash is fastest. Rambda is 6.56% slower and Ramda is 86.64% slower</summary>
5708
-
5709
- ```text
5710
- const R = require('../../dist/rambda.js')
5711
-
5712
- const { uniqListOfStrings, applyBenchmarkUnary } = require('./_utils.js')
5713
-
5714
- const modes = [
5715
- [ 1, [ 2, [ 3, 4, 6 ] ] ],
5716
- uniqListOfStrings,
5717
- [],
5718
- [{a:[1,2]}, [], [{a:[1,2]}, []]],
5719
- Array(1000).fill([ 1, [ 2, [ 3, 4, 6 ] ] ]),
5720
- Array(1000).fill([[]]),
5721
- ]
5722
-
5723
- const tests = [
5724
- {
5725
- label : 'Rambda',
5726
- fn : R.flatten,
5727
- },
5728
- {
5729
- label : 'Ramda',
5730
- fn : Ramda.flatten,
5731
- },
5732
- {
5733
- label : 'Lodash',
5734
- fn : _.flattenDeep,
5735
- },
5736
- ]
5737
-
5738
- tests,
5739
- applyBenchmark: applyBenchmarkUnary,
5740
- modes,
5741
- }
5742
- ```
5743
-
5744
- </details>
5745
-
5746
5045
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#flatten)
5747
5046
 
5748
5047
  ### flip
@@ -6534,55 +5833,6 @@ describe('R.ifElse', () => {
6534
5833
 
6535
5834
  </details>
6536
5835
 
6537
- <details>
6538
-
6539
- <summary>Rambda is faster than Ramda with 58.56%</summary>
6540
-
6541
- ```text
6542
- const R = require('../../dist/rambda.js')
6543
-
6544
- const condition = R.has('foo')
6545
- const v = function (a){
6546
- return typeof a === 'number'
6547
- }
6548
- const t = function (a){
6549
- return a + 1
6550
- }
6551
- const ifFn = x => R.prop('foo', x).length
6552
- const elseFn = () => false
6553
-
6554
- const ifElse = [
6555
- {
6556
- label : 'Rambda',
6557
- fn : () => {
6558
- const fn = R.ifElse(condition, ifFn)(elseFn)
6559
-
6560
- fn({ foo : 'bar' })
6561
- fn({ fo : 'bar' })
6562
-
6563
- const ifIsNumber = R.ifElse(v)
6564
- ifIsNumber(t, R.identity)(15)
6565
- ifIsNumber(t, R.identity)('hello')
6566
- },
6567
- },
6568
- {
6569
- label : 'Ramda',
6570
- fn : () => {
6571
- const fn = Ramda.ifElse(condition, ifFn)(elseFn)
6572
-
6573
- fn({ foo : 'bar' })
6574
- fn({ fo : 'bar' })
6575
-
6576
- const ifIsNumber = Ramda.ifElse(v)
6577
- ifIsNumber(t, R.identity)(15)
6578
- ifIsNumber(t, R.identity)('hello')
6579
- },
6580
- },
6581
- ]
6582
- ```
6583
-
6584
- </details>
6585
-
6586
5836
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#ifElse)
6587
5837
 
6588
5838
  ### inc
@@ -6733,68 +5983,6 @@ describe('R.includes', () => {
6733
5983
 
6734
5984
  </details>
6735
5985
 
6736
- <details>
6737
-
6738
- <summary>Rambda is faster than Ramda with 84.63%</summary>
6739
-
6740
- ```text
6741
- const R = require('../../dist/rambda.js')
6742
-
6743
- const {
6744
- uniqListOfStrings,
6745
- uniqListOfBooleans,
6746
- uniqListOfObjects,
6747
- uniqListOfLists,
6748
- listOfVariousTypes,
6749
- rangeOfNumbers,
6750
- } = require('./_utils.js')
6751
-
6752
- const limit = 100
6753
- const additionalModes = listOfVariousTypes.map(unknownType => [
6754
- unknownType,
6755
- uniqListOfLists(limit),
6756
- ])
6757
-
6758
- const modes = [
6759
- [ 99, rangeOfNumbers(limit) ],
6760
- [ 200, rangeOfNumbers(limit) ],
6761
- ...additionalModes,
6762
- [ 'zeppelin', uniqListOfStrings(limit) ],
6763
- [ null, uniqListOfBooleans(limit) ],
6764
- [
6765
- {
6766
- foo : true,
6767
- bar : true,
6768
- },
6769
- uniqListOfObjects(limit),
6770
- ],
6771
- [ 1, uniqListOfLists(limit) ],
6772
- [ [ 1 ], uniqListOfLists(limit) ],
6773
- ]
6774
-
6775
- function applyBenchmark(fn, input){
6776
- return fn(input[ 0 ], input[ 1 ])
6777
- }
6778
-
6779
- const tests = [
6780
- {
6781
- label : 'Rambda',
6782
- fn : R.includes,
6783
- },
6784
- {
6785
- label : 'Ramda',
6786
- fn : Ramda.includes,
6787
- },
6788
- ]
6789
-
6790
- tests,
6791
- modes,
6792
- applyBenchmark,
6793
- }
6794
- ```
6795
-
6796
- </details>
6797
-
6798
5986
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#includes)
6799
5987
 
6800
5988
  ### indexBy
@@ -6914,39 +6102,6 @@ describe('R.init', () => {
6914
6102
 
6915
6103
  </details>
6916
6104
 
6917
- <details>
6918
-
6919
- <summary>Rambda is fastest. Ramda is 92.24% slower and Lodash is 13.3% slower</summary>
6920
-
6921
- ```text
6922
- const R = require('../../dist/rambda.js')
6923
-
6924
- const list = [ 1, 2, 3, 4 ]
6925
-
6926
- const init = [
6927
- {
6928
- label : 'Rambda',
6929
- fn : () => {
6930
- R.init(list)
6931
- },
6932
- },
6933
- {
6934
- label : 'Ramda',
6935
- fn : () => {
6936
- Ramda.init(list)
6937
- },
6938
- },
6939
- {
6940
- label : 'Lodash',
6941
- fn : () => {
6942
- _.initial(list)
6943
- },
6944
- },
6945
- ]
6946
- ```
6947
-
6948
- </details>
6949
-
6950
6105
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#init)
6951
6106
 
6952
6107
  ### intersection
@@ -7063,70 +6218,6 @@ describe('R.isEmpty', () => {
7063
6218
 
7064
6219
  </details>
7065
6220
 
7066
- <details>
7067
-
7068
- <summary>Rambda is fastest. Ramda is 97.14% slower and Lodash is 54.99% slower</summary>
7069
-
7070
- ```text
7071
- const R = require('../../dist/rambda.js')
7072
-
7073
- const isEmpty = [
7074
- {
7075
- label : 'Rambda',
7076
- fn : () => {
7077
- R.isEmpty(undefined)
7078
- R.isEmpty('')
7079
- R.isEmpty(null)
7080
- R.isEmpty(' ')
7081
- R.isEmpty(new RegExp(''))
7082
- R.isEmpty([])
7083
- R.isEmpty([ [] ])
7084
- R.isEmpty({})
7085
- R.isEmpty({ x : 0 })
7086
- R.isEmpty(0)
7087
- R.isEmpty(NaN)
7088
- R.isEmpty([ '' ])
7089
- },
7090
- },
7091
- {
7092
- label : 'Ramda',
7093
- fn : () => {
7094
- Ramda.isEmpty(undefined)
7095
- Ramda.isEmpty('')
7096
- Ramda.isEmpty(null)
7097
- Ramda.isEmpty(' ')
7098
- Ramda.isEmpty(new RegExp(''))
7099
- Ramda.isEmpty([])
7100
- Ramda.isEmpty([ [] ])
7101
- Ramda.isEmpty({})
7102
- Ramda.isEmpty({ x : 0 })
7103
- Ramda.isEmpty(0)
7104
- Ramda.isEmpty(NaN)
7105
- Ramda.isEmpty([ '' ])
7106
- },
7107
- },
7108
- {
7109
- label : 'Lodash',
7110
- fn : () => {
7111
- _.isEmpty(undefined)
7112
- _.isEmpty('')
7113
- _.isEmpty(null)
7114
- _.isEmpty(' ')
7115
- _.isEmpty(new RegExp(''))
7116
- _.isEmpty([])
7117
- _.isEmpty([ [] ])
7118
- _.isEmpty({})
7119
- _.isEmpty({ x : 0 })
7120
- _.isEmpty(0)
7121
- _.isEmpty(NaN)
7122
- _.isEmpty([ '' ])
7123
- },
7124
- },
7125
- ]
7126
- ```
7127
-
7128
- </details>
7129
-
7130
6221
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#isEmpty)
7131
6222
 
7132
6223
  ### isNil
@@ -7493,39 +6584,6 @@ describe('R.last', () => {
7493
6584
 
7494
6585
  </details>
7495
6586
 
7496
- <details>
7497
-
7498
- <summary>Rambda is fastest. Ramda is 93.43% slower and Lodash is 5.28% slower</summary>
7499
-
7500
- ```text
7501
- const R = require('../../dist/rambda.js')
7502
-
7503
- const list = [ 1, 2, 3, 4 ]
7504
-
7505
- const last = [
7506
- {
7507
- label : 'Rambda',
7508
- fn : () => {
7509
- R.last(list)
7510
- },
7511
- },
7512
- {
7513
- label : 'Ramda',
7514
- fn : () => {
7515
- Ramda.last(list)
7516
- },
7517
- },
7518
- {
7519
- label : 'Lodash',
7520
- fn : () => {
7521
- _.last(list)
7522
- },
7523
- },
7524
- ]
7525
- ```
7526
-
7527
- </details>
7528
-
7529
6587
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#last)
7530
6588
 
7531
6589
  ### lastIndexOf
@@ -7624,7 +6682,7 @@ describe('brute force', () => {
7624
6682
  secondInput : possibleIterables,
7625
6683
  callback : errorsCounters => {
7626
6684
  expect(errorsCounters).toMatchInlineSnapshot(`
7627
- Object {
6685
+ {
7628
6686
  "ERRORS_MESSAGE_MISMATCH": 0,
7629
6687
  "ERRORS_TYPE_MISMATCH": 34,
7630
6688
  "RESULTS_MISMATCH": 0,
@@ -7663,36 +6721,6 @@ describe('R.lastIndexOf', () => {
7663
6721
 
7664
6722
  </details>
7665
6723
 
7666
- <details>
7667
-
7668
- <summary>Rambda is faster than Ramda with 85.19%</summary>
7669
-
7670
- ```text
7671
- const R = require('../../dist/rambda.js')
7672
-
7673
- const isEven = n => n % 2 === 0
7674
- const arr = [ 1, 3, 5, 7, 9, 11 ]
7675
-
7676
- const lastIndexOf = [
7677
- {
7678
- label : 'Rambda',
7679
- fn : () => {
7680
- R.lastIndexOf(1, [ 1, 2, 3, 1, 2 ])
7681
- R.lastIndexOf(1)([ 1, 2, 3, 1, 2 ])
7682
- },
7683
- },
7684
- {
7685
- label : 'Ramda',
7686
- fn : () => {
7687
- Ramda.lastIndexOf(1, [ 1, 2, 3, 1, 2 ])
7688
- Ramda.lastIndexOf(1)([ 1, 2, 3, 1, 2 ])
7689
- },
7690
- },
7691
- ]
7692
- ```
7693
-
7694
- </details>
7695
-
7696
6724
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#lastIndexOf)
7697
6725
 
7698
6726
  ### length
@@ -8390,6 +7418,7 @@ map<T>(fn: Iterator<T, T>, iterable: T[]): T[];
8390
7418
  <summary><strong>R.map</strong> source</summary>
8391
7419
 
8392
7420
  ```javascript
7421
+ import { INCORRECT_ITERABLE_INPUT } from './_internals/constants.js'
8393
7422
  import { isArray } from './_internals/isArray.js'
8394
7423
  import { keys } from './_internals/keys.js'
8395
7424
 
@@ -8449,74 +7478,63 @@ export function map(fn, iterable){
8449
7478
  <summary><strong>Tests</strong></summary>
8450
7479
 
8451
7480
  ```javascript
8452
- import { map as mapRamda } from "ramda";
7481
+ import { map as mapRamda } from 'ramda'
8453
7482
 
8454
- import { map } from "./map.js";
7483
+ import { map } from './map.js'
8455
7484
 
8456
- const double = (x) => x * 2;
7485
+ const double = x => x * 2
8457
7486
 
8458
- describe("with array", () => {
8459
- it("happy", () => {
8460
- expect(map(double, [1, 2, 3])).toEqual([2, 4, 6]);
8461
- });
7487
+ describe('with array', () => {
7488
+ it('happy', () => {
7489
+ expect(map(double, [ 1, 2, 3 ])).toEqual([ 2, 4, 6 ])
7490
+ })
8462
7491
 
8463
- it("curried", () => {
8464
- expect(map(double)([1, 2, 3])).toEqual([2, 4, 6]);
8465
- });
8466
- });
7492
+ it('curried', () => {
7493
+ expect(map(double)([ 1, 2, 3 ])).toEqual([ 2, 4, 6 ])
7494
+ })
7495
+ })
8467
7496
 
8468
- describe("with object", () => {
7497
+ describe('with object', () => {
8469
7498
  const obj = {
8470
- a: 1,
8471
- b: 2,
8472
- };
7499
+ a : 1,
7500
+ b : 2,
7501
+ }
8473
7502
 
8474
- it("happy", () => {
7503
+ it('happy', () => {
8475
7504
  expect(map(double, obj)).toEqual({
8476
- a: 2,
8477
- b: 4,
8478
- });
8479
- });
7505
+ a : 2,
7506
+ b : 4,
7507
+ })
7508
+ })
8480
7509
 
8481
- it("property as second and input object as third argument", () => {
7510
+ it('property as second and input object as third argument', () => {
8482
7511
  const obj = {
8483
- a: 1,
8484
- b: 2,
8485
- };
8486
- const iterator = (val, prop, inputObject) => {
8487
- expect(prop).toBeString();
8488
- expect(inputObject).toEqual(obj);
7512
+ a : 1,
7513
+ b : 2,
7514
+ }
7515
+ const iterator = (
7516
+ val, prop, inputObject
7517
+ ) => {
7518
+ expect(prop).toBeString()
7519
+ expect(inputObject).toEqual(obj)
8489
7520
 
8490
- return val * 2;
8491
- };
7521
+ return val * 2
7522
+ }
8492
7523
 
8493
7524
  expect(map(iterator)(obj)).toEqual({
8494
- a: 2,
8495
- b: 4,
8496
- });
8497
- });
8498
- });
8499
-
8500
- test("bad inputs difference between Ramda and Rambda", () => {
8501
- expect(() => map(double, null)).toThrowErrorMatchingInlineSnapshot(
8502
- '"Incorrect iterable input"',
8503
- "undefined",
8504
- "undefined",
8505
- `undefined`
8506
- );
8507
- expect(() => map(double)(undefined)).toThrowErrorMatchingInlineSnapshot(
8508
- '"Incorrect iterable input"',
8509
- "undefined",
8510
- "undefined",
8511
- `undefined`
8512
- );
8513
- expect(() => mapRamda(double, null)).toThrowErrorMatchingInlineSnapshot(
8514
- "\"Cannot read properties of null (reading 'fantasy-land/map')\""
8515
- );
8516
- expect(() => mapRamda(double, undefined)).toThrowErrorMatchingInlineSnapshot(
8517
- "\"Cannot read properties of undefined (reading 'fantasy-land/map')\""
8518
- );
8519
- });
7525
+ a : 2,
7526
+ b : 4,
7527
+ })
7528
+ })
7529
+ })
7530
+
7531
+ test('bad inputs difference between Ramda and Rambda', () => {
7532
+ expect(() => map(double, null)).toThrowErrorMatchingInlineSnapshot('"Incorrect iterable input"')
7533
+ expect(() => map(double)(undefined)).toThrowErrorMatchingInlineSnapshot('"Incorrect iterable input"')
7534
+ expect(() => mapRamda(double, null)).toThrowErrorMatchingInlineSnapshot('"Cannot read properties of null (reading \'fantasy-land/map\')"')
7535
+ expect(() =>
7536
+ mapRamda(double, undefined)).toThrowErrorMatchingInlineSnapshot('"Cannot read properties of undefined (reading \'fantasy-land/map\')"')
7537
+ })
8520
7538
  ```
8521
7539
 
8522
7540
  </details>
@@ -8607,48 +7625,84 @@ describe('R.map with objects', () => {
8607
7625
  })
8608
7626
  ```
8609
7627
 
8610
- </details>
7628
+ </details>
7629
+
7630
+ [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#map)
7631
+
7632
+ ### mapObjIndexed
7633
+
7634
+ ```typescript
7635
+
7636
+ mapObjIndexed<T>(fn: ObjectIterator<T, T>, iterable: Dictionary<T>): Dictionary<T>
7637
+ ```
7638
+
7639
+ It works the same way as `R.map` does for objects. It is added as Ramda also has this method.
8611
7640
 
8612
- <details>
7641
+ <a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20fn%20%3D%20(val%2C%20prop)%20%3D%3E%20%7B%0A%20%20return%20%60%24%7Bprop%7D-%24%7Bval%7D%60%0A%7D%0A%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20R.map(mapObjIndexed%2C%20Record%3Cstring%2C%20unknown%3E)%0A%2F%2F%20%3D%3E%20%7Ba%3A%20'a-1'%2C%20b%3A%20'b-2'%7D">Try this <strong>R.mapObjIndexed</strong> example in Rambda REPL</a>
8613
7642
 
8614
- <summary>Rambda is fastest. Ramda is 86.6% slower and Lodash is 11.73% slower</summary>
7643
+ <details>
8615
7644
 
8616
- ```text
8617
- const R = require('../../dist/rambda.js')
7645
+ <summary>All Typescript definitions</summary>
8618
7646
 
8619
- const arr = [ 1, 2, 3, 4 ]
8620
- const fn = x => x * 2
8621
- const map = [
8622
- {
8623
- label : 'Rambda',
8624
- fn : () => {
8625
- R.map(fn, arr)
8626
- },
8627
- },
8628
- {
8629
- label : 'Ramda',
8630
- fn : () => {
8631
- Ramda.map(fn, arr)
8632
- },
8633
- },
8634
- {
8635
- label : 'Lodash',
8636
- fn : () => {
8637
- _.map(arr, fn)
8638
- },
8639
- },
8640
- ]
7647
+ ```typescript
7648
+ mapObjIndexed<T>(fn: ObjectIterator<T, T>, iterable: Dictionary<T>): Dictionary<T>;
7649
+ mapObjIndexed<T, U>(fn: ObjectIterator<T, U>, iterable: Dictionary<T>): Dictionary<U>;
7650
+ mapObjIndexed<T>(fn: ObjectIterator<T, T>): (iterable: Dictionary<T>) => Dictionary<T>;
7651
+ mapObjIndexed<T, U>(fn: ObjectIterator<T, U>): (iterable: Dictionary<T>) => Dictionary<U>;
8641
7652
  ```
8642
7653
 
8643
7654
  </details>
8644
7655
 
8645
- [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#map)
7656
+ <details>
8646
7657
 
8647
- ### mapObjIndexed
7658
+ <summary><strong>Typescript</strong> test</summary>
8648
7659
 
8649
- It works the same way as `R.map` does for objects. It is added as Ramda also has this method.
7660
+ ```typescript
7661
+ import {mapObjIndexed} from 'rambda'
8650
7662
 
8651
- <a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20fn%20%3D%20(val%2C%20prop)%20%3D%3E%20%7B%0A%20%20return%20%60%24%7Bprop%7D-%24%7Bval%7D%60%0A%7D%0A%0Aconst%20obj%20%3D%20%7Ba%3A%201%2C%20b%3A%202%7D%0A%0Aconst%20result%20%3D%20R.map(mapObjIndexed%2C%20Record%3Cstring%2C%20unknown%3E)%0A%2F%2F%20%3D%3E%20%7Ba%3A%20'a-1'%2C%20b%3A%20'b-2'%7D">Try this <strong>R.mapObjIndexed</strong> example in Rambda REPL</a>
7663
+ const obj = {a: 1, b: 2, c: 3}
7664
+
7665
+ describe('R.mapObjIndexed', () => {
7666
+ it('without type transform', () => {
7667
+ const result = mapObjIndexed((x, prop, obj) => {
7668
+ x // $ExpectType number
7669
+ prop // $ExpectType string
7670
+ obj // $ExpectType Dictionary<number>
7671
+ return x + 2
7672
+ }, obj)
7673
+ result // $ExpectType Dictionary<number>
7674
+ })
7675
+ it('without type transform - curried', () => {
7676
+ const result = mapObjIndexed<number>((x, prop, obj) => {
7677
+ x // $ExpectType number
7678
+ prop // $ExpectType string
7679
+ obj // $ExpectType Dictionary<number>
7680
+ return x + 2
7681
+ })(obj)
7682
+ result // $ExpectType Dictionary<number>
7683
+ })
7684
+ it('change of type', () => {
7685
+ const result = mapObjIndexed((x, prop, obj) => {
7686
+ x // $ExpectType number
7687
+ prop // $ExpectType string
7688
+ obj // $ExpectType Dictionary<number>
7689
+ return String(x + 2)
7690
+ }, obj)
7691
+ result // $ExpectType Dictionary<string>
7692
+ })
7693
+ it('change of type - curried', () => {
7694
+ const result = mapObjIndexed<number, string>((x, prop, obj) => {
7695
+ x // $ExpectType number
7696
+ prop // $ExpectType string
7697
+ obj // $ExpectType Dictionary<number>
7698
+ return String(x + 2)
7699
+ })(obj)
7700
+ result // $ExpectType Dictionary<string>
7701
+ })
7702
+ })
7703
+ ```
7704
+
7705
+ </details>
8652
7706
 
8653
7707
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#mapObjIndexed)
8654
7708
 
@@ -8743,33 +7797,6 @@ describe('R.match', () => {
8743
7797
 
8744
7798
  </details>
8745
7799
 
8746
- <details>
8747
-
8748
- <summary>Rambda is faster than Ramda with 44.83%</summary>
8749
-
8750
- ```text
8751
- const R = require('../../dist/rambda.js')
8752
-
8753
- const match = [
8754
- {
8755
- label : 'Rambda',
8756
- fn : () => {
8757
- R.match(/a./g)('foo bar baz')
8758
- R.match(/a./g, 'foo bar baz')
8759
- },
8760
- },
8761
- {
8762
- label : 'Ramda',
8763
- fn : () => {
8764
- Ramda.match(/a./g)('foo bar baz')
8765
- Ramda.match(/a./g, 'foo bar baz')
8766
- },
8767
- },
8768
- ]
8769
- ```
8770
-
8771
- </details>
8772
-
8773
7800
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#match)
8774
7801
 
8775
7802
  ### mathMod
@@ -8957,71 +7984,8 @@ describe('R.median', () => {
8957
7984
 
8958
7985
  ### merge
8959
7986
 
8960
- ```typescript
8961
-
8962
- merge<A, B>(target: A, newProps: B): A & B
8963
- export function merge<Output>(target: any): (newProps: any) => Output
8964
- ```
8965
-
8966
7987
  Same as `R.mergeRight`.
8967
7988
 
8968
- <details>
8969
-
8970
- <summary>All Typescript definitions</summary>
8971
-
8972
- ```typescript
8973
- merge<A, B>(target: A, newProps: B): A & B
8974
- merge<Output>(target: any): (newProps: any) => Output;
8975
- ```
8976
-
8977
- </details>
8978
-
8979
- <details>
8980
-
8981
- <summary><strong>R.merge</strong> source</summary>
8982
-
8983
- ```javascript
8984
- export { mergeRight as merge } from './mergeRight.js'
8985
- ```
8986
-
8987
- </details>
8988
-
8989
- <details>
8990
-
8991
- <summary>Rambda is fastest. Ramda is 12.21% slower and Lodash is 55.76% slower</summary>
8992
-
8993
- ```text
8994
- const R = require('../../dist/rambda.js')
8995
-
8996
- const obj = { bar : 'yes' }
8997
- const a = {
8998
- foo : 'bar',
8999
- bar : 'baz',
9000
- }
9001
- const merge = [
9002
- {
9003
- label : 'Rambda',
9004
- fn : () => {
9005
- R.merge(a, obj)
9006
- },
9007
- },
9008
- {
9009
- label : 'Ramda',
9010
- fn : () => {
9011
- Ramda.merge(a, obj)
9012
- },
9013
- },
9014
- {
9015
- label : 'Lodash',
9016
- fn : () => {
9017
- _.merge(a, obj)
9018
- },
9019
- },
9020
- ]
9021
- ```
9022
-
9023
- </details>
9024
-
9025
7989
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#merge)
9026
7990
 
9027
7991
  ### mergeAll
@@ -9292,9 +8256,9 @@ test('ramda compatible test 3', () => {
9292
8256
  expect(result).toEqual(expected)
9293
8257
  })
9294
8258
 
9295
- test('functions are discarded', () => {
8259
+ test('functions are not discarded', () => {
9296
8260
  const obj = { foo : () => {} }
9297
- expect(mergeDeepRight(obj, {})).toEqual({})
8261
+ expect(typeof mergeDeepRight(obj, {}).foo).toBe('function')
9298
8262
  })
9299
8263
  ```
9300
8264
 
@@ -9742,7 +8706,7 @@ describe('brute force', () => {
9742
8706
  thirdInput : possibleObjects,
9743
8707
  callback : errorsCounters => {
9744
8708
  expect(errorsCounters).toMatchInlineSnapshot(`
9745
- Object {
8709
+ {
9746
8710
  "ERRORS_MESSAGE_MISMATCH": 0,
9747
8711
  "ERRORS_TYPE_MISMATCH": 0,
9748
8712
  "RESULTS_MISMATCH": 0,
@@ -10024,37 +8988,71 @@ describe('R.none', () => {
10024
8988
 
10025
8989
  </details>
10026
8990
 
8991
+ [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#none)
8992
+
8993
+ ### nop
8994
+
8995
+ ```typescript
8996
+
8997
+ nop(): void
8998
+ ```
8999
+
9000
+ It returns `undefined`.
9001
+
9002
+ <a title="redirect to Rambda Repl site" href="https://rambda.now.sh?const%20result%20%3D%20R.nop()%0A%2F%2F%20%3D%3E%20undefined">Try this <strong>R.nop</strong> example in Rambda REPL</a>
9003
+
10027
9004
  <details>
10028
9005
 
10029
- <summary>Rambda is faster than Ramda with 96.48%</summary>
9006
+ <summary>All Typescript definitions</summary>
10030
9007
 
10031
- ```text
10032
- const R = require('../../dist/rambda.js')
9008
+ ```typescript
9009
+ nop(): void;
9010
+ ```
10033
9011
 
10034
- const isEven = n => n % 2 === 0
10035
- const arr = [ 1, 3, 5, 7, 9, 11 ]
9012
+ </details>
10036
9013
 
10037
- const none = [
10038
- {
10039
- label : 'Rambda',
10040
- fn : () => {
10041
- R.none(isEven, arr)
10042
- R.none(isEven)(arr)
10043
- },
10044
- },
10045
- {
10046
- label : 'Ramda',
10047
- fn : () => {
10048
- Ramda.none(isEven, arr)
10049
- Ramda.none(isEven)(arr)
10050
- },
10051
- },
10052
- ]
9014
+ <details>
9015
+
9016
+ <summary><strong>R.nop</strong> source</summary>
9017
+
9018
+ ```javascript
9019
+ export function nop(){}
10053
9020
  ```
10054
9021
 
10055
9022
  </details>
10056
9023
 
10057
- [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#none)
9024
+ <details>
9025
+
9026
+ <summary><strong>Tests</strong></summary>
9027
+
9028
+ ```javascript
9029
+ import { nop } from './nop.js'
9030
+
9031
+ test('call', () => {
9032
+ expect(nop).not.toThrow()
9033
+ })
9034
+ ```
9035
+
9036
+ </details>
9037
+
9038
+ <details>
9039
+
9040
+ <summary><strong>Typescript</strong> test</summary>
9041
+
9042
+ ```typescript
9043
+ import {nop} from 'rambda'
9044
+
9045
+ describe('R.nop', () => {
9046
+ it('call', () => {
9047
+ const result = nop()
9048
+ result // $ExpectType void
9049
+ })
9050
+ })
9051
+ ```
9052
+
9053
+ </details>
9054
+
9055
+ [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#nop)
10058
9056
 
10059
9057
  ### not
10060
9058
 
@@ -10301,7 +9299,7 @@ test('happy', () => {
10301
9299
  <summary><strong>Typescript</strong> test</summary>
10302
9300
 
10303
9301
  ```typescript
10304
- import {of} from 'ramda'
9302
+ import {of} from 'rambda'
10305
9303
 
10306
9304
  const list = [1, 2, 3]
10307
9305
 
@@ -10512,43 +9510,6 @@ describe('R.omit with string as props input', () => {
10512
9510
 
10513
9511
  </details>
10514
9512
 
10515
- <details>
10516
-
10517
- <summary>Rambda is fastest. Ramda is 69.95% slower and Lodash is 97.34% slower</summary>
10518
-
10519
- ```text
10520
- const R = require('../../dist/rambda.js')
10521
-
10522
- const obj = {
10523
- a : 'foo',
10524
- b : 'bar',
10525
- c : 'baz',
10526
- }
10527
- const toOmit = [ 'a', 'c' ]
10528
- const omit = [
10529
- {
10530
- label : 'Rambda',
10531
- fn : () => {
10532
- R.omit(toOmit, obj)
10533
- },
10534
- },
10535
- {
10536
- label : 'Ramda',
10537
- fn : () => {
10538
- Ramda.omit(toOmit, obj)
10539
- },
10540
- },
10541
- {
10542
- label : 'Lodash',
10543
- fn : () => {
10544
- _.omit(obj, toOmit)
10545
- },
10546
- },
10547
- ]
10548
- ```
10549
-
10550
- </details>
10551
-
10552
9513
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#omit)
10553
9514
 
10554
9515
  ### on
@@ -10787,37 +9748,6 @@ test('index lens', () => {
10787
9748
 
10788
9749
  </details>
10789
9750
 
10790
- <details>
10791
-
10792
- <summary>Rambda is faster than Ramda with 56.23%</summary>
10793
-
10794
- ```text
10795
- const R = require('../../dist/rambda.js')
10796
-
10797
- const testObj = { a : 1 }
10798
-
10799
- const last = [
10800
- {
10801
- label : 'Rambda',
10802
- fn : () => {
10803
- R.over(
10804
- R.lensProp('a'), R.inc, testObj
10805
- )
10806
- },
10807
- },
10808
- {
10809
- label : 'Ramda',
10810
- fn : () => {
10811
- Ramda.over(
10812
- Ramda.lensProp('a'), Ramda.inc, testObj
10813
- )
10814
- },
10815
- },
10816
- ]
10817
- ```
10818
-
10819
- </details>
10820
-
10821
9751
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#over)
10822
9752
 
10823
9753
  ### partial
@@ -11351,7 +10281,7 @@ describe('R.partition', () => {
11351
10281
 
11352
10282
  ```typescript
11353
10283
 
11354
- path<Input, T>(pathToSearch: Path, obj: Input): T | undefined
10284
+ path<S, K0 extends keyof S = keyof S>(path: [K0], obj: S): S[K0]
11355
10285
  ```
11356
10286
 
11357
10287
  If `pathToSearch` is `'a.b'` then it will return `1` if `obj` is `{a:{b:1}}`.
@@ -11365,10 +10295,41 @@ It will return `undefined`, if such path is not found.
11365
10295
  <summary>All Typescript definitions</summary>
11366
10296
 
11367
10297
  ```typescript
11368
- path<Input, T>(pathToSearch: Path, obj: Input): T | undefined;
11369
- path<T>(pathToSearch: Path, obj: any): T | undefined;
11370
- path<T>(pathToSearch: Path): (obj: any) => T | undefined;
11371
- path<Input, T>(pathToSearch: Path): (obj: Input) => T | undefined;
10298
+ path<S, K0 extends keyof S = keyof S>(path: [K0], obj: S): S[K0];
10299
+ path<S, K0 extends keyof S = keyof S, K1 extends keyof S[K0] = keyof S[K0]>(path: [K0, K1], obj: S): S[K0][K1];
10300
+ path<
10301
+ S,
10302
+ K0 extends keyof S = keyof S,
10303
+ K1 extends keyof S[K0] = keyof S[K0],
10304
+ K2 extends keyof S[K0][K1] = keyof S[K0][K1]
10305
+ >(path: [K0, K1, K2], obj: S): S[K0][K1][K2];
10306
+ path<
10307
+ S,
10308
+ K0 extends keyof S = keyof S,
10309
+ K1 extends keyof S[K0] = keyof S[K0],
10310
+ K2 extends keyof S[K0][K1] = keyof S[K0][K1],
10311
+ K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],
10312
+ >(path: [K0, K1, K2, K3], obj: S): S[K0][K1][K2][K3];
10313
+ path<
10314
+ S,
10315
+ K0 extends keyof S = keyof S,
10316
+ K1 extends keyof S[K0] = keyof S[K0],
10317
+ K2 extends keyof S[K0][K1] = keyof S[K0][K1],
10318
+ K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],
10319
+ K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3],
10320
+ >(path: [K0, K1, K2, K3, K4], obj: S): S[K0][K1][K2][K3][K4];
10321
+ path<
10322
+ S,
10323
+ K0 extends keyof S = keyof S,
10324
+ K1 extends keyof S[K0] = keyof S[K0],
10325
+ K2 extends keyof S[K0][K1] = keyof S[K0][K1],
10326
+ K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],
10327
+ K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3],
10328
+ K5 extends keyof S[K0][K1][K2][K3][K4] = keyof S[K0][K1][K2][K3][K4],
10329
+ >(path: [K0, K1, K2, K3, K4, K5], obj: S): S[K0][K1][K2][K3][K4][K5];
10330
+ path<T>(pathToSearch: string, obj: any): T | undefined;
10331
+ path<T>(pathToSearch: string): (obj: any) => T | undefined;
10332
+ path<T>(pathToSearch: RamdaPath): (obj: any) => T | undefined;
11372
10333
  ```
11373
10334
 
11374
10335
  </details>
@@ -11457,100 +10418,45 @@ test('null is not a valid path', () => {
11457
10418
  ```typescript
11458
10419
  import {path} from 'rambda'
11459
10420
 
11460
- interface Input {
11461
- a: number,
11462
- b: {
11463
- c: boolean,
11464
- },
11465
- }
11466
-
11467
- describe('R.path', () => {
11468
- it('without specified input type', () => {
11469
- const input = {a: 1, b: {c: true}}
11470
- const result = path<boolean>('a.b.c', input)
11471
- const curriedResult = path<boolean>('a.b.c')(input)
11472
- result // $ExpectType boolean | undefined
11473
- curriedResult // $ExpectType boolean | undefined
11474
- })
10421
+ const input = {a: {b: {c: true}}}
11475
10422
 
10423
+ describe('R.path with string as path', () => {
11476
10424
  it('without specified output type', () => {
11477
- const input = {a: 1, b: {c: true}}
11478
- const result = path('a.b.c', input)
11479
- result // $ExpectType unknown
11480
- })
11481
-
11482
- it('with string as path', () => {
11483
- const input: Input = {a: 1, b: {c: true}}
11484
- const resultA = path<boolean>('a.b.c', input)
11485
- const resultB = path<boolean>('a.b.c')(input)
11486
- resultA // $ExpectType boolean | undefined
11487
- resultB // $ExpectType boolean | undefined
10425
+ // $ExpectType unknown
10426
+ path('a.b.c', input)
10427
+ // $ExpectType unknown
10428
+ path('a.b.c')(input)
11488
10429
  })
11489
- it('with array as path', () => {
11490
- const input: Input = {a: 1, b: {c: true}}
11491
- const resultA = path<boolean>(['a', 'b', 'c'], input)
11492
- const resultB = path<boolean>(['a', 'b', 'c'])(input)
11493
- resultA // $ExpectType boolean | undefined
11494
- resultB // $ExpectType boolean | undefined
10430
+ it('with specified output type', () => {
10431
+ // $ExpectType boolean | undefined
10432
+ path<boolean>('a.b.c', input)
10433
+ // $ExpectType boolean | undefined
10434
+ path<boolean>('a.b.c')(input)
11495
10435
  })
11496
10436
  })
11497
10437
 
11498
- describe('path with specified input', () => {
11499
- it('with string as path', () => {
11500
- const input: Input = {a: 1, b: {c: true}}
11501
- // const wrongInput = { a: 1, b: true }
11502
- // const resultA = path<Input, boolean>('a.b.c', wrongInput)
11503
- const resultA = path<Input, boolean>('a.b.c', input)
11504
- const resultB = path<Input, boolean>('a.b.c')(input)
11505
- resultA // $ExpectType boolean | undefined
11506
- resultB // $ExpectType boolean | undefined
11507
- })
10438
+ describe('R.path with list as path', () => {
11508
10439
  it('with array as path', () => {
11509
- const input: Input = {a: 1, b: {c: true}}
11510
- const resultA = path<Input, boolean>(['a', 'b', 'c'], input)
11511
- const resultB = path<Input, boolean>(['a', 'b', 'c'])(input)
11512
- resultA // $ExpectType boolean | undefined
11513
- resultB // $ExpectType boolean | undefined
10440
+ // $ExpectType boolean
10441
+ path(['a', 'b', 'c'], input)
10442
+ // $ExpectType unknown
10443
+ path(['a', 'b', 'c'])(input)
10444
+ })
10445
+ test('shallow property', () => {
10446
+ // $ExpectType number
10447
+ path(['a'], {a: 1})
10448
+
10449
+ path(['b'], {a: 1}) // $ExpectError
10450
+ })
10451
+ test('deep property', () => {
10452
+ // $ExpectType number
10453
+ path(['a', 'b', 'c', 'd', 'e', 'f'], {a: {b: {c: {d: {e: {f: 1}}}}}})
11514
10454
  })
11515
10455
  })
11516
10456
  ```
11517
10457
 
11518
10458
  </details>
11519
10459
 
11520
- <details>
11521
-
11522
- <summary>Lodash is fastest. Rambda is 37.81% slower and Ramda is 77.81% slower</summary>
11523
-
11524
- ```text
11525
- const R = require('../../dist/rambda.js')
11526
-
11527
- const obj = { a : { b : 2 } }
11528
- const pathInput = [ 'a', 'b' ]
11529
-
11530
- const path = [
11531
- {
11532
- label : 'Rambda',
11533
- fn : () => {
11534
- R.path(pathInput, obj)
11535
- },
11536
- },
11537
- {
11538
- label : 'Ramda',
11539
- fn : () => {
11540
- Ramda.path(pathInput, obj)
11541
- },
11542
- },
11543
- {
11544
- label : 'Lodash',
11545
- fn : () => {
11546
- _.get(obj, pathInput)
11547
- },
11548
- },
11549
- ]
11550
- ```
11551
-
11552
- </details>
11553
-
11554
10460
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#path)
11555
10461
 
11556
10462
  ### pathEq
@@ -12106,7 +11012,7 @@ test('works with list as input and number as props - props to pick is a string',
12106
11012
  test('with symbol', () => {
12107
11013
  const symbolProp = Symbol('s')
12108
11014
  expect(pick([ symbolProp ], { [ symbolProp ] : 'a' })).toMatchInlineSnapshot(`
12109
- Object {
11015
+ {
12110
11016
  Symbol(s): "a",
12111
11017
  }
12112
11018
  `)
@@ -12165,47 +11071,10 @@ describe('R.pick with string as props input', () => {
12165
11071
  })
12166
11072
 
12167
11073
  it('without passing type', () => {
12168
- const result = pick('a,c', input)
12169
- result // $ExpectType unknown
12170
- })
12171
- })
12172
- ```
12173
-
12174
- </details>
12175
-
12176
- <details>
12177
-
12178
- <summary>Rambda is fastest. Ramda is 19.07% slower and Lodash is 80.2% slower</summary>
12179
-
12180
- ```text
12181
- const R = require('../../dist/rambda.js')
12182
-
12183
- const obj = {
12184
- a : 'foo',
12185
- b : 'bar',
12186
- c : 'baz',
12187
- }
12188
- const pickInput = [ 'a', 'c' ]
12189
- const pick = [
12190
- {
12191
- label : 'Rambda',
12192
- fn : () => {
12193
- R.pick(pickInput, obj)
12194
- },
12195
- },
12196
- {
12197
- label : 'Ramda',
12198
- fn : () => {
12199
- Ramda.pick(pickInput, obj)
12200
- },
12201
- },
12202
- {
12203
- label : 'Lodash',
12204
- fn : () => {
12205
- _.pick(obj, pickInput)
12206
- },
12207
- },
12208
- ]
11074
+ const result = pick('a,c', input)
11075
+ result // $ExpectType unknown
11076
+ })
11077
+ })
12209
11078
  ```
12210
11079
 
12211
11080
  </details>
@@ -12216,7 +11085,7 @@ const pick = [
12216
11085
 
12217
11086
  ```typescript
12218
11087
 
12219
- pickAll<T, U>(propsToPick: string[], input: T): U
11088
+ pickAll<T, K extends keyof T>(propsToPicks: K[], input: T): Pick<T, K>
12220
11089
  ```
12221
11090
 
12222
11091
  Same as `R.pick` but it won't skip the missing props, i.e. it will assign them to `undefined`.
@@ -12228,8 +11097,9 @@ Same as `R.pick` but it won't skip the missing props, i.e. it will assign them t
12228
11097
  <summary>All Typescript definitions</summary>
12229
11098
 
12230
11099
  ```typescript
12231
- pickAll<T, U>(propsToPick: string[], input: T): U;
12232
- pickAll<T, U>(propsToPick: string[]): (input: T) => U;
11100
+ pickAll<T, K extends keyof T>(propsToPicks: K[], input: T): Pick<T, K>;
11101
+ pickAll<T, U>(propsToPicks: string[], input: T): U;
11102
+ pickAll(propsToPicks: string[]): <T, U>(input: T) => U;
12233
11103
  pickAll<T, U>(propsToPick: string, input: T): U;
12234
11104
  pickAll<T, U>(propsToPick: string): (input: T) => U;
12235
11105
  ```
@@ -12334,7 +11204,8 @@ const input = {a: 'foo', b: 2, c: 3, d: 4}
12334
11204
  describe('R.pickAll with array as props input', () => {
12335
11205
  it('without passing type', () => {
12336
11206
  const result = pickAll(['a', 'c'], input)
12337
- result // $ExpectType unknown
11207
+ result.a // $ExpectType string
11208
+ result.c // $ExpectType number
12338
11209
  })
12339
11210
  it('without passing type + curry', () => {
12340
11211
  const result = pickAll(['a', 'c'])(input)
@@ -12345,11 +11216,6 @@ describe('R.pickAll with array as props input', () => {
12345
11216
  result.a // $ExpectType string | undefined
12346
11217
  result.c // $ExpectType number | undefined
12347
11218
  })
12348
- it('explicitly passing types + curry', () => {
12349
- const result = pickAll<Input, Output>(['a', 'c'])(input)
12350
- result.a // $ExpectType string | undefined
12351
- result.c // $ExpectType number | undefined
12352
- })
12353
11219
  })
12354
11220
 
12355
11221
  describe('R.pickAll with string as props input', () => {
@@ -12665,7 +11531,7 @@ describe('R.product', () => {
12665
11531
 
12666
11532
  ```typescript
12667
11533
 
12668
- prop<P extends keyof O, O>(propToFind: P, obj: O): O[P]
11534
+ prop<P extends keyof never, T>(propToFind: P, value: T): Prop<T, P>
12669
11535
  ```
12670
11536
 
12671
11537
  It returns the value of property `propToFind` in `obj`.
@@ -12679,10 +11545,17 @@ If there is no such property, it returns `undefined`.
12679
11545
  <summary>All Typescript definitions</summary>
12680
11546
 
12681
11547
  ```typescript
12682
- prop<P extends keyof O, O>(propToFind: P, obj: O): O[P];
12683
- prop<P extends keyof O, O>(propToFind: P): (obj: O) => O[P];
12684
- prop<P extends string | number>(propToFind: P): <T>(obj: Record<P, T>) => T;
12685
- prop<P extends string | number, T>(propToFind: P): (obj: Record<P, T>) => T;
11548
+ prop<P extends keyof never, T>(propToFind: P, value: T): Prop<T, P>;
11549
+ prop<P extends keyof never>(propToFind: P): {
11550
+ <T>(value: Record<P, T>): T;
11551
+ <T>(value: T): Prop<T, P>;
11552
+ };
11553
+ prop<P extends keyof T, T>(propToFind: P): {
11554
+ (value: T): Prop<T, P>;
11555
+ };
11556
+ prop<P extends keyof never, T>(propToFind: P): {
11557
+ (value: Record<P, T>): T;
11558
+ };
12686
11559
  ```
12687
11560
 
12688
11561
  </details>
@@ -12730,7 +11603,10 @@ import {pipe, prop} from 'rambda'
12730
11603
 
12731
11604
  describe('R.prop', () => {
12732
11605
  const obj = {a: 1, b: 'foo'}
12733
- interface Something {a?: number, b?: string}
11606
+ interface Something {
11607
+ a?: number,
11608
+ b?: string,
11609
+ }
12734
11610
 
12735
11611
  it('issue #553', () => {
12736
11612
  const result = prop('e', {e: 'test1', d: 'test2'})
@@ -12757,7 +11633,7 @@ describe('R.prop', () => {
12757
11633
  it('curried with implicit object type', () => {
12758
11634
  const result = pipe(value => value as Something, prop('b'))(obj)
12759
11635
 
12760
- result // $ExpectType string | undefined
11636
+ result // $ExpectType undefined
12761
11637
  })
12762
11638
  it('curried with explicit result type', () => {
12763
11639
  const result = prop<'b', string>('b')(obj)
@@ -12784,39 +11660,6 @@ describe('with number as prop', () => {
12784
11660
 
12785
11661
  </details>
12786
11662
 
12787
- <details>
12788
-
12789
- <summary>Rambda is faster than Ramda with 87.95%</summary>
12790
-
12791
- ```text
12792
- const R = require('../../dist/rambda.js')
12793
-
12794
- const obj = {
12795
- a : { c : 2 },
12796
- b : 1,
12797
- }
12798
- const propInput = 'b'
12799
-
12800
- const prop = [
12801
- {
12802
- label : 'Rambda',
12803
- fn : () => {
12804
- R.prop(propInput, obj)
12805
- R.prop(propInput)(obj)
12806
- },
12807
- },
12808
- {
12809
- label : 'Ramda',
12810
- fn : () => {
12811
- Ramda.prop(propInput, obj)
12812
- Ramda.prop(propInput)(obj)
12813
- },
12814
- },
12815
- ]
12816
- ```
12817
-
12818
- </details>
12819
-
12820
11663
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#prop)
12821
11664
 
12822
11665
  ### propEq
@@ -12952,50 +11795,6 @@ describe('R.propEq', () => {
12952
11795
 
12953
11796
  </details>
12954
11797
 
12955
- <details>
12956
-
12957
- <summary>Rambda is faster than Ramda with 91.92%</summary>
12958
-
12959
- ```text
12960
- const R = require('../../dist/rambda.js')
12961
-
12962
- const obj = {
12963
- a : { c : 2 },
12964
- b : 1,
12965
- }
12966
- const propInput = 'b'
12967
- const expected = { c : 2 }
12968
-
12969
- const propEq = [
12970
- {
12971
- label : 'Rambda',
12972
- fn : () => {
12973
- R.propEq('a')(expected)(obj)
12974
-
12975
- R.propEq('a', expected)(obj)
12976
-
12977
- R.propEq(
12978
- 'a', expected, obj
12979
- )
12980
- },
12981
- },
12982
- {
12983
- label : 'Ramda',
12984
- fn : () => {
12985
- Ramda.propEq('a')(expected)(obj)
12986
-
12987
- Ramda.propEq('a', expected)(obj)
12988
-
12989
- Ramda.propEq(
12990
- 'a', expected, obj
12991
- )
12992
- },
12993
- },
12994
- ]
12995
- ```
12996
-
12997
- </details>
12998
-
12999
11798
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#propEq)
13000
11799
 
13001
11800
  ### propIs
@@ -13511,39 +12310,6 @@ describe('R.range', () => {
13511
12310
 
13512
12311
  </details>
13513
12312
 
13514
- <details>
13515
-
13516
- <summary>Rambda is fastest. Ramda is 61.8% slower and Lodash is 57.44% slower</summary>
13517
-
13518
- ```text
13519
- const R = require('../../dist/rambda.js')
13520
-
13521
- const start = 12
13522
- const end = 22
13523
- const range = [
13524
- {
13525
- label : 'Rambda',
13526
- fn : () => {
13527
- R.range(start, end)
13528
- },
13529
- },
13530
- {
13531
- label : 'Ramda',
13532
- fn : () => {
13533
- Ramda.range(start, end)
13534
- },
13535
- },
13536
- {
13537
- label : 'Lodash',
13538
- fn : () => {
13539
- _.range(start, end)
13540
- },
13541
- },
13542
- ]
13543
- ```
13544
-
13545
- </details>
13546
-
13547
12313
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#range)
13548
12314
 
13549
12315
  ### reduce
@@ -13754,40 +12520,6 @@ describe('R.repeat', () => {
13754
12520
 
13755
12521
  </details>
13756
12522
 
13757
- <details>
13758
-
13759
- <summary>Lodash is fastest. Rambda is 48.57% slower and Ramda is 68.98% slower</summary>
13760
-
13761
- ```text
13762
- const R = require('../../dist/rambda.js')
13763
-
13764
- const num = 10
13765
- const str = 'foo'
13766
-
13767
- const repeat = [
13768
- {
13769
- label : 'Rambda',
13770
- fn : () => {
13771
- R.repeat(str, num)
13772
- },
13773
- },
13774
- {
13775
- label : 'Ramda',
13776
- fn : () => {
13777
- Ramda.repeat(str, num)
13778
- },
13779
- },
13780
- {
13781
- label : 'Lodash',
13782
- fn : () => {
13783
- _.repeat(str, num)
13784
- },
13785
- },
13786
- ]
13787
- ```
13788
-
13789
- </details>
13790
-
13791
12523
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#repeat)
13792
12524
 
13793
12525
  ### replace
@@ -13898,43 +12630,6 @@ describe('R.replace - curried', () => {
13898
12630
 
13899
12631
  </details>
13900
12632
 
13901
- <details>
13902
-
13903
- <summary>Lodash is fastest. Rambda is 33.45% slower and Ramda is 33.99% slower</summary>
13904
-
13905
- ```text
13906
- const R = require('../../dist/rambda.js')
13907
-
13908
- const replace = [
13909
- {
13910
- label : 'Rambda',
13911
- fn : () => {
13912
- R.replace(
13913
- /\s/g, '|', 'foo bar baz'
13914
- )
13915
- },
13916
- },
13917
- {
13918
- label : 'Ramda',
13919
- fn : () => {
13920
- Ramda.replace(
13921
- /\s/g, '|', 'foo bar baz'
13922
- )
13923
- },
13924
- },
13925
- {
13926
- label : 'Lodash',
13927
- fn : () => {
13928
- _.replace(
13929
- 'foo bar baz', /\s/g, '|'
13930
- )
13931
- },
13932
- },
13933
- ]
13934
- ```
13935
-
13936
- </details>
13937
-
13938
12633
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#replace)
13939
12634
 
13940
12635
  ### reverse
@@ -14129,37 +12824,6 @@ test('index lens', () => {
14129
12824
 
14130
12825
  </details>
14131
12826
 
14132
- <details>
14133
-
14134
- <summary>Rambda is faster than Ramda with 50.35%</summary>
14135
-
14136
- ```text
14137
- const R = require('../../dist/rambda.js')
14138
-
14139
- const testObj = { a : 1 }
14140
-
14141
- const last = [
14142
- {
14143
- label : 'Rambda',
14144
- fn : () => {
14145
- R.set(
14146
- R.lensProp('a'), 2, testObj
14147
- )
14148
- },
14149
- },
14150
- {
14151
- label : 'Ramda',
14152
- fn : () => {
14153
- Ramda.set(
14154
- Ramda.lensProp('a'), 2, testObj
14155
- )
14156
- },
14157
- },
14158
- ]
14159
- ```
14160
-
14161
- </details>
14162
-
14163
12827
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#set)
14164
12828
 
14165
12829
  ### slice
@@ -14352,36 +13016,6 @@ describe('R.sort', () => {
14352
13016
 
14353
13017
  </details>
14354
13018
 
14355
- <details>
14356
-
14357
- <summary>Rambda is faster than Ramda with 40.23%</summary>
14358
-
14359
- ```text
14360
- const R = require('../../dist/rambda.js')
14361
-
14362
- const list = [ 'foo', 'bar', 'baz' ]
14363
- const fn = (a, b) => a > b ? -1 : 1
14364
-
14365
- const replace = [
14366
- {
14367
- label : 'Rambda',
14368
- fn : () => {
14369
- R.sort(fn, list)
14370
- R.sort(fn)(list)
14371
- },
14372
- },
14373
- {
14374
- label : 'Ramda',
14375
- fn : () => {
14376
- Ramda.sort(fn, list)
14377
- Ramda.sort(fn)(list)
14378
- },
14379
- },
14380
- ]
14381
- ```
14382
-
14383
- </details>
14384
-
14385
13019
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#sort)
14386
13020
 
14387
13021
  ### sortBy
@@ -14528,40 +13162,6 @@ describe('R.sortBy', () => {
14528
13162
 
14529
13163
  </details>
14530
13164
 
14531
- <details>
14532
-
14533
- <summary>Rambda is fastest. Ramda is 25.29% slower and Lodash is 56.88% slower</summary>
14534
-
14535
- ```text
14536
- const R = require('../../dist/rambda.js')
14537
-
14538
- const list = [ { a : 2 }, { a : 1 }, { a : 0 } ]
14539
- const fn = x => x.a
14540
-
14541
- const replace = [
14542
- {
14543
- label : 'Rambda',
14544
- fn : () => {
14545
- R.sortBy(fn, list)
14546
- },
14547
- },
14548
- {
14549
- label : 'Ramda',
14550
- fn : () => {
14551
- Ramda.sortBy(fn, list)
14552
- },
14553
- },
14554
- {
14555
- label : 'Lodash',
14556
- fn : () => {
14557
- _.sortBy(list, fn)
14558
- },
14559
- },
14560
- ]
14561
- ```
14562
-
14563
- </details>
14564
-
14565
13165
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#sortBy)
14566
13166
 
14567
13167
  ### split
@@ -14648,40 +13248,6 @@ describe('R.split', () => {
14648
13248
 
14649
13249
  </details>
14650
13250
 
14651
- <details>
14652
-
14653
- <summary>Rambda is fastest. Ramda is 55.37% slower and Lodash is 17.64% slower</summary>
14654
-
14655
- ```text
14656
- const R = require('../../dist/rambda.js')
14657
-
14658
- const str = 'foo|bar|baz'
14659
- const sep = '|'
14660
-
14661
- const split = [
14662
- {
14663
- label : 'Rambda',
14664
- fn : () => {
14665
- R.split(sep, str)
14666
- },
14667
- },
14668
- {
14669
- label : 'Ramda',
14670
- fn : () => {
14671
- Ramda.split(sep, str)
14672
- },
14673
- },
14674
- {
14675
- label : 'Lodash',
14676
- fn : () => {
14677
- _.split(str, sep)
14678
- },
14679
- },
14680
- ]
14681
- ```
14682
-
14683
- </details>
14684
-
14685
13251
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#split)
14686
13252
 
14687
13253
  ### splitAt
@@ -14813,7 +13379,7 @@ test('with bad inputs', () => {
14813
13379
  <summary><strong>Typescript</strong> test</summary>
14814
13380
 
14815
13381
  ```typescript
14816
- import {splitAt} from 'ramda'
13382
+ import {splitAt} from 'rambda'
14817
13383
 
14818
13384
  const index = 1
14819
13385
  const str = 'foo'
@@ -14953,33 +13519,6 @@ describe('R.splitEvery', () => {
14953
13519
 
14954
13520
  </details>
14955
13521
 
14956
- <details>
14957
-
14958
- <summary>Rambda is faster than Ramda with 71.98%</summary>
14959
-
14960
- ```text
14961
- const R = require('../../dist/rambda.js')
14962
-
14963
- const list = [ 1, 2, 3, 4, 5, 6, 7 ]
14964
-
14965
- const splitEvery = [
14966
- {
14967
- label : 'Rambda',
14968
- fn : () => {
14969
- R.splitEvery(3, list)
14970
- },
14971
- },
14972
- {
14973
- label : 'Ramda',
14974
- fn : () => {
14975
- Ramda.splitEvery(3, list)
14976
- },
14977
- },
14978
- ]
14979
- ```
14980
-
14981
- </details>
14982
-
14983
13522
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#splitEvery)
14984
13523
 
14985
13524
  ### splitWhen
@@ -15201,7 +13740,7 @@ describe('brute force', () => {
15201
13740
  secondInput : possibleIterables,
15202
13741
  callback : errorsCounters => {
15203
13742
  expect(errorsCounters).toMatchInlineSnapshot(`
15204
- Object {
13743
+ {
15205
13744
  "ERRORS_MESSAGE_MISMATCH": 0,
15206
13745
  "ERRORS_TYPE_MISMATCH": 0,
15207
13746
  "RESULTS_MISMATCH": 0,
@@ -15658,40 +14197,6 @@ describe('R.take - string', () => {
15658
14197
 
15659
14198
  </details>
15660
14199
 
15661
- <details>
15662
-
15663
- <summary>Rambda is fastest. Ramda is 91.96% slower and Lodash is 4.72% slower</summary>
15664
-
15665
- ```text
15666
- const R = require('../../dist/rambda.js')
15667
-
15668
- const list = [ 1, 2, 3, 4 ]
15669
- const num = 2
15670
-
15671
- const take = [
15672
- {
15673
- label : 'Rambda',
15674
- fn : () => {
15675
- R.take(num, list)
15676
- },
15677
- },
15678
- {
15679
- label : 'Ramda',
15680
- fn : () => {
15681
- Ramda.take(num, list)
15682
- },
15683
- },
15684
- {
15685
- label : 'Lodash',
15686
- fn : () => {
15687
- _.take(list, num)
15688
- },
15689
- },
15690
- ]
15691
- ```
15692
-
15693
- </details>
15694
-
15695
14200
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#take)
15696
14201
 
15697
14202
  ### takeLast
@@ -15808,49 +14313,15 @@ describe('R.takeLast - array', () => {
15808
14313
  describe('R.takeLast - string', () => {
15809
14314
  it('happy', () => {
15810
14315
  const result = takeLast(howMany, str)
15811
-
15812
- result // $ExpectType string
15813
- })
15814
- it('curried', () => {
15815
- const result = takeLast(howMany)(str)
15816
-
15817
- result // $ExpectType string
15818
- })
15819
- })
15820
- ```
15821
-
15822
- </details>
15823
-
15824
- <details>
15825
-
15826
- <summary>Rambda is fastest. Ramda is 93.39% slower and Lodash is 19.22% slower</summary>
15827
-
15828
- ```text
15829
- const R = require('../../dist/rambda.js')
15830
-
15831
- const list = [ 1, 2, 3, 4 ]
15832
- const num = 2
15833
-
15834
- const takeLast = [
15835
- {
15836
- label : 'Rambda',
15837
- fn : () => {
15838
- R.takeLast(num, list)
15839
- },
15840
- },
15841
- {
15842
- label : 'Ramda',
15843
- fn : () => {
15844
- Ramda.takeLast(num, list)
15845
- },
15846
- },
15847
- {
15848
- label : 'Lodash',
15849
- fn : () => {
15850
- _.takeRight(list, num)
15851
- },
15852
- },
15853
- ]
14316
+
14317
+ result // $ExpectType string
14318
+ })
14319
+ it('curried', () => {
14320
+ const result = takeLast(howMany)(str)
14321
+
14322
+ result // $ExpectType string
14323
+ })
14324
+ })
15854
14325
  ```
15855
14326
 
15856
14327
  </details>
@@ -16103,7 +14574,7 @@ export function test(pattern, str){
16103
14574
  if (arguments.length === 1) return _str => test(pattern, _str)
16104
14575
 
16105
14576
  if (typeof pattern === 'string'){
16106
- throw new TypeError(`‘test requires a value of type RegExp as its first argument; received "${ pattern }"`)
14577
+ throw new TypeError(`R.test requires a value of type RegExp as its first argument; received "${ pattern }"`)
16107
14578
  }
16108
14579
 
16109
14580
  return str.search(pattern) !== -1
@@ -16126,7 +14597,7 @@ test('happy', () => {
16126
14597
  })
16127
14598
 
16128
14599
  test('throws if first argument is not regex', () => {
16129
- expect(() => testMethod('foo', 'bar')).toThrowErrorMatchingInlineSnapshot('"test requires a value of type RegExp as its first argument; received \\"foo\\""')
14600
+ expect(() => testMethod('foo', 'bar')).toThrowErrorMatchingInlineSnapshot('"R.test requires a value of type RegExp as its first argument; received "foo""')
16130
14601
  })
16131
14602
  ```
16132
14603
 
@@ -16158,33 +14629,6 @@ describe('R.test', () => {
16158
14629
 
16159
14630
  </details>
16160
14631
 
16161
- <details>
16162
-
16163
- <summary>Rambda is faster than Ramda with 82.34%</summary>
16164
-
16165
- ```text
16166
- const R = require('../../dist/rambda.js')
16167
-
16168
- const test = [
16169
- {
16170
- label : 'Rambda',
16171
- fn : () => {
16172
- R.test(/\s/g, 'x y z')
16173
- R.test(/\s/g)('x y z')
16174
- },
16175
- },
16176
- {
16177
- label : 'Ramda',
16178
- fn : () => {
16179
- Ramda.test(/\s/g, 'x y z')
16180
- Ramda.test(/\s/g)('x y z')
16181
- },
16182
- },
16183
- ]
16184
- ```
16185
-
16186
- </details>
16187
-
16188
14632
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#test)
16189
14633
 
16190
14634
  ### times
@@ -16681,277 +15125,10 @@ It returns function that runs `fn` in `try/catch` block. If there was an error,
16681
15125
 
16682
15126
  ### type
16683
15127
 
16684
- ```typescript
16685
-
16686
- type(x: any): RambdaTypes
16687
- ```
16688
-
16689
15128
  It accepts any input and it returns its type.
16690
15129
 
16691
15130
  <a title="redirect to Rambda Repl site" href="https://rambda.now.sh?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>
16692
15131
 
16693
- <details>
16694
-
16695
- <summary>All Typescript definitions</summary>
16696
-
16697
- ```typescript
16698
- type(x: any): RambdaTypes;
16699
- ```
16700
-
16701
- </details>
16702
-
16703
- <details>
16704
-
16705
- <summary><strong>R.type</strong> source</summary>
16706
-
16707
- ```javascript
16708
- export function type(input){
16709
- if (input === null){
16710
- return 'Null'
16711
- } else if (input === undefined){
16712
- return 'Undefined'
16713
- } else if (Number.isNaN(input)){
16714
- return 'NaN'
16715
- }
16716
- const typeResult = Object.prototype.toString.call(input).slice(8, -1)
16717
-
16718
- return typeResult === 'AsyncFunction' ? 'Promise' : typeResult
16719
- }
16720
- ```
16721
-
16722
- </details>
16723
-
16724
- <details>
16725
-
16726
- <summary><strong>Tests</strong></summary>
16727
-
16728
- ```javascript
16729
- import { type as typeRamda } from 'ramda'
16730
-
16731
- import { type } from './type.js'
16732
-
16733
- test('with buffer', () => {
16734
- expect(type(new Buffer.from('foo'))).toBe('Uint8Array')
16735
- })
16736
-
16737
- test('with array buffer', () => {
16738
- expect(type(new ArrayBuffer(8))).toBe('ArrayBuffer')
16739
- })
16740
-
16741
- test('with big int', () => {
16742
- expect(type(BigInt(9007199254740991))).toBe('BigInt')
16743
- })
16744
-
16745
- test('with generators', () => {
16746
- function* generator(){
16747
- yield 1
16748
- yield 2
16749
- yield 3
16750
- }
16751
-
16752
- const gen = generator()
16753
- expect(type(generator)).toBe('GeneratorFunction')
16754
- expect(type(gen)).toBe('Generator')
16755
- })
16756
-
16757
- test('with infinity', () => {
16758
- expect(type(Infinity)).toBe('Number')
16759
- })
16760
-
16761
- test('with weak map', () => {
16762
- expect(type(new WeakMap())).toBe('WeakMap')
16763
- })
16764
-
16765
- test('with map', () => {
16766
- expect(type(new Map())).toBe('Map')
16767
- })
16768
-
16769
- test('with symbol', () => {
16770
- expect(type(Symbol())).toBe('Symbol')
16771
- })
16772
-
16773
- test('with simple promise', () => {
16774
- expect(type(Promise.resolve(1))).toBe('Promise')
16775
- })
16776
-
16777
- test('with new Boolean', () => {
16778
- expect(type(new Boolean(true))).toBe('Boolean')
16779
- })
16780
-
16781
- test('with new String', () => {
16782
- expect(type(new String('I am a String object'))).toBe('String')
16783
- })
16784
-
16785
- test('with new Number', () => {
16786
- expect(type(new Number(1))).toBe('Number')
16787
- })
16788
-
16789
- test('with error', () => {
16790
- expect(type(Error('foo'))).toBe('Error')
16791
- expect(typeRamda(Error('foo'))).toBe('Error')
16792
- })
16793
-
16794
- test('with error - wrong @types/ramda test', () => {
16795
- // @types/ramda expect the result to be 'Error' but it is not
16796
- class ExtendedError extends Error{}
16797
- expect(type(ExtendedError)).toBe('Function')
16798
- expect(typeRamda(ExtendedError)).toBe('Function')
16799
- })
16800
-
16801
- test('with new promise', () => {
16802
- const delay = ms =>
16803
- new Promise(resolve => {
16804
- setTimeout(() => {
16805
- resolve(ms + 110)
16806
- }, ms)
16807
- })
16808
-
16809
- expect(type(delay(10))).toBe('Promise')
16810
- })
16811
-
16812
- test('async function', () => {
16813
- expect(type(async () => {})).toBe('Promise')
16814
- })
16815
-
16816
- test('async arrow', () => {
16817
- const asyncArrow = async () => {}
16818
- expect(type(asyncArrow)).toBe('Promise')
16819
- })
16820
-
16821
- test('function', () => {
16822
- const fn1 = () => {}
16823
- const fn2 = function (){}
16824
-
16825
- function fn3(){}
16826
-
16827
- ;[ () => {}, fn1, fn2, fn3 ].map(val => {
16828
- expect(type(val)).toBe('Function')
16829
- })
16830
- })
16831
-
16832
- test('object', () => {
16833
- expect(type({})).toBe('Object')
16834
- })
16835
-
16836
- test('number', () => {
16837
- expect(type(1)).toBe('Number')
16838
- })
16839
-
16840
- test('boolean', () => {
16841
- expect(type(false)).toBe('Boolean')
16842
- })
16843
-
16844
- test('string', () => {
16845
- expect(type('foo')).toBe('String')
16846
- })
16847
-
16848
- test('null', () => {
16849
- expect(type(null)).toBe('Null')
16850
- })
16851
-
16852
- test('array', () => {
16853
- expect(type([])).toBe('Array')
16854
- expect(type([ 1, 2, 3 ])).toBe('Array')
16855
- })
16856
-
16857
- test('regex', () => {
16858
- expect(type(/\s/g)).toBe('RegExp')
16859
- })
16860
-
16861
- test('undefined', () => {
16862
- expect(type(undefined)).toBe('Undefined')
16863
- })
16864
-
16865
- test('not a number', () => {
16866
- expect(type(Number('s'))).toBe('NaN')
16867
- })
16868
-
16869
- test('set', () => {
16870
- const exampleSet = new Set([ 1, 2, 3 ])
16871
- expect(type(exampleSet)).toBe('Set')
16872
- expect(typeRamda(exampleSet)).toBe('Set')
16873
- })
16874
-
16875
- test('function inside object 1', () => {
16876
- const obj = {
16877
- f(){
16878
- return 4
16879
- },
16880
- }
16881
-
16882
- expect(type(obj.f)).toBe('Function')
16883
- expect(typeRamda(obj.f)).toBe('Function')
16884
- })
16885
-
16886
- test('function inside object 2', () => {
16887
- const name = 'f'
16888
- const obj = {
16889
- [ name ](){
16890
- return 4
16891
- },
16892
- }
16893
- expect(type(obj.f)).toBe('Function')
16894
- expect(typeRamda(obj.f)).toBe('Function')
16895
- })
16896
- ```
16897
-
16898
- </details>
16899
-
16900
- <details>
16901
-
16902
- <summary><strong>Typescript</strong> test</summary>
16903
-
16904
- ```typescript
16905
- import {type} from 'rambda'
16906
-
16907
- describe('R.type', () => {
16908
- it('happy', () => {
16909
- const result = type(4)
16910
-
16911
- result // $ExpectType RambdaTypes
16912
- })
16913
- })
16914
- ```
16915
-
16916
- </details>
16917
-
16918
- <details>
16919
-
16920
- <summary>Rambda is faster than Ramda with 48.6%</summary>
16921
-
16922
- ```text
16923
- const R = require('../../dist/rambda.js')
16924
-
16925
- const { listOfVariousTypes } = require('./_utils')
16926
-
16927
- const limit = 1000
16928
-
16929
- function applyBenchmark(fn){
16930
- listOfVariousTypes.forEach(mode => {
16931
- Array(limit)
16932
- .fill(mode)
16933
- .forEach(x => fn(x))
16934
- })
16935
- }
16936
-
16937
- const test = [
16938
- {
16939
- label : 'Rambda',
16940
- fn : () => {
16941
- applyBenchmark(R.type)
16942
- },
16943
- },
16944
- {
16945
- label : 'Ramda',
16946
- fn : () => {
16947
- applyBenchmark(Ramda.type)
16948
- },
16949
- },
16950
- ]
16951
- ```
16952
-
16953
- </details>
16954
-
16955
15132
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#type)
16956
15133
 
16957
15134
  ### unapply
@@ -17335,54 +15512,6 @@ describe('R.uniq', () => {
17335
15512
 
17336
15513
  </details>
17337
15514
 
17338
- <details>
17339
-
17340
- <summary>Rambda is faster than Ramda with 90.24%</summary>
17341
-
17342
- ```text
17343
- const R = require('../../dist/rambda.js')
17344
-
17345
- const {
17346
- uniqListOfStrings,
17347
- uniqListOfBooleans,
17348
- uniqListOfNumbers,
17349
- uniqListOfLists,
17350
- uniqListOfObjects,
17351
- } = require('./_utils.js')
17352
-
17353
- const limit = 100
17354
-
17355
- const modes = [
17356
- uniqListOfStrings(limit),
17357
- uniqListOfBooleans(limit),
17358
- uniqListOfNumbers(limit),
17359
- uniqListOfLists(limit),
17360
- uniqListOfObjects(limit),
17361
- ]
17362
-
17363
- function applyBenchmark(fn, input){
17364
- fn(input)
17365
- }
17366
-
17367
- const tests = [
17368
- {
17369
- label : 'Rambda',
17370
- fn : R.uniq,
17371
- },
17372
- {
17373
- label : 'Ramda',
17374
- fn : Ramda.uniq,
17375
- },
17376
- ]
17377
-
17378
- tests,
17379
- modes,
17380
- applyBenchmark,
17381
- }
17382
- ```
17383
-
17384
- </details>
17385
-
17386
15515
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#uniq)
17387
15516
 
17388
15517
  ### uniqBy
@@ -17510,57 +15639,6 @@ describe('R.uniqWith', () => {
17510
15639
 
17511
15640
  </details>
17512
15641
 
17513
- <details>
17514
-
17515
- <summary>Rambda is slower than Ramda with 18.09%</summary>
17516
-
17517
- ```text
17518
- const R = require('../../dist/rambda.js')
17519
-
17520
- const {
17521
- uniqListOfStrings,
17522
- uniqListOfBooleans,
17523
- uniqListOfNumbers,
17524
- uniqListOfLists,
17525
- uniqListOfObjects,
17526
- } = require('./_utils.js')
17527
-
17528
- const limit = 100
17529
-
17530
- const modes = [
17531
- [ uniqListOfStrings(limit), (x, y) => x.length === y.length ],
17532
- [ uniqListOfBooleans(limit), (x, y) => x === y ],
17533
- [ uniqListOfNumbers(limit), (x, y) => x > y ],
17534
- [ uniqListOfLists(limit), (x, y) => x.length === y.length ],
17535
- [
17536
- uniqListOfObjects(limit),
17537
- x => (x, y) => Object.keys(x).length === Object.keys(y).length,
17538
- ],
17539
- ]
17540
-
17541
- function applyBenchmark(fn, input){
17542
- return fn(input[ 1 ], input[ 0 ])
17543
- }
17544
-
17545
- const tests = [
17546
- {
17547
- label : 'Rambda',
17548
- fn : R.uniqWith,
17549
- },
17550
- {
17551
- label : 'Ramda',
17552
- fn : Ramda.uniqWith,
17553
- },
17554
- ]
17555
-
17556
- modes,
17557
- tests,
17558
- applyBenchmark,
17559
- }
17560
- ```
17561
-
17562
- </details>
17563
-
17564
15642
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#uniqWith)
17565
15643
 
17566
15644
  ### unless
@@ -17838,43 +15916,6 @@ describe('R.update', () => {
17838
15916
 
17839
15917
  </details>
17840
15918
 
17841
- <details>
17842
-
17843
- <summary>Rambda is faster than Ramda with 52.35%</summary>
17844
-
17845
- ```text
17846
- const R = require('../../dist/rambda.js')
17847
-
17848
- const list = [ 0, 1, 2 ]
17849
- const index = 1
17850
- const replacer = 7
17851
-
17852
- const update = [
17853
- {
17854
- label : 'Rambda',
17855
- fn : () => {
17856
- R.update(
17857
- replacer, index, list
17858
- )
17859
- R.update(replacer, index)(list)
17860
- R.update(replacer)(index)(list)
17861
- },
17862
- },
17863
- {
17864
- label : 'Ramda',
17865
- fn : () => {
17866
- Ramda.update(
17867
- replacer, index, list
17868
- )
17869
- Ramda.update(replacer, index)(list)
17870
- Ramda.update(replacer)(index)(list)
17871
- },
17872
- },
17873
- ]
17874
- ```
17875
-
17876
- </details>
17877
-
17878
15919
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#update)
17879
15920
 
17880
15921
  ### values
@@ -18057,33 +16098,6 @@ describe('R.view', () => {
18057
16098
 
18058
16099
  </details>
18059
16100
 
18060
- <details>
18061
-
18062
- <summary>Rambda is faster than Ramda with 76.15%</summary>
18063
-
18064
- ```text
18065
- const R = require('../../dist/rambda.js')
18066
-
18067
- const testObj = { a : 1 }
18068
-
18069
- const last = [
18070
- {
18071
- label : 'Rambda',
18072
- fn : () => {
18073
- R.view(R.lensProp('a'), testObj)
18074
- },
18075
- },
18076
- {
18077
- label : 'Ramda',
18078
- fn : () => {
18079
- Ramda.view(Ramda.lensProp('a'), testObj)
18080
- },
18081
- },
18082
- ]
18083
- ```
18084
-
18085
- </details>
18086
-
18087
16101
  [![---------------](https://raw.githubusercontent.com/selfrefactor/rambda/master/files/separator.png)](#view)
18088
16102
 
18089
16103
  ### when
@@ -18995,8 +17009,18 @@ describe('R.zipWith', () => {
18995
17009
 
18996
17010
  ## ❯ CHANGELOG
18997
17011
 
17012
+ 7.4.0
17013
+
17014
+ - Synchronize with `@types/ramda` - `R.prop`, `R.path`, `R.pickAll`
17015
+
17016
+ - Remove `esm` Rollup output due to tree-shaking issues.
17017
+
17018
+ - Upgrade all dev dependencies.
17019
+
18998
17020
  7.3.0
18999
17021
 
17022
+ - Important - changing import declaration in `package.json` in order to fix tree-shaking issue - [Issue #647](https://github.com/selfrefactor/rambda/issues/647)
17023
+
19000
17024
  - Add `R.modify`
19001
17025
 
19002
17026
  - Allow multiple inputs in Typescript versions of `R.anyPass` and `R.allPass` - [Issue #642](https://github.com/selfrefactor/rambda/issues/604)
@@ -19306,4 +17330,8 @@ Fix wrong versions in changelog
19306
17330
  </td>
19307
17331
  </tr>
19308
17332
  </tbody>
19309
- </table>
17333
+ </table>
17334
+
17335
+ ## Stargazers over time
17336
+
17337
+ [![Stargazers over time](https://starchart.cc/selfrefactor/rambda.svg)](https://starchart.cc/selfrefactor/rambda)