rubico 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AggregateReducer.d.ts +10 -0
- package/Transducer.d.ts +231 -0
- package/__.d.ts +2 -0
- package/_internal/EmptyMap.d.ts +2 -0
- package/_internal/arrayFind.d.ts +15 -0
- package/_internal/asyncIteratorFind.d.ts +12 -0
- package/_internal/iteratorFind.d.ts +12 -0
- package/_internal/thunkify5.d.ts +20 -0
- package/_internal/timeInLoop.d.ts +25 -0
- package/_internal/timeInLoopAsync.d.ts +23 -0
- package/all.d.ts +100 -0
- package/always.d.ts +2 -0
- package/and.d.ts +45 -0
- package/assign.d.ts +46 -0
- package/compose.d.ts +25 -0
- package/curry.d.ts +70 -0
- package/dist/Transducer.es.js +1 -1
- package/dist/Transducer.es.min.js +1 -1
- package/dist/Transducer.js +1 -1
- package/dist/Transducer.min.js +1 -1
- package/dist/Transducer.mjs +1 -1
- package/dist/__.es.js +1 -1
- package/dist/__.es.min.js +1 -1
- package/dist/__.js +1 -1
- package/dist/__.min.js +1 -1
- package/dist/__.mjs +1 -1
- package/dist/all.es.js +1 -1
- package/dist/all.es.min.js +1 -1
- package/dist/all.js +1 -1
- package/dist/all.min.js +1 -1
- package/dist/all.mjs +1 -1
- package/dist/always.es.js +1 -1
- package/dist/always.es.min.js +1 -1
- package/dist/always.js +1 -1
- package/dist/always.min.js +1 -1
- package/dist/always.mjs +1 -1
- package/dist/and.es.js +1 -1
- package/dist/and.es.min.js +1 -1
- package/dist/and.js +1 -1
- package/dist/and.min.js +1 -1
- package/dist/and.mjs +1 -1
- package/dist/assign.es.js +1 -1
- package/dist/assign.es.min.js +1 -1
- package/dist/assign.js +1 -1
- package/dist/assign.min.js +1 -1
- package/dist/assign.mjs +1 -1
- package/dist/compose.es.js +1 -1
- package/dist/compose.es.min.js +1 -1
- package/dist/compose.js +1 -1
- package/dist/compose.min.js +1 -1
- package/dist/compose.mjs +1 -1
- package/dist/curry.es.js +1 -1
- package/dist/curry.es.min.js +1 -1
- package/dist/curry.js +1 -1
- package/dist/curry.min.js +1 -1
- package/dist/curry.mjs +1 -1
- package/dist/eq.es.js +1 -1
- package/dist/eq.es.min.js +1 -1
- package/dist/eq.js +1 -1
- package/dist/eq.min.js +1 -1
- package/dist/eq.mjs +1 -1
- package/dist/every.es.js +1 -1
- package/dist/every.es.min.js +1 -1
- package/dist/every.js +1 -1
- package/dist/every.min.js +1 -1
- package/dist/every.mjs +1 -1
- package/dist/filter.es.js +1 -1
- package/dist/filter.es.min.js +1 -1
- package/dist/filter.js +1 -1
- package/dist/filter.min.js +1 -1
- package/dist/filter.mjs +1 -1
- package/dist/flatMap.es.js +1 -1
- package/dist/flatMap.es.min.js +1 -1
- package/dist/flatMap.js +1 -1
- package/dist/flatMap.min.js +1 -1
- package/dist/flatMap.mjs +1 -1
- package/dist/forEach.es.js +1 -1
- package/dist/forEach.es.min.js +1 -1
- package/dist/forEach.js +1 -1
- package/dist/forEach.min.js +1 -1
- package/dist/forEach.mjs +1 -1
- package/dist/get.es.js +1 -1
- package/dist/get.es.min.js +1 -1
- package/dist/get.js +1 -1
- package/dist/get.min.js +1 -1
- package/dist/get.mjs +1 -1
- package/dist/gt.es.js +1 -1
- package/dist/gt.es.min.js +1 -1
- package/dist/gt.js +1 -1
- package/dist/gt.min.js +1 -1
- package/dist/gt.mjs +1 -1
- package/dist/gte.es.js +1 -1
- package/dist/gte.es.min.js +1 -1
- package/dist/gte.js +1 -1
- package/dist/gte.min.js +1 -1
- package/dist/gte.mjs +1 -1
- package/dist/lt.es.js +1 -1
- package/dist/lt.es.min.js +1 -1
- package/dist/lt.js +1 -1
- package/dist/lt.min.js +1 -1
- package/dist/lt.mjs +1 -1
- package/dist/lte.es.js +1 -1
- package/dist/lte.es.min.js +1 -1
- package/dist/lte.js +1 -1
- package/dist/lte.min.js +1 -1
- package/dist/lte.mjs +1 -1
- package/dist/map.es.js +1 -1
- package/dist/map.es.min.js +1 -1
- package/dist/map.js +1 -1
- package/dist/map.min.js +1 -1
- package/dist/map.mjs +1 -1
- package/dist/not.es.js +1 -1
- package/dist/not.es.min.js +1 -1
- package/dist/not.js +1 -1
- package/dist/not.min.js +1 -1
- package/dist/not.mjs +1 -1
- package/dist/omit.es.js +1 -1
- package/dist/omit.es.min.js +1 -1
- package/dist/omit.js +1 -1
- package/dist/omit.min.js +1 -1
- package/dist/omit.mjs +1 -1
- package/dist/or.es.js +1 -1
- package/dist/or.es.min.js +1 -1
- package/dist/or.js +1 -1
- package/dist/or.min.js +1 -1
- package/dist/or.mjs +1 -1
- package/dist/pick.es.js +1 -1
- package/dist/pick.es.min.js +1 -1
- package/dist/pick.js +1 -1
- package/dist/pick.min.js +1 -1
- package/dist/pick.mjs +1 -1
- package/dist/pipe.es.js +1 -1
- package/dist/pipe.es.min.js +1 -1
- package/dist/pipe.js +1 -1
- package/dist/pipe.min.js +1 -1
- package/dist/pipe.mjs +1 -1
- package/dist/reduce.es.js +1 -1
- package/dist/reduce.es.min.js +1 -1
- package/dist/reduce.js +1 -1
- package/dist/reduce.min.js +1 -1
- package/dist/reduce.mjs +1 -1
- package/dist/rubico.es.js +1 -1
- package/dist/rubico.es.min.js +1 -1
- package/dist/rubico.global.js +1 -1
- package/dist/rubico.global.min.js +1 -1
- package/dist/rubico.js +1 -1
- package/dist/rubico.min.js +1 -1
- package/dist/rubico.mjs +1 -1
- package/dist/set.es.js +1 -1
- package/dist/set.es.min.js +1 -1
- package/dist/set.js +1 -1
- package/dist/set.min.js +1 -1
- package/dist/set.mjs +1 -1
- package/dist/some.es.js +1 -1
- package/dist/some.es.min.js +1 -1
- package/dist/some.js +1 -1
- package/dist/some.min.js +1 -1
- package/dist/some.mjs +1 -1
- package/dist/switchCase.es.js +1 -1
- package/dist/switchCase.es.min.js +1 -1
- package/dist/switchCase.js +1 -1
- package/dist/switchCase.min.js +1 -1
- package/dist/switchCase.mjs +1 -1
- package/dist/tap.es.js +1 -1
- package/dist/tap.es.min.js +1 -1
- package/dist/tap.js +1 -1
- package/dist/tap.min.js +1 -1
- package/dist/tap.mjs +1 -1
- package/dist/thunkify.es.js +1 -1
- package/dist/thunkify.es.min.js +1 -1
- package/dist/thunkify.js +1 -1
- package/dist/thunkify.min.js +1 -1
- package/dist/thunkify.mjs +1 -1
- package/dist/transform.es.js +1 -1
- package/dist/transform.es.min.js +1 -1
- package/dist/transform.js +1 -1
- package/dist/transform.min.js +1 -1
- package/dist/transform.mjs +1 -1
- package/dist/tryCatch.es.js +1 -1
- package/dist/tryCatch.es.min.js +1 -1
- package/dist/tryCatch.js +1 -1
- package/dist/tryCatch.min.js +1 -1
- package/dist/tryCatch.mjs +1 -1
- package/dist/x/append.es.js +1 -1
- package/dist/x/append.es.min.js +1 -1
- package/dist/x/append.js +1 -1
- package/dist/x/append.min.js +1 -1
- package/dist/x/append.mjs +1 -1
- package/dist/x/callProp.es.js +1 -1
- package/dist/x/callProp.es.min.js +1 -1
- package/dist/x/callProp.js +1 -1
- package/dist/x/callProp.min.js +1 -1
- package/dist/x/callProp.mjs +1 -1
- package/dist/x/defaultsDeep.es.js +1 -1
- package/dist/x/defaultsDeep.es.min.js +1 -1
- package/dist/x/defaultsDeep.js +1 -1
- package/dist/x/defaultsDeep.min.js +1 -1
- package/dist/x/defaultsDeep.mjs +1 -1
- package/dist/x/differenceWith.es.js +1 -1
- package/dist/x/differenceWith.es.min.js +1 -1
- package/dist/x/differenceWith.js +1 -1
- package/dist/x/differenceWith.min.js +1 -1
- package/dist/x/differenceWith.mjs +1 -1
- package/dist/x/filterOut.es.js +1 -1
- package/dist/x/filterOut.es.min.js +1 -1
- package/dist/x/filterOut.js +1 -1
- package/dist/x/filterOut.min.js +1 -1
- package/dist/x/filterOut.mjs +1 -1
- package/dist/x/find.es.js +1 -1
- package/dist/x/find.es.min.js +1 -1
- package/dist/x/find.js +1 -1
- package/dist/x/find.min.js +1 -1
- package/dist/x/find.mjs +1 -1
- package/dist/x/findIndex.es.js +1 -1
- package/dist/x/findIndex.es.min.js +1 -1
- package/dist/x/findIndex.js +1 -1
- package/dist/x/findIndex.min.js +1 -1
- package/dist/x/findIndex.mjs +1 -1
- package/dist/x/first.es.js +1 -1
- package/dist/x/first.es.min.js +1 -1
- package/dist/x/first.js +1 -1
- package/dist/x/first.min.js +1 -1
- package/dist/x/first.mjs +1 -1
- package/dist/x/flatten.es.js +1 -1
- package/dist/x/flatten.es.min.js +1 -1
- package/dist/x/flatten.js +1 -1
- package/dist/x/flatten.min.js +1 -1
- package/dist/x/flatten.mjs +1 -1
- package/dist/x/groupBy.es.js +1 -1
- package/dist/x/groupBy.es.min.js +1 -1
- package/dist/x/groupBy.js +1 -1
- package/dist/x/groupBy.min.js +1 -1
- package/dist/x/groupBy.mjs +1 -1
- package/dist/x/has.es.js +1 -1
- package/dist/x/has.es.min.js +1 -1
- package/dist/x/has.js +1 -1
- package/dist/x/has.min.js +1 -1
- package/dist/x/has.mjs +1 -1
- package/dist/x/identity.es.js +1 -1
- package/dist/x/identity.es.min.js +1 -1
- package/dist/x/identity.js +1 -1
- package/dist/x/identity.min.js +1 -1
- package/dist/x/identity.mjs +1 -1
- package/dist/x/includes.es.js +1 -1
- package/dist/x/includes.es.min.js +1 -1
- package/dist/x/includes.js +1 -1
- package/dist/x/includes.min.js +1 -1
- package/dist/x/includes.mjs +1 -1
- package/dist/x/isDeepEqual.es.js +1 -1
- package/dist/x/isDeepEqual.es.min.js +1 -1
- package/dist/x/isDeepEqual.js +1 -1
- package/dist/x/isDeepEqual.min.js +1 -1
- package/dist/x/isDeepEqual.mjs +1 -1
- package/dist/x/isEmpty.es.js +1 -1
- package/dist/x/isEmpty.es.min.js +1 -1
- package/dist/x/isEmpty.js +1 -1
- package/dist/x/isEmpty.min.js +1 -1
- package/dist/x/isEmpty.mjs +1 -1
- package/dist/x/isEqual.es.js +1 -1
- package/dist/x/isEqual.es.min.js +1 -1
- package/dist/x/isEqual.js +1 -1
- package/dist/x/isEqual.min.js +1 -1
- package/dist/x/isEqual.mjs +1 -1
- package/dist/x/isFunction.es.js +1 -1
- package/dist/x/isFunction.es.min.js +1 -1
- package/dist/x/isFunction.js +1 -1
- package/dist/x/isFunction.min.js +1 -1
- package/dist/x/isFunction.mjs +1 -1
- package/dist/x/isIn.es.js +1 -1
- package/dist/x/isIn.es.min.js +1 -1
- package/dist/x/isIn.js +1 -1
- package/dist/x/isIn.min.js +1 -1
- package/dist/x/isIn.mjs +1 -1
- package/dist/x/isObject.es.js +1 -1
- package/dist/x/isObject.es.min.js +1 -1
- package/dist/x/isObject.js +1 -1
- package/dist/x/isObject.min.js +1 -1
- package/dist/x/isObject.mjs +1 -1
- package/dist/x/isString.es.js +1 -1
- package/dist/x/isString.es.min.js +1 -1
- package/dist/x/isString.js +1 -1
- package/dist/x/isString.min.js +1 -1
- package/dist/x/isString.mjs +1 -1
- package/dist/x/keys.es.js +1 -1
- package/dist/x/keys.es.min.js +1 -1
- package/dist/x/keys.js +1 -1
- package/dist/x/keys.min.js +1 -1
- package/dist/x/keys.mjs +1 -1
- package/dist/x/last.es.js +1 -1
- package/dist/x/last.es.min.js +1 -1
- package/dist/x/last.js +1 -1
- package/dist/x/last.min.js +1 -1
- package/dist/x/last.mjs +1 -1
- package/dist/x/maxBy.es.js +1 -1
- package/dist/x/maxBy.es.min.js +1 -1
- package/dist/x/maxBy.js +1 -1
- package/dist/x/maxBy.min.js +1 -1
- package/dist/x/maxBy.mjs +1 -1
- package/dist/x/noop.es.js +1 -1
- package/dist/x/noop.es.min.js +1 -1
- package/dist/x/noop.js +1 -1
- package/dist/x/noop.min.js +1 -1
- package/dist/x/noop.mjs +1 -1
- package/dist/x/pluck.es.js +1 -1
- package/dist/x/pluck.es.min.js +1 -1
- package/dist/x/pluck.js +1 -1
- package/dist/x/pluck.min.js +1 -1
- package/dist/x/pluck.mjs +1 -1
- package/dist/x/prepend.es.js +1 -1
- package/dist/x/prepend.es.min.js +1 -1
- package/dist/x/prepend.js +1 -1
- package/dist/x/prepend.min.js +1 -1
- package/dist/x/prepend.mjs +1 -1
- package/dist/x/size.es.js +1 -1
- package/dist/x/size.es.min.js +1 -1
- package/dist/x/size.js +1 -1
- package/dist/x/size.min.js +1 -1
- package/dist/x/size.mjs +1 -1
- package/dist/x/trace.es.js +1 -1
- package/dist/x/trace.es.min.js +1 -1
- package/dist/x/trace.js +1 -1
- package/dist/x/trace.min.js +1 -1
- package/dist/x/trace.mjs +1 -1
- package/dist/x/unionWith.es.js +1 -1
- package/dist/x/unionWith.es.min.js +1 -1
- package/dist/x/unionWith.js +1 -1
- package/dist/x/unionWith.min.js +1 -1
- package/dist/x/unionWith.mjs +1 -1
- package/dist/x/uniq.es.js +1 -1
- package/dist/x/uniq.es.min.js +1 -1
- package/dist/x/uniq.js +1 -1
- package/dist/x/uniq.min.js +1 -1
- package/dist/x/uniq.mjs +1 -1
- package/dist/x/unless.es.js +1 -1
- package/dist/x/unless.es.min.js +1 -1
- package/dist/x/unless.js +1 -1
- package/dist/x/unless.min.js +1 -1
- package/dist/x/unless.mjs +1 -1
- package/dist/x/values.es.js +1 -1
- package/dist/x/values.es.min.js +1 -1
- package/dist/x/values.js +1 -1
- package/dist/x/values.min.js +1 -1
- package/dist/x/values.mjs +1 -1
- package/dist/x/when.es.js +1 -1
- package/dist/x/when.es.min.js +1 -1
- package/dist/x/when.js +1 -1
- package/dist/x/when.min.js +1 -1
- package/dist/x/when.mjs +1 -1
- package/eq.d.ts +51 -0
- package/es.d.ts +80 -0
- package/es.js +1 -1
- package/every.d.ts +52 -0
- package/filter.d.ts +148 -0
- package/flatMap.d.ts +109 -0
- package/forEach.d.ts +35 -0
- package/get.d.ts +70 -0
- package/global.d.ts +1 -0
- package/gt.d.ts +49 -0
- package/gte.d.ts +51 -0
- package/index.d.ts +1 -0
- package/index.js +1 -1
- package/lt.d.ts +49 -0
- package/lte.d.ts +49 -0
- package/map.d.ts +246 -0
- package/monad/Instance.d.ts +246 -0
- package/monad/Instance.js +188 -206
- package/not.d.ts +34 -0
- package/omit.d.ts +50 -0
- package/or.d.ts +43 -0
- package/package.json +41 -4
- package/pick.d.ts +43 -0
- package/pipe.d.ts +49 -0
- package/reduce.d.ts +166 -0
- package/set.d.ts +61 -0
- package/some.d.ts +65 -0
- package/switchCase.d.ts +76 -0
- package/tap.d.ts +53 -0
- package/thunkify.d.ts +21 -0
- package/transform.d.ts +131 -0
- package/tryCatch.d.ts +47 -0
- package/x/append.d.ts +38 -0
- package/x/callProp.d.ts +20 -0
- package/x/defaultsDeep.d.ts +42 -0
- package/x/differenceWith.d.ts +25 -0
- package/x/filterOut.d.ts +39 -0
- package/x/find.d.ts +34 -0
- package/x/findIndex.d.ts +25 -0
- package/x/first.d.ts +23 -0
- package/x/flatten.d.ts +57 -0
- package/x/groupBy.d.ts +50 -0
- package/x/has.d.ts +25 -0
- package/x/heapUsedInLoop.d.ts +53 -0
- package/x/identity.d.ts +21 -0
- package/x/includes.d.ts +25 -0
- package/x/index.d.ts +34 -0
- package/x/is.d.ts +2 -0
- package/x/isEmpty.d.ts +24 -0
- package/x/isEqual.d.ts +2 -0
- package/x/isFunction.d.ts +23 -0
- package/x/isIn.d.ts +61 -0
- package/x/isObject.d.ts +2 -0
- package/x/isString.benchmarks.d.ts +1 -0
- package/x/isString.d.ts +21 -0
- package/x/keys.d.ts +23 -0
- package/x/last.d.ts +22 -0
- package/x/maxBy.d.ts +41 -0
- package/x/noop.d.ts +21 -0
- package/x/pluck.d.ts +35 -0
- package/x/prepend.d.ts +38 -0
- package/x/size.d.ts +21 -0
- package/x/test.d.ts +1 -0
- package/x/timeInLoop.d.ts +21 -0
- package/x/trace.d.ts +30 -0
- package/x/tracef.d.ts +7 -0
- package/x/unionWith.d.ts +31 -0
- package/x/uniq.d.ts +24 -0
- package/x/unless.d.ts +28 -0
- package/x/values.d.ts +23 -0
- package/x/when.d.ts +28 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rubico",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "[a]synchronous functional programming",
|
|
5
5
|
"author": "Richard Tong",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,41 +16,77 @@
|
|
|
16
16
|
"x",
|
|
17
17
|
"monad",
|
|
18
18
|
"index.js",
|
|
19
|
+
"index.d.ts",
|
|
19
20
|
"es.js",
|
|
21
|
+
"es.d.ts",
|
|
20
22
|
"global.js",
|
|
23
|
+
"global.d.ts",
|
|
21
24
|
"pipe.js",
|
|
25
|
+
"pipe.d.ts",
|
|
22
26
|
"compose.js",
|
|
27
|
+
"compose.d.ts",
|
|
23
28
|
"tap.js",
|
|
29
|
+
"tap.d.ts",
|
|
24
30
|
"forEach.js",
|
|
31
|
+
"forEach.d.ts",
|
|
25
32
|
"switchCase.js",
|
|
33
|
+
"switchCase.d.ts",
|
|
26
34
|
"tryCatch.js",
|
|
35
|
+
"tryCatch.d.ts",
|
|
27
36
|
"all.js",
|
|
37
|
+
"all.d.ts",
|
|
28
38
|
"assign.js",
|
|
39
|
+
"assign.d.ts",
|
|
29
40
|
"get.js",
|
|
41
|
+
"get.d.ts",
|
|
30
42
|
"set.js",
|
|
43
|
+
"set.d.ts",
|
|
31
44
|
"pick.js",
|
|
45
|
+
"pick.d.ts",
|
|
32
46
|
"omit.js",
|
|
47
|
+
"omit.d.ts",
|
|
33
48
|
"map.js",
|
|
49
|
+
"map.d.ts",
|
|
34
50
|
"filter.js",
|
|
51
|
+
"filter.d.ts",
|
|
35
52
|
"flatMap.js",
|
|
53
|
+
"flatMap.d.ts",
|
|
36
54
|
"reduce.js",
|
|
55
|
+
"reduce.d.ts",
|
|
37
56
|
"transform.js",
|
|
57
|
+
"transform.d.ts",
|
|
38
58
|
"and.js",
|
|
59
|
+
"and.d.ts",
|
|
39
60
|
"or.js",
|
|
61
|
+
"or.d.ts",
|
|
40
62
|
"not.js",
|
|
63
|
+
"not.d.ts",
|
|
41
64
|
"some.js",
|
|
65
|
+
"some.d.ts",
|
|
42
66
|
"every.js",
|
|
67
|
+
"every.d.ts",
|
|
43
68
|
"eq.js",
|
|
69
|
+
"eq.d.ts",
|
|
44
70
|
"gt.js",
|
|
71
|
+
"gt.d.ts",
|
|
45
72
|
"lt.js",
|
|
73
|
+
"lt.d.ts",
|
|
46
74
|
"gte.js",
|
|
75
|
+
"gte.d.ts",
|
|
47
76
|
"lte.js",
|
|
77
|
+
"lte.d.ts",
|
|
48
78
|
"thunkify.js",
|
|
79
|
+
"thunkify.d.ts",
|
|
49
80
|
"always.js",
|
|
81
|
+
"always.d.ts",
|
|
50
82
|
"curry.js",
|
|
83
|
+
"curry.d.ts",
|
|
51
84
|
"__.js",
|
|
85
|
+
"__.d.ts",
|
|
52
86
|
"AggregateReducer.js",
|
|
53
|
-
"
|
|
87
|
+
"AggregateReducer.d.ts",
|
|
88
|
+
"Transducer.js",
|
|
89
|
+
"Transducer.d.ts"
|
|
54
90
|
],
|
|
55
91
|
"keywords": [
|
|
56
92
|
"function-composition",
|
|
@@ -78,6 +114,7 @@
|
|
|
78
114
|
"async": "^3.2.4",
|
|
79
115
|
"bluebird": "^3.7.2",
|
|
80
116
|
"codecov": "^3.7.1",
|
|
117
|
+
"del-cli": "^5.0.0",
|
|
81
118
|
"eslint": "^8.4.1",
|
|
82
119
|
"fantasy-land": "^4.1.0",
|
|
83
120
|
"lodash": "^4.17.21",
|
|
@@ -93,7 +130,7 @@
|
|
|
93
130
|
"test": "mocha test.js *.test.js */**.test.js",
|
|
94
131
|
"test-coverage": "nyc mocha test.js x/*.test.js monad/*.test.js",
|
|
95
132
|
"lint": "eslint .",
|
|
96
|
-
"build": "./build",
|
|
97
|
-
"dts": "tsc"
|
|
133
|
+
"build": "npm run dts && ./build",
|
|
134
|
+
"dts": "del *.d.ts _internal/*.d.ts x/*.d.ts && tsc"
|
|
98
135
|
}
|
|
99
136
|
}
|
package/pick.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export = pick;
|
|
2
|
+
/**
|
|
3
|
+
* @name pick
|
|
4
|
+
*
|
|
5
|
+
* @synopsis
|
|
6
|
+
* ```coffeescript [specscript]
|
|
7
|
+
* pick(object Object, keys Array<string>) -> result Object
|
|
8
|
+
*
|
|
9
|
+
* pick(keys Array<string>)(object Object) -> result Object
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Creates a new object from a source object by selecting provided keys. If a provided key does not exist on the source object, excludes it from the resulting object.
|
|
14
|
+
*
|
|
15
|
+
* ```javascript [playground]
|
|
16
|
+
* console.log(
|
|
17
|
+
* pick({ goodbye: 1, world: 2 }, ['hello', 'world']),
|
|
18
|
+
* ) // { world: 2 }
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* `pick` supports three types of path patterns for nested property access
|
|
22
|
+
*
|
|
23
|
+
* * dot delimited - `'a.b.c'`
|
|
24
|
+
* * bracket notation - `'a[0].value'`
|
|
25
|
+
* * an array of keys or indices - `['a', 0, 'value']`
|
|
26
|
+
*
|
|
27
|
+
* ```javascript [playground]
|
|
28
|
+
* const nested = { a: { b: { c: { d: 1, e: [2, 3] } } } }
|
|
29
|
+
*
|
|
30
|
+
* console.log(pick(['a.b.c.d'])(nested)) // { a: { b: { c: { d: 1 } } } }
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* Compose `pick` inside a `pipe` with its tacit API.
|
|
34
|
+
*
|
|
35
|
+
* ```javascript [playground]
|
|
36
|
+
* pipe({ a: 1, b: 2, c: 3 }, [
|
|
37
|
+
* map(number => number ** 2),
|
|
38
|
+
* pick(['a', 'c']),
|
|
39
|
+
* console.log, // { a: 1, c: 9 }
|
|
40
|
+
* ])
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
declare function pick(arg0: any, arg1: any): any;
|
package/pipe.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export = pipe;
|
|
2
|
+
/**
|
|
3
|
+
* @name pipe
|
|
4
|
+
*
|
|
5
|
+
* @synopsis
|
|
6
|
+
* ```coffeescript [specscript]
|
|
7
|
+
* pipe(funcs Array<function>)(...args) -> result Promise|any
|
|
8
|
+
*
|
|
9
|
+
* pipe(...args, funcs Array<function>) -> result Promise|any
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* @description
|
|
13
|
+
* Creates a function pipeline from an array of functions, where each function passes its return value as a single argument to the next function until all functions have executed. The first function is called with the arguments to the pipeline, while the result of the pipeline execution is the return of its last function. If any function of the pipeline is asynchronous, the result of the execution is a Promise.
|
|
14
|
+
*
|
|
15
|
+
* ```javascript [playground]
|
|
16
|
+
* const syncAdd123 = pipe([
|
|
17
|
+
* number => number + 1,
|
|
18
|
+
* number => number + 2,
|
|
19
|
+
* number => number + 3,
|
|
20
|
+
* ])
|
|
21
|
+
*
|
|
22
|
+
* console.log(syncAdd123(5)) // 11
|
|
23
|
+
*
|
|
24
|
+
* const asyncAdd123 = pipe([
|
|
25
|
+
* async number => number + 1,
|
|
26
|
+
* async number => number + 2,
|
|
27
|
+
* async number => number + 3,
|
|
28
|
+
* ])
|
|
29
|
+
*
|
|
30
|
+
* asyncAdd123(5).then(console.log) // 11
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* When passed any amount of arguments before the array of functions, `pipe` executes eagerly; the array of functions is immediately invoked with the supplied arguments.
|
|
34
|
+
*
|
|
35
|
+
* ```javascript [playground]
|
|
36
|
+
* pipe(1, 2, 3, [
|
|
37
|
+
* Array.of,
|
|
38
|
+
* map(number => number * 3),
|
|
39
|
+
* console.log, // [3, 6, 9]
|
|
40
|
+
* ])
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* @execution series
|
|
44
|
+
*
|
|
45
|
+
* @transducing
|
|
46
|
+
*
|
|
47
|
+
* @since 1.6.0
|
|
48
|
+
*/
|
|
49
|
+
declare function pipe(...args: any[]): any;
|
package/reduce.d.ts
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
export = reduce;
|
|
2
|
+
/**
|
|
3
|
+
* @name reduce
|
|
4
|
+
*
|
|
5
|
+
* @synopsis
|
|
6
|
+
* ```coffeescript [specscript]
|
|
7
|
+
* type Foldable = Array|Object|Map|Iterator|AsyncIterator
|
|
8
|
+
*
|
|
9
|
+
* type Reducer = (
|
|
10
|
+
* accumulator any,
|
|
11
|
+
* value any,
|
|
12
|
+
* indexOrKey? number|string,
|
|
13
|
+
* collection? Foldable,
|
|
14
|
+
* )=>(nextAccumulator Promise|any)
|
|
15
|
+
*
|
|
16
|
+
* type Resolver = (collection Foldable)=>Promise|any
|
|
17
|
+
*
|
|
18
|
+
* reduce(
|
|
19
|
+
* collection Foldable,
|
|
20
|
+
* reducer Reducer,
|
|
21
|
+
* initialValue? Resolver|any
|
|
22
|
+
* ) -> result Promise|any
|
|
23
|
+
*
|
|
24
|
+
* reduce(
|
|
25
|
+
* reducer Reducer,
|
|
26
|
+
* initialValue? Resolver|any
|
|
27
|
+
* )(collection Foldable) -> result Promise|any
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @description
|
|
31
|
+
* Transforms a collection based on a reducer function and optional initial value. In a reducing operation, the result is defined in the beginning as either the initial value if supplied or the first item of the collection. The reducing operation then iterates through the remaining items in the collection, executing the reducer at each iteration to return the result to be used in the next iteration. The final result is the result of the execution of the reducer at the last item of the iteration. `reduce` accepts the following collections:
|
|
32
|
+
*
|
|
33
|
+
* * `Array`
|
|
34
|
+
* * `Object`
|
|
35
|
+
* * `Set`
|
|
36
|
+
* * `Map`
|
|
37
|
+
* * `Iterator`/`Generator`
|
|
38
|
+
* * `AsyncIterator`/`AsyncGenerator`
|
|
39
|
+
*
|
|
40
|
+
* For arrays (type `Array`), `reduce` executes the reducer function for each item of the array in order, returning a new result at each execution to be used in the next execution. On each iteration, the reducer is passed the accumulator, the item of the iteration, the index of the item in the array, and a reference to the original array.
|
|
41
|
+
*
|
|
42
|
+
* ```javascript [playground]
|
|
43
|
+
* const max = (a, b) => a > b ? a : b
|
|
44
|
+
*
|
|
45
|
+
* console.log(
|
|
46
|
+
* reduce([1, 3, 5, 4, 2], max)
|
|
47
|
+
* ) // 5
|
|
48
|
+
*
|
|
49
|
+
* console.log(
|
|
50
|
+
* reduce(max)([1, 3, 5, 4, 2])
|
|
51
|
+
* ) // 5
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* If an optional initial value is provided, the result starts as the provided initial value rather than the first item of the collection.
|
|
55
|
+
*
|
|
56
|
+
* ```javascript [playground]
|
|
57
|
+
* const add = (a, b) => a + b
|
|
58
|
+
*
|
|
59
|
+
* console.log(reduce([1, 2, 3, 4, 5], add, 0)) // 15
|
|
60
|
+
* console.log(reduce(add, 0)([1, 2, 3, 4, 5])) // 15
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* If the initialization parameter is a function, it is treated as a resolver and called with the arguments to resolve the initial value.
|
|
64
|
+
*
|
|
65
|
+
* ```javascript [playground]
|
|
66
|
+
* const concatSquares = (array, value) => array.concat(value ** 2)
|
|
67
|
+
*
|
|
68
|
+
* const contrivedInitializer = array => [`initial length ${array.length}`]
|
|
69
|
+
*
|
|
70
|
+
* const array = [1, 2, 3, 4, 5]
|
|
71
|
+
*
|
|
72
|
+
* console.log(reduce(concatSquares, contrivedInitializer)(array))
|
|
73
|
+
* // ['initial length 5', 1, 4, 9, 16, 25]
|
|
74
|
+
* console.log(reduce(array, concatSquares, contrivedInitializer))
|
|
75
|
+
* // ['initial length 5', 1, 4, 9, 16, 25]
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* For objects (type `Object`), `reduce` executes the reducer function for each value of the object. On each iteration, the reducer is passed the accumulator, the object value, the key of the object value, and a reference to the original object.
|
|
79
|
+
*
|
|
80
|
+
* ```javascript [playground]
|
|
81
|
+
* const add = (a, b) => a + b
|
|
82
|
+
*
|
|
83
|
+
* const obj = { a: 1, b: 2, c: 3, d: 4, e: 5 }
|
|
84
|
+
*
|
|
85
|
+
* console.log(
|
|
86
|
+
* reduce(obj, add)
|
|
87
|
+
* ) // 15
|
|
88
|
+
*
|
|
89
|
+
* console.log(
|
|
90
|
+
* reduce(add)(obj)
|
|
91
|
+
* ) // 15
|
|
92
|
+
* ```
|
|
93
|
+
*
|
|
94
|
+
* For sets (type `Set`), `reduce` executes the reducer function for each item of the set. On each iteration, the reducer is passed the accumulator and item of the set.
|
|
95
|
+
*
|
|
96
|
+
* ```javascript [playground]
|
|
97
|
+
* const add = (a, b) => a + b
|
|
98
|
+
*
|
|
99
|
+
* const set = new Set([1, 2, 3, 4, 5])
|
|
100
|
+
*
|
|
101
|
+
* console.log(
|
|
102
|
+
* reduce(set, add)
|
|
103
|
+
* ) // 15
|
|
104
|
+
*
|
|
105
|
+
* console.log(
|
|
106
|
+
* reduce(add)(set)
|
|
107
|
+
* ) // 15
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* For maps (type `Map`), `reduce` executes the reducer function for each value of each entry of the map. On each iteration, the reducer is passed the accumulator, the map item, the key of the map item, and a reference to the original map.
|
|
111
|
+
*
|
|
112
|
+
* ```javascript [playground]
|
|
113
|
+
* const add = (a, b) => a + b
|
|
114
|
+
*
|
|
115
|
+
* const m = new Map([['a', 1], ['b', 2], ['c', 3], ['d', 4], ['e', 5]])
|
|
116
|
+
*
|
|
117
|
+
* console.log(
|
|
118
|
+
* reduce(m, add)
|
|
119
|
+
* ) // 15
|
|
120
|
+
*
|
|
121
|
+
* console.log(
|
|
122
|
+
* reduce(add)(m)
|
|
123
|
+
* ) // 15
|
|
124
|
+
* ```
|
|
125
|
+
*
|
|
126
|
+
* For iterators (type `Iterator`) and generators (type `Generator`), `reduce` executes the reducer function for each value of the iterator/generator. On each iteration, the reducer is passed the accumulator and the item of the iteration. The iterator/generator is consumed in the process.
|
|
127
|
+
*
|
|
128
|
+
* ```javascript [playground]
|
|
129
|
+
* const add = (a, b) => a + b
|
|
130
|
+
*
|
|
131
|
+
* const generate12345 = function* () {
|
|
132
|
+
* yield 1; yield 2; yield 3; yield 4; yield 5
|
|
133
|
+
* }
|
|
134
|
+
*
|
|
135
|
+
* console.log(
|
|
136
|
+
* reduce(generate12345(), add)
|
|
137
|
+
* ) // 15
|
|
138
|
+
*
|
|
139
|
+
* console.log(
|
|
140
|
+
* reduce(add)(generate12345())
|
|
141
|
+
* ) // 15
|
|
142
|
+
* ```
|
|
143
|
+
*
|
|
144
|
+
* For asyncIterators (type `AsyncIterator`) and asyncGenerators (type `AsyncGenerator`), `reduce` executes the reducer function for each value of the asyncIterator/asyncGenerator. On each iteration, the reducer is passed the accumulator and the item of the async iteration. The asyncIterator/asyncGenerator is consumed in the process.
|
|
145
|
+
*
|
|
146
|
+
* ```javascript [playground]
|
|
147
|
+
* const asyncAdd = async (a, b) => a + b
|
|
148
|
+
*
|
|
149
|
+
* const asyncGenerate12345 = async function* () {
|
|
150
|
+
* yield 1; yield 2; yield 3; yield 4; yield 5
|
|
151
|
+
* }
|
|
152
|
+
*
|
|
153
|
+
* reduce(asyncGenerate12345(), asyncAdd).then(console.log) // 15
|
|
154
|
+
*
|
|
155
|
+
* reduce(asyncAdd)(asyncGenerate12345()).then(console.log) // 15
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* @execution series
|
|
159
|
+
*
|
|
160
|
+
* @transducing
|
|
161
|
+
*
|
|
162
|
+
* @TODO readerReduce
|
|
163
|
+
*
|
|
164
|
+
* @TODO reduce.concurrent
|
|
165
|
+
*/
|
|
166
|
+
declare function reduce(...args: any[]): any;
|
package/set.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export = set;
|
|
2
|
+
/**
|
|
3
|
+
* @name set
|
|
4
|
+
*
|
|
5
|
+
* @synopsis
|
|
6
|
+
* ```coffeescript [specscript]
|
|
7
|
+
* set(
|
|
8
|
+
* object Promise|Object,
|
|
9
|
+
* path string|Array<string|number>,
|
|
10
|
+
* value function|any,
|
|
11
|
+
* ) -> result Promise|Object
|
|
12
|
+
*
|
|
13
|
+
* set(
|
|
14
|
+
* path string|Array<string|number>,
|
|
15
|
+
* value function|any,
|
|
16
|
+
* )(object Object) -> result Promise|Object
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @description
|
|
20
|
+
* Sets a property on a new object shallow cloned from the argument object given a path denoted by a string, number, or an array of string or numbers.
|
|
21
|
+
*
|
|
22
|
+
* `set` supports three types of path patterns for nested property access.
|
|
23
|
+
*
|
|
24
|
+
* * dot delimited - `'a.b.c'`
|
|
25
|
+
* * bracket notation - `'a[0].value'`
|
|
26
|
+
* * an array of keys or indices - `['a', 0, 'value']`
|
|
27
|
+
*
|
|
28
|
+
* ```javascript [playground]
|
|
29
|
+
* console.log(set({ b: 2 }, 'a', 1)) // { a: 1, b: 2 }
|
|
30
|
+
*
|
|
31
|
+
* const nestedAC2 = { a: { c: 2 } }
|
|
32
|
+
*
|
|
33
|
+
* console.log(set(nestedAC2, 'a.b', 1)) // { a : { b: 1, c: 2 }}
|
|
34
|
+
*
|
|
35
|
+
* const nestedA0BC3 = { a: [{ b: { c: 3 } }] }
|
|
36
|
+
*
|
|
37
|
+
* console.log(set(nestedA0BC3, 'a[0].b.c', 4)) // { a: [{ b: { c: 4 } }] }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* The property value may be a function, in which case it is treated as a resolver and provided the argument object to resolve the value to set.
|
|
41
|
+
*
|
|
42
|
+
* ```javascript [playground]
|
|
43
|
+
* const myObj = { a: 1 }
|
|
44
|
+
*
|
|
45
|
+
* const myNewObj = set('b', obj => obj.a + 2)(myObj)
|
|
46
|
+
*
|
|
47
|
+
* console.log(myNewObj) // { a: 1, b: 3 }
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* `set` supports a tacit API for composability.
|
|
51
|
+
*
|
|
52
|
+
* ```javascript [playground]
|
|
53
|
+
* pipe({ a: 1 }, [
|
|
54
|
+
* set('b', 2),
|
|
55
|
+
* console.log, // { a: 1, b: 2 }
|
|
56
|
+
* ])
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @since 1.7.0
|
|
60
|
+
*/
|
|
61
|
+
declare function set(arg0: any, arg1: any, arg2: any): any;
|
package/some.d.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export = some;
|
|
2
|
+
/**
|
|
3
|
+
* @name some
|
|
4
|
+
*
|
|
5
|
+
* @synopsis
|
|
6
|
+
* ```coffeescript [specscript]
|
|
7
|
+
* type Foldable = Array|Iterable|AsyncIterable|{ reduce: function }|Object
|
|
8
|
+
*
|
|
9
|
+
* some(collection Foldable, predicate function) -> Promise|boolean
|
|
10
|
+
*
|
|
11
|
+
* some(predicate function)(collection Foldable) -> Promise|boolean
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* @description
|
|
15
|
+
* Test a predicate concurrently across all items of a collection, returning true if any executions return truthy.
|
|
16
|
+
*
|
|
17
|
+
* ```javascript [playground]
|
|
18
|
+
* const isOdd = number => number % 2 == 1
|
|
19
|
+
*
|
|
20
|
+
* console.log(
|
|
21
|
+
* some([1, 2, 3, 4, 5], isOdd),
|
|
22
|
+
* ) // true
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* The collection can be any iterable, async iterable, or object values iterable collection. Below is an example of `some` accepting an async generator as the collection.
|
|
26
|
+
*
|
|
27
|
+
* ```javascript [playground]
|
|
28
|
+
* const toTodosUrl = id => 'https://jsonplaceholder.typicode.com/todos/' + id
|
|
29
|
+
*
|
|
30
|
+
* const fetchedToJson = fetched => fetched.json()
|
|
31
|
+
*
|
|
32
|
+
* const fetchTodo = pipe([
|
|
33
|
+
* toTodosUrl,
|
|
34
|
+
* fetch,
|
|
35
|
+
* fetchedToJson,
|
|
36
|
+
* ])
|
|
37
|
+
*
|
|
38
|
+
* const todoIDsGenerator = async function* () {
|
|
39
|
+
* yield 1; yield 2; yield 3; yield 4; yield 5
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* const promise = some(todoIDsGenerator(), async id => {
|
|
43
|
+
* const todo = await fetchTodo(id)
|
|
44
|
+
* return todo.title.startsWith('fugiat')
|
|
45
|
+
* })
|
|
46
|
+
*
|
|
47
|
+
* promise.then(console.log) // true
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* `some` supports a tacit API for composability.
|
|
51
|
+
*
|
|
52
|
+
* ```javascript [playground]
|
|
53
|
+
* pipe([1, 2, 3], [
|
|
54
|
+
* some(number => number < 5),
|
|
55
|
+
* console.log, // true
|
|
56
|
+
* ])
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* @execution concurrent
|
|
60
|
+
*
|
|
61
|
+
* @muxing
|
|
62
|
+
*
|
|
63
|
+
* @related or
|
|
64
|
+
*/
|
|
65
|
+
declare function some(...args: any[]): any;
|
package/switchCase.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export = switchCase;
|
|
2
|
+
/**
|
|
3
|
+
* @name switchCase
|
|
4
|
+
*
|
|
5
|
+
* @synopsis
|
|
6
|
+
* ```coffeescript [specscript]
|
|
7
|
+
* switchCase(conditionalValues Array<boolean|any>) -> Promise|any
|
|
8
|
+
*
|
|
9
|
+
* switchCase(
|
|
10
|
+
* ...args,
|
|
11
|
+
* conditionalFuncsOrValues Array<function|boolean|any>
|
|
12
|
+
* ) -> Promise|any
|
|
13
|
+
*
|
|
14
|
+
* switchCase(
|
|
15
|
+
* conditionalFuncsOrValues Array<function|boolean|any>
|
|
16
|
+
* )(...args) -> Promise|any
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @description
|
|
20
|
+
* Functional equivalent to the [Conditional (ternary) operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator). Accepts an array of conditional functions that specifies cases as pairings of `predicate` and `resolver` functions with the exception of the last, default resolver. All functions are provided with the same arguments and executed in series. The result of a `switchCase` operation is either the result of the execution the last default resolver, or the result of the execution of the first resolver where the associated predicate tested true.
|
|
21
|
+
*
|
|
22
|
+
* ```javascript [playground]
|
|
23
|
+
* const fruitIsYellow = fruit => fruit.color == 'yellow'
|
|
24
|
+
*
|
|
25
|
+
* console.log(
|
|
26
|
+
* switchCase({ name: 'plantain', color: 'yellow' }, [
|
|
27
|
+
* fruitIsYellow,
|
|
28
|
+
* fruit => fruit.name + ' is possibly a banana',
|
|
29
|
+
* fruit => fruit.name + ' is probably not a banana',
|
|
30
|
+
* ])
|
|
31
|
+
* ) // plantain is possibly a banana
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* For composability `switchCase` supports a tacit API.
|
|
35
|
+
*
|
|
36
|
+
* ```javascript [playground]
|
|
37
|
+
* const fruitIsYellow = fruit => fruit.color == 'yellow'
|
|
38
|
+
*
|
|
39
|
+
* const fruitsGuesser = switchCase([
|
|
40
|
+
* fruitIsYellow,
|
|
41
|
+
* fruit => fruit.name + ' is possibly a banana',
|
|
42
|
+
* fruit => fruit.name + ' is probably not a banana',
|
|
43
|
+
* ])
|
|
44
|
+
*
|
|
45
|
+
* console.log(fruitsGuesser({ name: 'plantain', color: 'yellow' }))
|
|
46
|
+
* // plantain is possibly a banana
|
|
47
|
+
*
|
|
48
|
+
* console.log(fruitsGuesser({ name: 'apple', color: 'red' }))
|
|
49
|
+
* // apple is probably not a banana
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* Any function can be replaced with a nonfunction (object or primitive) value to be used directly in the operation.
|
|
53
|
+
*
|
|
54
|
+
* ```javascript [playground]
|
|
55
|
+
* switchCase([
|
|
56
|
+
* async function asyncIdentity(value) {
|
|
57
|
+
* return value
|
|
58
|
+
* },
|
|
59
|
+
* 'something',
|
|
60
|
+
* 'default',
|
|
61
|
+
* ])(false).then(console.log) // default
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* If every item in the conditional array is a nonfunction value, `switchCase` executes eagerly.
|
|
65
|
+
*
|
|
66
|
+
* ```javascript [playground]
|
|
67
|
+
* const age = 26
|
|
68
|
+
*
|
|
69
|
+
* const myDrink = switchCase([age >= 21, 'Beer', 'Juice'])
|
|
70
|
+
*
|
|
71
|
+
* console.log(myDrink) // Beer
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @execution series
|
|
75
|
+
*/
|
|
76
|
+
declare function switchCase(...args: any[]): any;
|
package/tap.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export = tap;
|
|
2
|
+
/**
|
|
3
|
+
* @name tap
|
|
4
|
+
*
|
|
5
|
+
* @synopsis
|
|
6
|
+
* ```coffeescript [specscript]
|
|
7
|
+
* tap(...args, func function) -> Promise|args[0]
|
|
8
|
+
* tap(func function)(...args) -> Promise|args[0]
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @description
|
|
12
|
+
* Call a function with any number of arguments, returning the first argument. Promises created by the tapper are resolved before returning the value.
|
|
13
|
+
*
|
|
14
|
+
* ```javascript [playground]
|
|
15
|
+
* const pipeline = pipe([
|
|
16
|
+
* tap(value => console.log(value)),
|
|
17
|
+
* tap(value => console.log(value + 'bar')),
|
|
18
|
+
* tap(value => console.log(value + 'barbaz')),
|
|
19
|
+
* ])
|
|
20
|
+
*
|
|
21
|
+
* pipeline('foo') // 'foo'
|
|
22
|
+
* // 'foobar'
|
|
23
|
+
* // 'foobarbaz'
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare function tap(...args: any[]): any;
|
|
27
|
+
declare namespace tap {
|
|
28
|
+
/**
|
|
29
|
+
* @name tap.if
|
|
30
|
+
*
|
|
31
|
+
* @synopsis
|
|
32
|
+
* ```coffeescript [specscript]
|
|
33
|
+
* tap.if(predicate function, func function)(...args) -> Promise|args[0]
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @description
|
|
37
|
+
* A version of `tap` that accepts a predicate function (a function that returns a boolean value) before the function to execute. Only executes the function if the predicate function tests true for the same arguments provided to the execution function.
|
|
38
|
+
*
|
|
39
|
+
* ```javascript [playground]
|
|
40
|
+
* const isOdd = number => number % 2 == 1
|
|
41
|
+
*
|
|
42
|
+
* const logIfOdd = tap.if(
|
|
43
|
+
* isOdd,
|
|
44
|
+
* number => console.log(number, 'is an odd number')
|
|
45
|
+
* )
|
|
46
|
+
*
|
|
47
|
+
* logIfOdd(2)
|
|
48
|
+
* logIfOdd(3) // 3 is an odd number
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
function _if(predicate: any, func: any): (...args: any[]) => any;
|
|
52
|
+
export { _if as if };
|
|
53
|
+
}
|
package/thunkify.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export = thunkify;
|
|
2
|
+
/**
|
|
3
|
+
* @name thunkify
|
|
4
|
+
*
|
|
5
|
+
* @synopsis
|
|
6
|
+
* ```coffeescript [specscript]
|
|
7
|
+
* thunkify(func function, ...args) -> thunk ()=>func(...args)
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* @description
|
|
11
|
+
* Create a thunk function from another function and any number of arguments. The thunk function takes no arguments, and when called, executes the other function with the provided arguments. The other function is said to be "thunkified".
|
|
12
|
+
*
|
|
13
|
+
* ```javascript [playground]
|
|
14
|
+
* const add = (a, b) => a + b
|
|
15
|
+
*
|
|
16
|
+
* const thunkAdd12 = thunkify(add, 1, 2)
|
|
17
|
+
*
|
|
18
|
+
* console.log(thunkAdd12()) // 3
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
declare function thunkify(func: any, ...args: any[]): () => any;
|