@asd14/m 8.1.0 → 9.0.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/LICENSE +1 -1
- package/README.md +73 -28
- package/dist/src/all/all.d.ts +53 -0
- package/dist/src/all/all.js +59 -0
- package/dist/src/all/with/all-with.d.ts +47 -0
- package/dist/src/all/with/all-with.js +59 -0
- package/dist/src/any/any.d.ts +62 -0
- package/dist/src/any/any.js +68 -0
- package/dist/src/any/with/any-with.d.ts +47 -0
- package/dist/src/any/with/any-with.js +59 -0
- package/dist/src/converge/converge.d.ts +89 -0
- package/dist/src/converge/converge.js +68 -0
- package/dist/src/count/by/count-by.d.ts +55 -0
- package/dist/src/count/by/count-by.js +62 -0
- package/dist/src/count/count.d.ts +39 -0
- package/dist/src/count/count.js +39 -0
- package/dist/src/count/with/count-with.d.ts +46 -0
- package/dist/src/count/with/count-with.js +59 -0
- package/dist/src/curry/curry.d.ts +43 -0
- package/dist/src/curry/curry.js +52 -0
- package/dist/src/debounce/debounce.d.ts +39 -0
- package/dist/src/debounce/debounce.js +63 -0
- package/dist/src/dec/dec.d.ts +22 -0
- package/dist/src/dec/dec.js +27 -0
- package/dist/src/default-to/default-to.d.ts +44 -0
- package/dist/src/default-to/default-to.js +46 -0
- package/dist/src/distinct/by/distinct-by.d.ts +49 -0
- package/dist/src/distinct/by/distinct-by.js +74 -0
- package/dist/src/distinct/distinct.d.ts +32 -0
- package/dist/src/distinct/distinct.js +39 -0
- package/dist/src/drop/last/drop-last.d.ts +37 -0
- package/dist/src/drop/last/drop-last.js +55 -0
- package/dist/src/escape/escape.d.ts +35 -0
- package/dist/src/escape/escape.js +47 -0
- package/dist/src/escape/html/escape-html.d.ts +26 -0
- package/dist/src/escape/html/escape-html.js +38 -0
- package/dist/src/escape/reg-exp/escape-reg-exp.d.ts +30 -0
- package/dist/src/escape/reg-exp/escape-reg-exp.js +34 -0
- package/dist/src/evolve/deep-by/evolve-deep-by.d.ts +65 -0
- package/dist/src/evolve/deep-by/evolve-deep-by.js +90 -0
- package/dist/src/evolve/evolve.d.ts +61 -0
- package/dist/src/evolve/evolve.js +66 -0
- package/dist/src/evolve/many/evolve-many.d.ts +46 -0
- package/dist/src/evolve/many/evolve-many.js +62 -0
- package/dist/src/evolve/with/evolve-with.d.ts +63 -0
- package/dist/src/evolve/with/evolve-with.js +84 -0
- package/dist/src/filter/filter.d.ts +56 -0
- package/dist/src/filter/filter.js +63 -0
- package/dist/src/filter/with/filter-with.d.ts +46 -0
- package/dist/src/filter/with/filter-with.js +59 -0
- package/dist/src/find/find.d.ts +57 -0
- package/dist/src/find/find.js +64 -0
- package/dist/src/find/index/find-index.d.ts +57 -0
- package/dist/src/find/index/find-index.js +64 -0
- package/dist/src/find/index/with/find-index-with.d.ts +47 -0
- package/dist/src/find/index/with/find-index-with.js +60 -0
- package/dist/src/find/with/find-with.d.ts +47 -0
- package/dist/src/find/with/find-with.js +60 -0
- package/dist/src/first/first.d.ts +37 -0
- package/dist/src/first/first.js +38 -0
- package/dist/src/flatten/flatten.d.ts +65 -0
- package/dist/src/flatten/flatten.js +107 -0
- package/dist/src/for-each/for-each.d.ts +49 -0
- package/dist/src/for-each/for-each.js +56 -0
- package/dist/src/fuzzy-match/fuzzy-match.d.ts +49 -0
- package/dist/src/fuzzy-match/fuzzy-match.js +164 -0
- package/dist/src/group/group-by.d.ts +66 -0
- package/dist/src/group/group-by.js +79 -0
- package/dist/src/i/i.d.ts +23 -0
- package/dist/src/i/i.js +22 -0
- package/dist/src/inc/inc.d.ts +22 -0
- package/dist/src/inc/inc.js +27 -0
- package/dist/src/index.d.ts +79 -0
- package/dist/src/index.js +117 -0
- package/dist/src/is/is.d.ts +177 -0
- package/dist/src/is/is.js +173 -0
- package/dist/src/is-deep-equal/is-deep-equal.d.ts +39 -0
- package/dist/src/is-deep-equal/is-deep-equal.js +141 -0
- package/dist/src/is-equal/is-equal.d.ts +33 -0
- package/dist/src/is-equal/is-equal.js +35 -0
- package/dist/src/is-match/is-match.d.ts +64 -0
- package/dist/src/is-match/is-match.js +69 -0
- package/dist/src/is-uri/is-uri.d.ts +29 -0
- package/dist/src/is-uri/is-uri.js +84 -0
- package/dist/src/join/join.d.ts +33 -0
- package/dist/src/join/join.js +45 -0
- package/dist/src/keys/keys.d.ts +29 -0
- package/dist/src/keys/keys.js +35 -0
- package/dist/src/last/last.d.ts +37 -0
- package/dist/src/last/last.js +38 -0
- package/dist/src/map/indexed/map-indexed.d.ts +54 -0
- package/dist/src/map/indexed/map-indexed.js +61 -0
- package/dist/src/map/map.d.ts +51 -0
- package/dist/src/map/map.js +57 -0
- package/dist/src/map/matrix/map-matrix.d.ts +55 -0
- package/dist/src/map/matrix/map-matrix.js +67 -0
- package/dist/src/merge/by/merge-by.d.ts +48 -0
- package/dist/src/merge/by/merge-by.js +73 -0
- package/dist/src/merge/merge.d.ts +48 -0
- package/dist/src/merge/merge.js +81 -0
- package/dist/src/partition/partition.d.ts +59 -0
- package/dist/src/partition/partition.js +72 -0
- package/dist/src/partition/with/partition-with.d.ts +45 -0
- package/dist/src/partition/with/partition-with.js +58 -0
- package/dist/src/pick/pick.d.ts +39 -0
- package/dist/src/pick/pick.js +59 -0
- package/dist/src/pipe/pipe.d.ts +89 -0
- package/dist/src/pipe/pipe.js +50 -0
- package/dist/src/pipe/promise/pipe-p.d.ts +33 -0
- package/dist/src/pipe/promise/pipe-p.js +44 -0
- package/dist/src/push/push.d.ts +28 -0
- package/dist/src/push/push.js +38 -0
- package/dist/src/read/read.d.ts +55 -0
- package/dist/src/read/read.js +79 -0
- package/dist/src/reduce/reduce.d.ts +40 -0
- package/dist/src/reduce/reduce.js +58 -0
- package/dist/src/remove/remove.d.ts +32 -0
- package/dist/src/remove/remove.js +48 -0
- package/dist/src/remove/with/remove-with.d.ts +44 -0
- package/dist/src/remove/with/remove-with.js +62 -0
- package/dist/src/sort/by/sort-by.d.ts +34 -0
- package/dist/src/sort/by/sort-by.js +46 -0
- package/dist/src/sort/sort.d.ts +43 -0
- package/dist/src/sort/sort.js +72 -0
- package/dist/src/sort/with/sort-with.d.ts +58 -0
- package/dist/src/sort/with/sort-with.js +126 -0
- package/dist/src/split/split.d.ts +33 -0
- package/dist/src/split/split.js +45 -0
- package/dist/src/split-in-groups-of/split-in-groups-of.d.ts +34 -0
- package/dist/src/split-in-groups-of/split-in-groups-of.js +53 -0
- package/dist/src/sum/sum.d.ts +28 -0
- package/dist/src/sum/sum.js +34 -0
- package/dist/src/throttle/throttle.d.ts +46 -0
- package/dist/src/throttle/throttle.js +90 -0
- package/dist/src/to-string/to-string.d.ts +28 -0
- package/dist/src/to-string/to-string.js +27 -0
- package/dist/src/trim/trim.d.ts +48 -0
- package/dist/src/trim/trim.js +79 -0
- package/dist/src/type/type.d.ts +28 -0
- package/dist/src/type/type.js +35 -0
- package/dist/src/unflatten/unflatten.d.ts +44 -0
- package/dist/src/unflatten/unflatten.js +88 -0
- package/dist/src/unite/by/unite-by.d.ts +43 -0
- package/dist/src/unite/by/unite-by.js +63 -0
- package/dist/src/unite/unite.d.ts +42 -0
- package/dist/src/unite/unite.js +58 -0
- package/dist/src/update/update.d.ts +57 -0
- package/dist/src/update/update.js +62 -0
- package/dist/src/update/with/update-with.d.ts +63 -0
- package/dist/src/update/with/update-with.js +84 -0
- package/dist/src/upsert/with/upsert-with.d.ts +57 -0
- package/dist/src/upsert/with/upsert-with.js +87 -0
- package/dist/src/utils/build-match.d.ts +25 -0
- package/dist/src/utils/build-match.js +56 -0
- package/dist/src/utils/build-patch.d.ts +32 -0
- package/dist/src/utils/build-patch.js +59 -0
- package/dist/src/utils/pipe.d.ts +11 -0
- package/dist/src/utils/pipe.js +15 -0
- package/dist/src/utils/set-own.d.ts +20 -0
- package/dist/src/utils/set-own.js +29 -0
- package/dist/src/utils/to-function.d.ts +22 -0
- package/dist/src/utils/to-function.js +32 -0
- package/dist/src/when/when.d.ts +54 -0
- package/dist/src/when/when.js +70 -0
- package/dist/src/zip-to-object/zip-to-object.d.ts +39 -0
- package/dist/src/zip-to-object/zip-to-object.js +58 -0
- package/dist/types/array.d.ts +25 -0
- package/dist/types/basic.d.ts +3 -0
- package/dist/types/function.d.ts +42 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/object.d.ts +70 -0
- package/dist/types/object.matcher.d.ts +22 -0
- package/dist/types/object.patcher.d.ts +34 -0
- package/docs/DECISIONS.md +7 -0
- package/docs/SPEC.md +195 -0
- package/docs/decisions/01.use-manual-currying.md +34 -0
- package/docs/decisions/02.add-runtime-type-checks.md +27 -0
- package/docs/decisions/03.use-c8-over-node-test-runner.md +30 -0
- package/docs/decisions/04.use-relative-types-imports.md +26 -0
- package/docs/decisions/05.read-an-array-as-a-pipe.md +37 -0
- package/docs/explanation/curried-type-inference.md +136 -0
- package/docs/how-to/jsdoc.md +94 -0
- package/docs/how-to/pipe-arrays.md +104 -0
- package/docs/how-to/tape-runtime-tests.md +206 -0
- package/docs/how-to/tstyche-type-tests.md +146 -0
- package/docs/how-to/writing-functions.md +249 -0
- package/docs/spec/pending.md +18 -0
- package/package.json +76 -52
- package/dist/all/all.js +0 -68
- package/dist/all/all.js.map +0 -1
- package/dist/all/all.test.js +0 -66
- package/dist/all/all.test.js.map +0 -1
- package/dist/any/any.js +0 -71
- package/dist/any/any.js.map +0 -1
- package/dist/any/any.test.js +0 -60
- package/dist/any/any.test.js.map +0 -1
- package/dist/append/append.js +0 -31
- package/dist/append/append.js.map +0 -1
- package/dist/append/append.test.js +0 -41
- package/dist/append/append.test.js.map +0 -1
- package/dist/bottom/bottom.js +0 -52
- package/dist/bottom/bottom.js.map +0 -1
- package/dist/bottom/bottom.test.js +0 -57
- package/dist/bottom/bottom.test.js.map +0 -1
- package/dist/cases/cases.js +0 -32
- package/dist/cases/cases.js.map +0 -1
- package/dist/cases/cases.test.js +0 -71
- package/dist/cases/cases.test.js.map +0 -1
- package/dist/clone/clone.js +0 -48
- package/dist/clone/clone.js.map +0 -1
- package/dist/clone/clone.test.js +0 -45
- package/dist/clone/clone.test.js.map +0 -1
- package/dist/compact/compact.js +0 -80
- package/dist/compact/compact.js.map +0 -1
- package/dist/compact/compact.test.js +0 -88
- package/dist/compact/compact.test.js.map +0 -1
- package/dist/contains/contains.js +0 -24
- package/dist/contains/contains.js.map +0 -1
- package/dist/contains/contains.test.js +0 -11
- package/dist/contains/contains.test.js.map +0 -1
- package/dist/converge/converge.js +0 -62
- package/dist/converge/converge.js.map +0 -1
- package/dist/converge/converge.test.js +0 -69
- package/dist/converge/converge.test.js.map +0 -1
- package/dist/count/count.js +0 -113
- package/dist/count/count.js.map +0 -1
- package/dist/count/count.test.js +0 -105
- package/dist/count/count.test.js.map +0 -1
- package/dist/curry/curry.js +0 -39
- package/dist/curry/curry.js.map +0 -1
- package/dist/curry/curry.test.js +0 -13
- package/dist/curry/curry.test.js.map +0 -1
- package/dist/debounce/debounce.js +0 -36
- package/dist/debounce/debounce.js.map +0 -1
- package/dist/debounce/debounce.test.js +0 -49
- package/dist/debounce/debounce.test.js.map +0 -1
- package/dist/dec/dec.js +0 -18
- package/dist/dec/dec.js.map +0 -1
- package/dist/dec/dec.test.js +0 -8
- package/dist/dec/dec.test.js.map +0 -1
- package/dist/deep-equal/deep-equal.bench.js +0 -123
- package/dist/deep-equal/deep-equal.bench.js.map +0 -1
- package/dist/deep-equal/deep-equal.js +0 -47
- package/dist/deep-equal/deep-equal.js.map +0 -1
- package/dist/deep-equal/deep-equal.own.js +0 -97
- package/dist/deep-equal/deep-equal.own.js.map +0 -1
- package/dist/deep-equal/deep-equal.test.js +0 -131
- package/dist/deep-equal/deep-equal.test.js.map +0 -1
- package/dist/distinct/distinct.bench.js +0 -56
- package/dist/distinct/distinct.bench.js.map +0 -1
- package/dist/distinct/distinct.js +0 -36
- package/dist/distinct/distinct.js.map +0 -1
- package/dist/distinct/distinct.test.js +0 -43
- package/dist/distinct/distinct.test.js.map +0 -1
- package/dist/drop-last/drop-last.js +0 -23
- package/dist/drop-last/drop-last.js.map +0 -1
- package/dist/drop-last/drop-last.test.js +0 -38
- package/dist/drop-last/drop-last.test.js.map +0 -1
- package/dist/elapsed-time/elapsed-time.js +0 -42
- package/dist/elapsed-time/elapsed-time.js.map +0 -1
- package/dist/elapsed-time/elapsed-time.test.js +0 -13
- package/dist/elapsed-time/elapsed-time.test.js.map +0 -1
- package/dist/ends-with/ends-with.js +0 -36
- package/dist/ends-with/ends-with.js.map +0 -1
- package/dist/ends-with/ends-with.test.js +0 -33
- package/dist/ends-with/ends-with.test.js.map +0 -1
- package/dist/escape/escape.js +0 -7
- package/dist/escape/escape.js.map +0 -1
- package/dist/escape-html/escape-html.js +0 -14
- package/dist/escape-html/escape-html.js.map +0 -1
- package/dist/escape-html/escape-html.test.js +0 -10
- package/dist/escape-html/escape-html.test.js.map +0 -1
- package/dist/escape-reg-exp/escape-reg-exp.js +0 -17
- package/dist/escape-reg-exp/escape-reg-exp.js.map +0 -1
- package/dist/escape-reg-exp/escape-reg-exp.test.js +0 -13
- package/dist/escape-reg-exp/escape-reg-exp.test.js.map +0 -1
- package/dist/filter/filter.js +0 -45
- package/dist/filter/filter.js.map +0 -1
- package/dist/filter/filter.test.js +0 -101
- package/dist/filter/filter.test.js.map +0 -1
- package/dist/find/find.js +0 -93
- package/dist/find/find.js.map +0 -1
- package/dist/find/find.test.js +0 -77
- package/dist/find/find.test.js.map +0 -1
- package/dist/find-index/find-index.js +0 -43
- package/dist/find-index/find-index.js.map +0 -1
- package/dist/find-index/find-index.test.js +0 -53
- package/dist/find-index/find-index.test.js.map +0 -1
- package/dist/first/first.js +0 -21
- package/dist/first/first.js.map +0 -1
- package/dist/first/first.test.js +0 -17
- package/dist/first/first.test.js.map +0 -1
- package/dist/flatten/flatten.js +0 -46
- package/dist/flatten/flatten.js.map +0 -1
- package/dist/flatten/flatten.test.js +0 -63
- package/dist/flatten/flatten.test.js.map +0 -1
- package/dist/for-each/for-each.js +0 -25
- package/dist/for-each/for-each.js.map +0 -1
- package/dist/for-each/for-each.test.js +0 -41
- package/dist/for-each/for-each.test.js.map +0 -1
- package/dist/group-by/group-by.js +0 -38
- package/dist/group-by/group-by.js.map +0 -1
- package/dist/group-by/group-by.test.js +0 -86
- package/dist/group-by/group-by.test.js.map +0 -1
- package/dist/gt/gt.js +0 -25
- package/dist/gt/gt.js.map +0 -1
- package/dist/gt/gt.test.js +0 -11
- package/dist/gt/gt.test.js.map +0 -1
- package/dist/has-key/has-key.js +0 -8
- package/dist/has-key/has-key.js.map +0 -1
- package/dist/has-key/has-key.test.js +0 -14
- package/dist/has-key/has-key.test.js.map +0 -1
- package/dist/hist/hist.js +0 -73
- package/dist/hist/hist.js.map +0 -1
- package/dist/hist/hist.test.js +0 -47
- package/dist/hist/hist.test.js.map +0 -1
- package/dist/i/i.js +0 -11
- package/dist/i/i.js.map +0 -1
- package/dist/i/i.test.js +0 -21
- package/dist/i/i.test.js.map +0 -1
- package/dist/inc/inc.js +0 -18
- package/dist/inc/inc.js.map +0 -1
- package/dist/inc/inc.test.js +0 -8
- package/dist/inc/inc.test.js.map +0 -1
- package/dist/index-by/index-by.js +0 -36
- package/dist/index-by/index-by.js.map +0 -1
- package/dist/index-by/index-by.test.js +0 -48
- package/dist/index-by/index-by.test.js.map +0 -1
- package/dist/index.js +0 -99
- package/dist/index.js.map +0 -1
- package/dist/index.test.js +0 -10
- package/dist/index.test.js.map +0 -1
- package/dist/intersect/intersect.js +0 -113
- package/dist/intersect/intersect.js.map +0 -1
- package/dist/intersect/intersect.test.js +0 -79
- package/dist/intersect/intersect.test.js.map +0 -1
- package/dist/is/is.js +0 -40
- package/dist/is/is.js.map +0 -1
- package/dist/is/is.test.js +0 -28
- package/dist/is/is.test.js.map +0 -1
- package/dist/is-between/is-between.js +0 -30
- package/dist/is-between/is-between.js.map +0 -1
- package/dist/is-between/is-between.test.js +0 -18
- package/dist/is-between/is-between.test.js.map +0 -1
- package/dist/is-empty/is-empty.js +0 -53
- package/dist/is-empty/is-empty.js.map +0 -1
- package/dist/is-empty/is-empty.test.js +0 -35
- package/dist/is-empty/is-empty.test.js.map +0 -1
- package/dist/is-equal/is-equal.js +0 -31
- package/dist/is-equal/is-equal.js.map +0 -1
- package/dist/is-equal/is-equal.test.js +0 -22
- package/dist/is-equal/is-equal.test.js.map +0 -1
- package/dist/is-match/is-match.js +0 -58
- package/dist/is-match/is-match.js.map +0 -1
- package/dist/is-match/is-match.test.js +0 -72
- package/dist/is-match/is-match.test.js.map +0 -1
- package/dist/is-uri/is-uri.js +0 -24
- package/dist/is-uri/is-uri.js.map +0 -1
- package/dist/is-uri/is-uri.test.js +0 -16
- package/dist/is-uri/is-uri.test.js.map +0 -1
- package/dist/join/join.js +0 -74
- package/dist/join/join.js.map +0 -1
- package/dist/join/join.test.js +0 -99
- package/dist/join/join.test.js.map +0 -1
- package/dist/keys/keys.js +0 -56
- package/dist/keys/keys.js.map +0 -1
- package/dist/keys/keys.test.js +0 -25
- package/dist/keys/keys.test.js.map +0 -1
- package/dist/last/last.js +0 -22
- package/dist/last/last.js.map +0 -1
- package/dist/last/last.test.js +0 -18
- package/dist/last/last.test.js.map +0 -1
- package/dist/lt/lt.js +0 -27
- package/dist/lt/lt.js.map +0 -1
- package/dist/lt/lt.test.js +0 -10
- package/dist/lt/lt.test.js.map +0 -1
- package/dist/map/map.js +0 -40
- package/dist/map/map.js.map +0 -1
- package/dist/map/map.test.js +0 -66
- package/dist/map/map.test.js.map +0 -1
- package/dist/map-matrix/map-matrix.js +0 -43
- package/dist/map-matrix/map-matrix.js.map +0 -1
- package/dist/map-matrix/map-matrix.test.js +0 -82
- package/dist/map-matrix/map-matrix.test.js.map +0 -1
- package/dist/max/max.js +0 -60
- package/dist/max/max.js.map +0 -1
- package/dist/max/max.test.js +0 -50
- package/dist/max/max.test.js.map +0 -1
- package/dist/merge/merge.js +0 -79
- package/dist/merge/merge.js.map +0 -1
- package/dist/merge/merge.test.js +0 -61
- package/dist/merge/merge.test.js.map +0 -1
- package/dist/min/min.js +0 -60
- package/dist/min/min.js.map +0 -1
- package/dist/min/min.test.js +0 -45
- package/dist/min/min.test.js.map +0 -1
- package/dist/move/move.js +0 -48
- package/dist/move/move.js.map +0 -1
- package/dist/move/move.test.js +0 -62
- package/dist/move/move.test.js.map +0 -1
- package/dist/mutate/mutate.js +0 -89
- package/dist/mutate/mutate.js.map +0 -1
- package/dist/mutate/mutate.test.js +0 -114
- package/dist/mutate/mutate.test.js.map +0 -1
- package/dist/page/page.js +0 -26
- package/dist/page/page.js.map +0 -1
- package/dist/page/page.test.js +0 -70
- package/dist/page/page.test.js.map +0 -1
- package/dist/partition/partition.js +0 -60
- package/dist/partition/partition.js.map +0 -1
- package/dist/partition/partition.test.js +0 -104
- package/dist/partition/partition.test.js.map +0 -1
- package/dist/pick/pick.js +0 -42
- package/dist/pick/pick.js.map +0 -1
- package/dist/pick/pick.test.js +0 -26
- package/dist/pick/pick.test.js.map +0 -1
- package/dist/pipe/pipe.js +0 -37
- package/dist/pipe/pipe.js.map +0 -1
- package/dist/pipe/pipe.test.js +0 -15
- package/dist/pipe/pipe.test.js.map +0 -1
- package/dist/pipe-p/pipe-p.js +0 -47
- package/dist/pipe-p/pipe-p.js.map +0 -1
- package/dist/pipe-p/pipe-p.test.js +0 -27
- package/dist/pipe-p/pipe-p.test.js.map +0 -1
- package/dist/pluck/pluck.js +0 -65
- package/dist/pluck/pluck.js.map +0 -1
- package/dist/pluck/pluck.test.js +0 -61
- package/dist/pluck/pluck.test.js.map +0 -1
- package/dist/prepend/prepend.js +0 -28
- package/dist/prepend/prepend.js.map +0 -1
- package/dist/prepend/prepend.test.js +0 -41
- package/dist/prepend/prepend.test.js.map +0 -1
- package/dist/proto-chain/proto-chain.js +0 -21
- package/dist/proto-chain/proto-chain.js.map +0 -1
- package/dist/proto-chain/proto-chain.test.js +0 -25
- package/dist/proto-chain/proto-chain.test.js.map +0 -1
- package/dist/push/push.js +0 -27
- package/dist/push/push.js.map +0 -1
- package/dist/push/push.test.js +0 -22
- package/dist/push/push.test.js.map +0 -1
- package/dist/raise/raise.js +0 -6
- package/dist/raise/raise.js.map +0 -1
- package/dist/raise/raise.test.js +0 -10
- package/dist/raise/raise.test.js.map +0 -1
- package/dist/random/random.js +0 -13
- package/dist/random/random.js.map +0 -1
- package/dist/random/random.test.js +0 -21
- package/dist/random/random.test.js.map +0 -1
- package/dist/read/read.js +0 -80
- package/dist/read/read.js.map +0 -1
- package/dist/read/read.test.js +0 -110
- package/dist/read/read.test.js.map +0 -1
- package/dist/reduce/reduce.js +0 -49
- package/dist/reduce/reduce.js.map +0 -1
- package/dist/reduce/reduce.test.js +0 -49
- package/dist/reduce/reduce.test.js.map +0 -1
- package/dist/remove/remove.js +0 -90
- package/dist/remove/remove.js.map +0 -1
- package/dist/remove/remove.test.js +0 -98
- package/dist/remove/remove.test.js.map +0 -1
- package/dist/rename/rename.js +0 -77
- package/dist/rename/rename.js.map +0 -1
- package/dist/rename/rename.test.js +0 -49
- package/dist/rename/rename.test.js.map +0 -1
- package/dist/rename-file/rename-file.js +0 -23
- package/dist/rename-file/rename-file.js.map +0 -1
- package/dist/rename-file/rename-file.test.js +0 -13
- package/dist/rename-file/rename-file.test.js.map +0 -1
- package/dist/repeat/repeat.js +0 -46
- package/dist/repeat/repeat.js.map +0 -1
- package/dist/repeat/repeat.test.js +0 -33
- package/dist/repeat/repeat.test.js.map +0 -1
- package/dist/replace/replace.js +0 -102
- package/dist/replace/replace.js.map +0 -1
- package/dist/replace/replace.test.js +0 -132
- package/dist/replace/replace.test.js.map +0 -1
- package/dist/same/same.js +0 -13
- package/dist/same/same.js.map +0 -1
- package/dist/same/same.test.js +0 -9
- package/dist/same/same.test.js.map +0 -1
- package/dist/sequence/sequence.js +0 -36
- package/dist/sequence/sequence.js.map +0 -1
- package/dist/sequence/sequence.test.js +0 -139
- package/dist/sequence/sequence.test.js.map +0 -1
- package/dist/sort/sort-with.js +0 -130
- package/dist/sort/sort-with.js.map +0 -1
- package/dist/sort/sort.js +0 -70
- package/dist/sort/sort.js.map +0 -1
- package/dist/sort/sort.test.js +0 -413
- package/dist/sort/sort.test.js.map +0 -1
- package/dist/split/split.js +0 -44
- package/dist/split/split.js.map +0 -1
- package/dist/split/split.test.js +0 -32
- package/dist/split/split.test.js.map +0 -1
- package/dist/split-in-groups-of/split-in-groups-of.js +0 -49
- package/dist/split-in-groups-of/split-in-groups-of.js.map +0 -1
- package/dist/split-in-groups-of/split-in-groups-of.test.js +0 -87
- package/dist/split-in-groups-of/split-in-groups-of.test.js.map +0 -1
- package/dist/spy/spy.js +0 -35
- package/dist/spy/spy.js.map +0 -1
- package/dist/spy/spy.test.js +0 -37
- package/dist/spy/spy.test.js.map +0 -1
- package/dist/starts-with/starts-with.js +0 -35
- package/dist/starts-with/starts-with.js.map +0 -1
- package/dist/starts-with/starts-with.test.js +0 -37
- package/dist/starts-with/starts-with.test.js.map +0 -1
- package/dist/throttle/throttle.js +0 -47
- package/dist/throttle/throttle.js.map +0 -1
- package/dist/throttle/throttle.test.js +0 -41
- package/dist/throttle/throttle.test.js.map +0 -1
- package/dist/to-lower/to-lower.js +0 -21
- package/dist/to-lower/to-lower.js.map +0 -1
- package/dist/to-lower/to-lower.test.js +0 -9
- package/dist/to-lower/to-lower.test.js.map +0 -1
- package/dist/to-upper/to-upper.js +0 -21
- package/dist/to-upper/to-upper.js.map +0 -1
- package/dist/to-upper/to-upper.test.js +0 -9
- package/dist/to-upper/to-upper.test.js.map +0 -1
- package/dist/toggle/toggle.js +0 -35
- package/dist/toggle/toggle.js.map +0 -1
- package/dist/toggle/toggle.test.js +0 -28
- package/dist/toggle/toggle.test.js.map +0 -1
- package/dist/top/top.js +0 -62
- package/dist/top/top.js.map +0 -1
- package/dist/top/top.test.js +0 -51
- package/dist/top/top.test.js.map +0 -1
- package/dist/trim/trim.js +0 -41
- package/dist/trim/trim.js.map +0 -1
- package/dist/trim/trim.test.js +0 -10
- package/dist/trim/trim.test.js.map +0 -1
- package/dist/try-catch/try-catch.js +0 -37
- package/dist/try-catch/try-catch.js.map +0 -1
- package/dist/try-catch/try-catch.test.js +0 -14
- package/dist/try-catch/try-catch.test.js.map +0 -1
- package/dist/type/type.js +0 -29
- package/dist/type/type.js.map +0 -1
- package/dist/type/type.test.js +0 -19
- package/dist/type/type.test.js.map +0 -1
- package/dist/unite/unite.js +0 -22
- package/dist/unite/unite.js.map +0 -1
- package/dist/unite/unite.test.js +0 -12
- package/dist/unite/unite.test.js.map +0 -1
- package/dist/update/update.js +0 -85
- package/dist/update/update.js.map +0 -1
- package/dist/update/update.test.js +0 -99
- package/dist/update/update.test.js.map +0 -1
- package/dist/upsert/upsert.js +0 -19
- package/dist/upsert/upsert.js.map +0 -1
- package/dist/upsert/upsert.test.js +0 -61
- package/dist/upsert/upsert.test.js.map +0 -1
- package/dist/values/values.js +0 -60
- package/dist/values/values.js.map +0 -1
- package/dist/values/values.test.js +0 -25
- package/dist/values/values.test.js.map +0 -1
- package/dist/when/when.js +0 -51
- package/dist/when/when.js.map +0 -1
- package/dist/when/when.test.js +0 -30
- package/dist/when/when.test.js.map +0 -1
- package/dist/write/write.js +0 -28
- package/dist/write/write.js.map +0 -1
- package/dist/write/write.test.js +0 -18
- package/dist/write/write.test.js.map +0 -1
- package/dist/zip-to-object/zip-to-object.js +0 -28
- package/dist/zip-to-object/zip-to-object.js.map +0 -1
- package/dist/zip-to-object/zip-to-object.test.js +0 -33
- package/dist/zip-to-object/zip-to-object.test.js.map +0 -1
package/dist/find/find.test.js
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/* eslint-disable unicorn/no-null */ import test from "tape";
|
|
2
|
-
import { find, findWith } from "./find.js";
|
|
3
|
-
test("find", function(t) {
|
|
4
|
-
var comments = [
|
|
5
|
-
{
|
|
6
|
-
id: 1,
|
|
7
|
-
body: ""
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
id: 2,
|
|
11
|
-
body: "dolor"
|
|
12
|
-
}
|
|
13
|
-
];
|
|
14
|
-
t.deepEqual(find([
|
|
15
|
-
function(element) {
|
|
16
|
-
return element.id;
|
|
17
|
-
},
|
|
18
|
-
function(item) {
|
|
19
|
-
return item === 2;
|
|
20
|
-
}
|
|
21
|
-
], null, comments), {
|
|
22
|
-
id: 2,
|
|
23
|
-
body: "dolor"
|
|
24
|
-
}, "find with id:2 should return found object (uncurried multipe functions)");
|
|
25
|
-
t.deepEqual(find(function(element) {
|
|
26
|
-
return element.id === 2;
|
|
27
|
-
})(comments), {
|
|
28
|
-
id: 2,
|
|
29
|
-
body: "dolor"
|
|
30
|
-
}, "find with id:2 should return found object");
|
|
31
|
-
t.equal(find(function(element) {
|
|
32
|
-
return element.id === 3;
|
|
33
|
-
})(comments), undefined, "find with id:3 should return undefined (not found)");
|
|
34
|
-
t.deepEqual(find(function(element) {
|
|
35
|
-
return element.id === 3;
|
|
36
|
-
}, {})(comments), {}, "find with id:3 should return default not found value");
|
|
37
|
-
t.end();
|
|
38
|
-
});
|
|
39
|
-
test("findWith", function(t) {
|
|
40
|
-
var comments = [
|
|
41
|
-
{
|
|
42
|
-
id: 1,
|
|
43
|
-
body: ""
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
id: 2,
|
|
47
|
-
body: "dolor"
|
|
48
|
-
}
|
|
49
|
-
];
|
|
50
|
-
t.deepEqual(findWith({
|
|
51
|
-
id: 2,
|
|
52
|
-
body: function(input) {
|
|
53
|
-
return input === "dolor";
|
|
54
|
-
}
|
|
55
|
-
})(comments), {
|
|
56
|
-
id: 2,
|
|
57
|
-
body: "dolor"
|
|
58
|
-
}, "given [matching object with value and predicate fields] should [return existing item]");
|
|
59
|
-
t.deepEqual(findWith({
|
|
60
|
-
id: 2
|
|
61
|
-
})([]), undefined, "find with id:2 in empty array should return undefined");
|
|
62
|
-
t.deepEqual(findWith({
|
|
63
|
-
id: 2
|
|
64
|
-
})(comments), {
|
|
65
|
-
id: 2,
|
|
66
|
-
body: "dolor"
|
|
67
|
-
}, "find with id:2 should return found object");
|
|
68
|
-
t.equals(findWith({
|
|
69
|
-
id: 3
|
|
70
|
-
})(comments), undefined, "find with id:3 should return undefined (not found)");
|
|
71
|
-
t.deepEquals(findWith({
|
|
72
|
-
id: 3
|
|
73
|
-
}, {})(comments), {}, "find with id:3 should return default value (not found)");
|
|
74
|
-
t.end();
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
//# sourceMappingURL=find.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/find/find.test.js"],"sourcesContent":["/* eslint-disable unicorn/no-null */\n\nimport test from \"tape\"\n\nimport { find, findWith } from \"./find.js\"\n\ntest(\"find\", t => {\n const comments = [\n { id: 1, body: \"\" },\n { id: 2, body: \"dolor\" },\n ]\n\n t.deepEqual(\n find([element => element.id, item => item === 2], null, comments),\n { id: 2, body: \"dolor\" },\n \"find with id:2 should return found object (uncurried multipe functions)\"\n )\n\n t.deepEqual(\n find(element => element.id === 2)(comments),\n { id: 2, body: \"dolor\" },\n \"find with id:2 should return found object\"\n )\n\n t.equal(\n find(element => element.id === 3)(comments),\n undefined,\n \"find with id:3 should return undefined (not found)\"\n )\n\n t.deepEqual(\n find(element => element.id === 3, {})(comments),\n {},\n \"find with id:3 should return default not found value\"\n )\n\n t.end()\n})\n\ntest(\"findWith\", t => {\n const comments = [\n { id: 1, body: \"\" },\n { id: 2, body: \"dolor\" },\n ]\n\n t.deepEqual(\n findWith({\n id: 2,\n body: input => input === \"dolor\",\n })(comments),\n { id: 2, body: \"dolor\" },\n \"given [matching object with value and predicate fields] should [return existing item]\"\n )\n\n t.deepEqual(\n findWith({ id: 2 })([]),\n undefined,\n \"find with id:2 in empty array should return undefined\"\n )\n\n t.deepEqual(\n findWith({ id: 2 })(comments),\n { id: 2, body: \"dolor\" },\n \"find with id:2 should return found object\"\n )\n\n t.equals(\n findWith({ id: 3 })(comments),\n undefined,\n \"find with id:3 should return undefined (not found)\"\n )\n\n t.deepEquals(\n findWith({ id: 3 }, {})(comments),\n {},\n \"find with id:3 should return default value (not found)\"\n )\n t.end()\n})\n"],"names":["test","find","findWith","t","comments","id","body","deepEqual","element","item","equal","undefined","end","input","equals","deepEquals"],"mappings":"AAAA,kCAAkC,GAElC,OAAOA,UAAU,OAAM;AAEvB,SAASC,IAAI,EAAEC,QAAQ,QAAQ,YAAW;AAE1CF,KAAK,QAAQG,SAAAA,GAAK;IAChB,IAAMC,WAAW;QACf;YAAEC,IAAI;YAAGC,MAAM;QAAG;QAClB;YAAED,IAAI;YAAGC,MAAM;QAAQ;KACxB;IAEDH,EAAEI,SAAS,CACTN,KAAK;QAACO,SAAAA;mBAAWA,QAAQH,EAAE;;QAAEI,SAAAA;mBAAQA,SAAS;;KAAE,EAAE,IAAI,EAAEL,WACxD;QAAEC,IAAI;QAAGC,MAAM;IAAQ,GACvB;IAGFH,EAAEI,SAAS,CACTN,KAAKO,SAAAA;eAAWA,QAAQH,EAAE,KAAK;OAAGD,WAClC;QAAEC,IAAI;QAAGC,MAAM;IAAQ,GACvB;IAGFH,EAAEO,KAAK,CACLT,KAAKO,SAAAA;eAAWA,QAAQH,EAAE,KAAK;OAAGD,WAClCO,WACA;IAGFR,EAAEI,SAAS,CACTN,KAAKO,SAAAA;eAAWA,QAAQH,EAAE,KAAK;OAAG,CAAC,GAAGD,WACtC,CAAC,GACD;IAGFD,EAAES,GAAG;AACP;AAEAZ,KAAK,YAAYG,SAAAA,GAAK;IACpB,IAAMC,WAAW;QACf;YAAEC,IAAI;YAAGC,MAAM;QAAG;QAClB;YAAED,IAAI;YAAGC,MAAM;QAAQ;KACxB;IAEDH,EAAEI,SAAS,CACTL,SAAS;QACPG,IAAI;QACJC,MAAMO,SAAAA;mBAASA,UAAU;;IAC3B,GAAGT,WACH;QAAEC,IAAI;QAAGC,MAAM;IAAQ,GACvB;IAGFH,EAAEI,SAAS,CACTL,SAAS;QAAEG,IAAI;IAAE,GAAG,EAAE,GACtBM,WACA;IAGFR,EAAEI,SAAS,CACTL,SAAS;QAAEG,IAAI;IAAE,GAAGD,WACpB;QAAEC,IAAI;QAAGC,MAAM;IAAQ,GACvB;IAGFH,EAAEW,MAAM,CACNZ,SAAS;QAAEG,IAAI;IAAE,GAAGD,WACpBO,WACA;IAGFR,EAAEY,UAAU,CACVb,SAAS;QAAEG,IAAI;IAAE,GAAG,CAAC,GAAGD,WACxB,CAAC,GACD;IAEFD,EAAES,GAAG;AACP"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs";
|
|
2
|
-
import { pipe } from "../pipe/pipe.js";
|
|
3
|
-
import { curry } from "../curry/curry.js";
|
|
4
|
-
import { isMatch } from "../is-match/is-match.js";
|
|
5
|
-
var _findIndex = function(_fn, _input) {
|
|
6
|
-
var fn = Array.isArray(_fn) ? pipe.apply(void 0, _to_consumable_array(_fn)) : _fn;
|
|
7
|
-
var input = Array.isArray(_input) ? _input : [
|
|
8
|
-
_input
|
|
9
|
-
];
|
|
10
|
-
for(var i = 0, length = input.length; i < length; i++){
|
|
11
|
-
var found = fn(input[i], i, input);
|
|
12
|
-
if (found === true) {
|
|
13
|
-
return i;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return -1;
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Find the position the first element that satisfies a predicate function
|
|
20
|
-
*
|
|
21
|
-
* @param {Function|Function[]} fn Predicate applied to each element
|
|
22
|
-
* @param {Object[]} source Source array to iterate over
|
|
23
|
-
*
|
|
24
|
-
* @returns {number} Position of found element or -1 if not found
|
|
25
|
-
*
|
|
26
|
-
* @name findIndex
|
|
27
|
-
* @tag Array
|
|
28
|
-
* @signature (fn: Function, source: Object[]): Number
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* const comments = [{id: 1, body: ""}, {id: 2, body: "dolor"}]
|
|
32
|
-
*
|
|
33
|
-
* findIndex(item => item.body === "lorem")(comments)
|
|
34
|
-
* // => -1
|
|
35
|
-
*
|
|
36
|
-
* findIndex([get("body"), equals("dolor")], null, comments)
|
|
37
|
-
* // => 1
|
|
38
|
-
*/ export var findIndex = curry(_findIndex);
|
|
39
|
-
export var findIndexWith = curry(function(subset, input) {
|
|
40
|
-
return _findIndex(isMatch(subset), input);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
//# sourceMappingURL=find-index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/find-index/find-index.js"],"sourcesContent":["import { pipe } from \"../pipe/pipe.js\"\nimport { curry } from \"../curry/curry.js\"\nimport { isMatch } from \"../is-match/is-match.js\"\n\nconst _findIndex = (_fn, _input) => {\n const fn = Array.isArray(_fn) ? pipe(..._fn) : _fn\n const input = Array.isArray(_input) ? _input : [_input]\n\n for (let i = 0, length = input.length; i < length; i++) {\n const found = fn(input[i], i, input)\n\n if (found === true) {\n return i\n }\n }\n\n return -1\n}\n\n/**\n * Find the position the first element that satisfies a predicate function\n *\n * @param {Function|Function[]} fn Predicate applied to each element\n * @param {Object[]} source Source array to iterate over\n *\n * @returns {number} Position of found element or -1 if not found\n *\n * @name findIndex\n * @tag Array\n * @signature (fn: Function, source: Object[]): Number\n *\n * @example\n * const comments = [{id: 1, body: \"\"}, {id: 2, body: \"dolor\"}]\n *\n * findIndex(item => item.body === \"lorem\")(comments)\n * // => -1\n *\n * findIndex([get(\"body\"), equals(\"dolor\")], null, comments)\n * // => 1\n */\nexport const findIndex = curry(_findIndex)\n\nexport const findIndexWith = curry((subset, input) =>\n _findIndex(isMatch(subset), input)\n)\n"],"names":["pipe","curry","isMatch","_findIndex","_fn","_input","fn","Array","isArray","input","i","length","found","findIndex","findIndexWith","subset"],"mappings":"AAAA;AAAA,SAASA,IAAI,QAAQ,kBAAiB;AACtC,SAASC,KAAK,QAAQ,oBAAmB;AACzC,SAASC,OAAO,QAAQ,0BAAyB;AAEjD,IAAMC,aAAa,SAACC,KAAKC,QAAW;IAClC,IAAMC,KAAKC,MAAMC,OAAO,CAACJ,OAAOJ,KAAAA,MAAAA,KAAAA,GAAK,qBAAGI,QAAOA,GAAG;IAClD,IAAMK,QAAQF,MAAMC,OAAO,CAACH,UAAUA,SAAS;QAACA;KAAO;IAEvD,IAAK,IAAIK,IAAI,GAAGC,SAASF,MAAME,MAAM,EAAED,IAAIC,QAAQD,IAAK;QACtD,IAAME,QAAQN,GAAGG,KAAK,CAACC,EAAE,EAAEA,GAAGD;QAE9B,IAAIG,UAAU,IAAI,EAAE;YAClB,OAAOF;QACT,CAAC;IACH;IAEA,OAAO,CAAC;AACV;AAEA;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,IAAMG,YAAYZ,MAAME,YAAW;AAE1C,OAAO,IAAMW,gBAAgBb,MAAM,SAACc,QAAQN;WAC1CN,WAAWD,QAAQa,SAASN;GAC7B"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import test from "tape";
|
|
2
|
-
import { findIndex, findIndexWith } from "./find-index.js";
|
|
3
|
-
test("findIndex", function(t) {
|
|
4
|
-
var comments = [
|
|
5
|
-
{
|
|
6
|
-
id: 1,
|
|
7
|
-
body: ""
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
id: 2,
|
|
11
|
-
body: "dolor"
|
|
12
|
-
}
|
|
13
|
-
];
|
|
14
|
-
t.equals(findIndex(function(element) {
|
|
15
|
-
return element.id === 2;
|
|
16
|
-
})(comments), 1, "index with id:2 should be 1");
|
|
17
|
-
t.equals(findIndex([
|
|
18
|
-
function(element) {
|
|
19
|
-
return element.id;
|
|
20
|
-
},
|
|
21
|
-
function(item) {
|
|
22
|
-
return item === 2;
|
|
23
|
-
}
|
|
24
|
-
], comments), 1, "index with id:2 should be 1 (uncurried multipe functions)");
|
|
25
|
-
t.equals(findIndex(function(element) {
|
|
26
|
-
return element.id === 3;
|
|
27
|
-
})(comments), -1, "index with id:3 should be -1 (not found)");
|
|
28
|
-
t.end();
|
|
29
|
-
});
|
|
30
|
-
test("findIndexWith", function(t) {
|
|
31
|
-
var comments = [
|
|
32
|
-
{
|
|
33
|
-
id: 1,
|
|
34
|
-
body: ""
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
id: 2,
|
|
38
|
-
body: "dolor"
|
|
39
|
-
}
|
|
40
|
-
];
|
|
41
|
-
t.equals(findIndexWith({
|
|
42
|
-
id: 2
|
|
43
|
-
})([]), -1, "index of id:2 in empty array should be -1");
|
|
44
|
-
t.equals(findIndexWith({
|
|
45
|
-
id: 2
|
|
46
|
-
})(comments), 1, "index of id:2 should be 1");
|
|
47
|
-
t.equals(findIndexWith({
|
|
48
|
-
id: 3
|
|
49
|
-
})(comments), -1, "index id:3 should be -1 (not found)");
|
|
50
|
-
t.end();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
//# sourceMappingURL=find-index.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/find-index/find-index.test.js"],"sourcesContent":["import test from \"tape\"\n\nimport { findIndex, findIndexWith } from \"./find-index.js\"\n\ntest(\"findIndex\", t => {\n const comments = [\n { id: 1, body: \"\" },\n { id: 2, body: \"dolor\" },\n ]\n\n t.equals(\n findIndex(element => element.id === 2)(comments),\n 1,\n \"index with id:2 should be 1\"\n )\n\n t.equals(\n findIndex([element => element.id, item => item === 2], comments),\n 1,\n \"index with id:2 should be 1 (uncurried multipe functions)\"\n )\n\n t.equals(\n findIndex(element => element.id === 3)(comments),\n -1,\n \"index with id:3 should be -1 (not found)\"\n )\n\n t.end()\n})\n\ntest(\"findIndexWith\", t => {\n const comments = [\n { id: 1, body: \"\" },\n { id: 2, body: \"dolor\" },\n ]\n\n t.equals(\n findIndexWith({ id: 2 })([]),\n -1,\n \"index of id:2 in empty array should be -1\"\n )\n\n t.equals(findIndexWith({ id: 2 })(comments), 1, \"index of id:2 should be 1\")\n\n t.equals(\n findIndexWith({ id: 3 })(comments),\n -1,\n \"index id:3 should be -1 (not found)\"\n )\n\n t.end()\n})\n"],"names":["test","findIndex","findIndexWith","t","comments","id","body","equals","element","item","end"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AAEvB,SAASC,SAAS,EAAEC,aAAa,QAAQ,kBAAiB;AAE1DF,KAAK,aAAaG,SAAAA,GAAK;IACrB,IAAMC,WAAW;QACf;YAAEC,IAAI;YAAGC,MAAM;QAAG;QAClB;YAAED,IAAI;YAAGC,MAAM;QAAQ;KACxB;IAEDH,EAAEI,MAAM,CACNN,UAAUO,SAAAA;eAAWA,QAAQH,EAAE,KAAK;OAAGD,WACvC,GACA;IAGFD,EAAEI,MAAM,CACNN,UAAU;QAACO,SAAAA;mBAAWA,QAAQH,EAAE;;QAAEI,SAAAA;mBAAQA,SAAS;;KAAE,EAAEL,WACvD,GACA;IAGFD,EAAEI,MAAM,CACNN,UAAUO,SAAAA;eAAWA,QAAQH,EAAE,KAAK;OAAGD,WACvC,CAAC,GACD;IAGFD,EAAEO,GAAG;AACP;AAEAV,KAAK,iBAAiBG,SAAAA,GAAK;IACzB,IAAMC,WAAW;QACf;YAAEC,IAAI;YAAGC,MAAM;QAAG;QAClB;YAAED,IAAI;YAAGC,MAAM;QAAQ;KACxB;IAEDH,EAAEI,MAAM,CACNL,cAAc;QAAEG,IAAI;IAAE,GAAG,EAAE,GAC3B,CAAC,GACD;IAGFF,EAAEI,MAAM,CAACL,cAAc;QAAEG,IAAI;IAAE,GAAGD,WAAW,GAAG;IAEhDD,EAAEI,MAAM,CACNL,cAAc;QAAEG,IAAI;IAAE,GAAGD,WACzB,CAAC,GACD;IAGFD,EAAEO,GAAG;AACP"}
|
package/dist/first/first.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get left most element of array
|
|
3
|
-
*
|
|
4
|
-
* @param {Array} input The source
|
|
5
|
-
*
|
|
6
|
-
* @returns {any}
|
|
7
|
-
*
|
|
8
|
-
* @tag Array
|
|
9
|
-
* @signature (source: Array): mixed
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* first([1, 2, 3])
|
|
13
|
-
* // => 1
|
|
14
|
-
*
|
|
15
|
-
* first([])
|
|
16
|
-
* // => undefined
|
|
17
|
-
*/ export var first = function(input) {
|
|
18
|
-
return (Array.isArray(input) || typeof input === "string") && input.length !== 0 ? input[0] : undefined;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
//# sourceMappingURL=first.js.map
|
package/dist/first/first.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/first/first.js"],"sourcesContent":["/**\n * Get left most element of array\n *\n * @param {Array} input The source\n *\n * @returns {any}\n *\n * @tag Array\n * @signature (source: Array): mixed\n *\n * @example\n * first([1, 2, 3])\n * // => 1\n *\n * first([])\n * // => undefined\n */\nexport const first = input =>\n (Array.isArray(input) || typeof input === \"string\") && input.length !== 0\n ? input[0]\n : undefined\n"],"names":["first","input","Array","isArray","length","undefined"],"mappings":"AAAA;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,IAAMA,QAAQC,SAAAA;WACnB,AAACC,CAAAA,MAAMC,OAAO,CAACF,UAAU,OAAOA,UAAU,QAAO,KAAMA,MAAMG,MAAM,KAAK,IACpEH,KAAK,CAAC,EAAE,GACRI,SAAS;EAAA"}
|
package/dist/first/first.test.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import test from "tape";
|
|
2
|
-
import { first } from "./first.js";
|
|
3
|
-
test("first", function(t) {
|
|
4
|
-
t.equal(first("xyz"), "x", "From string should return first char");
|
|
5
|
-
t.equal(first([
|
|
6
|
-
1,
|
|
7
|
-
2,
|
|
8
|
-
3
|
|
9
|
-
]), 1, "From number array should return first element");
|
|
10
|
-
t.equal(first([]), undefined, "From empty array should return undefined");
|
|
11
|
-
t.equal(first(2), undefined, "From number should return undefined");
|
|
12
|
-
t.equal(first({}), undefined, "From object should return undefined");
|
|
13
|
-
t.equal(first(function() {}), undefined, "From function should return undefined");
|
|
14
|
-
t.end();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=first.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/first/first.test.js"],"sourcesContent":["import test from \"tape\"\n\nimport { first } from \"./first.js\"\n\ntest(\"first\", t => {\n t.equal(first(\"xyz\"), \"x\", \"From string should return first char\")\n t.equal(first([1, 2, 3]), 1, \"From number array should return first element\")\n t.equal(first([]), undefined, \"From empty array should return undefined\")\n t.equal(first(2), undefined, \"From number should return undefined\")\n t.equal(first({}), undefined, \"From object should return undefined\")\n t.equal(\n first(() => {}),\n undefined,\n \"From function should return undefined\"\n )\n\n t.end()\n})\n"],"names":["test","first","t","equal","undefined","end"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AAEvB,SAASC,KAAK,QAAQ,aAAY;AAElCD,KAAK,SAASE,SAAAA,GAAK;IACjBA,EAAEC,KAAK,CAACF,MAAM,QAAQ,KAAK;IAC3BC,EAAEC,KAAK,CAACF,MAAM;QAAC;QAAG;QAAG;KAAE,GAAG,GAAG;IAC7BC,EAAEC,KAAK,CAACF,MAAM,EAAE,GAAGG,WAAW;IAC9BF,EAAEC,KAAK,CAACF,MAAM,IAAIG,WAAW;IAC7BF,EAAEC,KAAK,CAACF,MAAM,CAAC,IAAIG,WAAW;IAC9BF,EAAEC,KAAK,CACLF,MAAM,WAAM,CAAC,IACbG,WACA;IAGFF,EAAEG,GAAG;AACP"}
|
package/dist/flatten/flatten.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import _define_property from "@swc/helpers/src/_define_property.mjs";
|
|
2
|
-
import _object_spread from "@swc/helpers/src/_object_spread.mjs";
|
|
3
|
-
import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs";
|
|
4
|
-
import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs";
|
|
5
|
-
import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs";
|
|
6
|
-
import { reduce } from "../reduce/reduce.js";
|
|
7
|
-
import { is, isObject } from "../is/is.js";
|
|
8
|
-
var flattenArray = reduce(function(acc, item) {
|
|
9
|
-
return Array.isArray(item) ? _to_consumable_array(acc).concat(_to_consumable_array(flattenArray(item))) : _to_consumable_array(acc).concat([
|
|
10
|
-
item
|
|
11
|
-
]);
|
|
12
|
-
}, []);
|
|
13
|
-
var flattenObject = function(input, prefix) {
|
|
14
|
-
return reduce(function(acc, param) {
|
|
15
|
-
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
16
|
-
return isObject(value) ? _object_spread({}, acc, flattenObject(value, is(prefix) ? "".concat(prefix, "__").concat(key) : key)) : _object_spread_props(_object_spread({}, acc), _define_property({}, is(prefix) ? "".concat(prefix, "__").concat(key) : key, value));
|
|
17
|
-
}, {})(Object.entries(input));
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Recursively concat all arrays intro a single array
|
|
21
|
-
*
|
|
22
|
-
* @param {Array|Object} input Array or Object to flatten
|
|
23
|
-
*
|
|
24
|
-
* @returns {Array} 1 level deep array
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* flatten([1, [2], [3, [4]]])
|
|
28
|
-
* // => [1, 2, 3, 4]
|
|
29
|
-
*
|
|
30
|
-
* flatten({test: {a: 1, b: {c: 2}}})
|
|
31
|
-
* // => {
|
|
32
|
-
* test__a: 1,
|
|
33
|
-
* test__b__c: 2
|
|
34
|
-
* }
|
|
35
|
-
*/ var flatten = function(input) {
|
|
36
|
-
if (Array.isArray(input)) {
|
|
37
|
-
return flattenArray(input);
|
|
38
|
-
}
|
|
39
|
-
if (typeof input === "object") {
|
|
40
|
-
return flattenObject(input);
|
|
41
|
-
}
|
|
42
|
-
return input;
|
|
43
|
-
};
|
|
44
|
-
export { flatten };
|
|
45
|
-
|
|
46
|
-
//# sourceMappingURL=flatten.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/flatten/flatten.js"],"sourcesContent":["import { reduce } from \"../reduce/reduce.js\"\nimport { is, isObject } from \"../is/is.js\"\n\nconst flattenArray = reduce(\n (acc, item) =>\n Array.isArray(item) ? [...acc, ...flattenArray(item)] : [...acc, item],\n []\n)\n\nconst flattenObject = (input, prefix) =>\n reduce((acc, [key, value]) => {\n return isObject(value)\n ? {\n ...acc,\n ...flattenObject(value, is(prefix) ? `${prefix}__${key}` : key),\n }\n : {\n ...acc,\n [is(prefix) ? `${prefix}__${key}` : key]: value,\n }\n }, {})(Object.entries(input))\n\n/**\n * Recursively concat all arrays intro a single array\n *\n * @param {Array|Object} input Array or Object to flatten\n *\n * @returns {Array} 1 level deep array\n *\n * @example\n * flatten([1, [2], [3, [4]]])\n * // => [1, 2, 3, 4]\n *\n * flatten({test: {a: 1, b: {c: 2}}})\n * // => {\n * test__a: 1,\n * test__b__c: 2\n * }\n */\nconst flatten = input => {\n if (Array.isArray(input)) {\n return flattenArray(input)\n }\n\n if (typeof input === \"object\") {\n return flattenObject(input)\n }\n\n return input\n}\n\nexport { flatten }\n"],"names":["reduce","is","isObject","flattenArray","acc","item","Array","isArray","flattenObject","input","prefix","key","value","Object","entries","flatten"],"mappings":"AAAA;;;;;AAAA,SAASA,MAAM,QAAQ,sBAAqB;AAC5C,SAASC,EAAE,EAAEC,QAAQ,QAAQ,cAAa;AAE1C,IAAMC,eAAeH,OACnB,SAACI,KAAKC;WACJC,MAAMC,OAAO,CAACF,QAAQ,AAAC,qBAAGD,YAAK,qBAAGD,aAAaE,UAAS,AAAC,qBAAGD,YAAJ;QAASC;KAAK,CAAA;GACxE,EAAE;AAGJ,IAAMG,gBAAgB,SAACC,OAAOC;WAC5BV,OAAO,SAACI,YAAsB;iDAAhBO,iBAAKC;QACjB,OAAOV,SAASU,SACZ,mBACKR,KACAI,cAAcI,OAAOX,GAAGS,UAAU,AAAC,GAAaC,OAAXD,QAAO,MAAQ,OAAJC,OAAQA,GAAG,KAEhE,wCACKP,MACH,qBAACH,GAAGS,UAAU,AAAC,GAAaC,OAAXD,QAAO,MAAQ,OAAJC,OAAQA,GAAG,EAAGC,OAC3C;IACP,GAAG,CAAC,GAAGC,OAAOC,OAAO,CAACL;;AAExB;;;;;;;;;;;;;;;;CAgBC,GACD,IAAMM,UAAUN,SAAAA,OAAS;IACvB,IAAIH,MAAMC,OAAO,CAACE,QAAQ;QACxB,OAAON,aAAaM;IACtB,CAAC;IAED,IAAI,OAAOA,UAAU,UAAU;QAC7B,OAAOD,cAAcC;IACvB,CAAC;IAED,OAAOA;AACT;AAEA,SAASM,OAAO,GAAE"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import test from "tape";
|
|
2
|
-
import { flatten } from "./flatten.js";
|
|
3
|
-
test("flatten", function(t) {
|
|
4
|
-
t.equals(flatten(3), 3, "Flatten primitive returns same value");
|
|
5
|
-
t.deepEqual(flatten([]), [], "[] should equal []");
|
|
6
|
-
t.deepEqual(flatten([
|
|
7
|
-
[
|
|
8
|
-
[]
|
|
9
|
-
]
|
|
10
|
-
]), [], "[[[]]] should equal []");
|
|
11
|
-
t.deepEqual(flatten([
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
1
|
|
15
|
-
]
|
|
16
|
-
]
|
|
17
|
-
]), [
|
|
18
|
-
1
|
|
19
|
-
], "[[[1]]] should equal [1]");
|
|
20
|
-
t.deepEqual(flatten([
|
|
21
|
-
1,
|
|
22
|
-
[
|
|
23
|
-
2
|
|
24
|
-
],
|
|
25
|
-
[
|
|
26
|
-
3,
|
|
27
|
-
[
|
|
28
|
-
4
|
|
29
|
-
]
|
|
30
|
-
]
|
|
31
|
-
]), [
|
|
32
|
-
1,
|
|
33
|
-
2,
|
|
34
|
-
3,
|
|
35
|
-
4
|
|
36
|
-
], "[1, [2], [3, [4]], []] should equal [1, 2, 3, 4]");
|
|
37
|
-
t.deepEqual(flatten({
|
|
38
|
-
test: {
|
|
39
|
-
inside: "one",
|
|
40
|
-
another: "two",
|
|
41
|
-
lvl: {
|
|
42
|
-
three: "3"
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
lorem: "ipsum",
|
|
46
|
-
an_array: [
|
|
47
|
-
1,
|
|
48
|
-
2
|
|
49
|
-
]
|
|
50
|
-
}), {
|
|
51
|
-
test__inside: "one",
|
|
52
|
-
test__another: "two",
|
|
53
|
-
test__lvl__three: "3",
|
|
54
|
-
lorem: "ipsum",
|
|
55
|
-
an_array: [
|
|
56
|
-
1,
|
|
57
|
-
2
|
|
58
|
-
]
|
|
59
|
-
}, "Nested objects should return one lvl deep object");
|
|
60
|
-
t.end();
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
//# sourceMappingURL=flatten.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/flatten/flatten.test.js"],"sourcesContent":["import test from \"tape\"\n\nimport { flatten } from \"./flatten.js\"\n\ntest(\"flatten\", t => {\n t.equals(flatten(3), 3, \"Flatten primitive returns same value\")\n t.deepEqual(flatten([]), [], \"[] should equal []\")\n t.deepEqual(flatten([[[]]]), [], \"[[[]]] should equal []\")\n t.deepEqual(flatten([[[1]]]), [1], \"[[[1]]] should equal [1]\")\n t.deepEqual(\n flatten([1, [2], [3, [4]]]),\n [1, 2, 3, 4],\n \"[1, [2], [3, [4]], []] should equal [1, 2, 3, 4]\"\n )\n\n t.deepEqual(\n flatten({\n test: {\n inside: \"one\",\n another: \"two\",\n lvl: {\n three: \"3\",\n },\n },\n lorem: \"ipsum\",\n an_array: [1, 2],\n }),\n {\n test__inside: \"one\",\n test__another: \"two\",\n test__lvl__three: \"3\",\n lorem: \"ipsum\",\n an_array: [1, 2],\n },\n \"Nested objects should return one lvl deep object\"\n )\n\n t.end()\n})\n"],"names":["test","flatten","t","equals","deepEqual","inside","another","lvl","three","lorem","an_array","test__inside","test__another","test__lvl__three","end"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AAEvB,SAASC,OAAO,QAAQ,eAAc;AAEtCD,KAAK,WAAWE,SAAAA,GAAK;IACnBA,EAAEC,MAAM,CAACF,QAAQ,IAAI,GAAG;IACxBC,EAAEE,SAAS,CAACH,QAAQ,EAAE,GAAG,EAAE,EAAE;IAC7BC,EAAEE,SAAS,CAACH,QAAQ;QAAC;YAAC,EAAE;SAAC;KAAC,GAAG,EAAE,EAAE;IACjCC,EAAEE,SAAS,CAACH,QAAQ;QAAC;YAAC;gBAAC;aAAE;SAAC;KAAC,GAAG;QAAC;KAAE,EAAE;IACnCC,EAAEE,SAAS,CACTH,QAAQ;QAAC;QAAG;YAAC;SAAE;QAAE;YAAC;YAAG;gBAAC;aAAE;SAAC;KAAC,GAC1B;QAAC;QAAG;QAAG;QAAG;KAAE,EACZ;IAGFC,EAAEE,SAAS,CACTH,QAAQ;QACND,MAAM;YACJK,QAAQ;YACRC,SAAS;YACTC,KAAK;gBACHC,OAAO;YACT;QACF;QACAC,OAAO;QACPC,UAAU;YAAC;YAAG;SAAE;IAClB,IACA;QACEC,cAAc;QACdC,eAAe;QACfC,kBAAkB;QAClBJ,OAAO;QACPC,UAAU;YAAC;YAAG;SAAE;IAClB,GACA;IAGFR,EAAEY,GAAG;AACP"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs";
|
|
2
|
-
import { curry } from "../curry/curry.js";
|
|
3
|
-
import { pipe } from "../pipe/pipe.js";
|
|
4
|
-
var _forEach = function(_fn, _input) {
|
|
5
|
-
var fn = Array.isArray(_fn) ? pipe.apply(void 0, _to_consumable_array(_fn)) : _fn;
|
|
6
|
-
var input = Array.isArray(_input) ? _input : [
|
|
7
|
-
_input
|
|
8
|
-
];
|
|
9
|
-
for(var i = 0, length = input.length; i < length; i++){
|
|
10
|
-
fn(input[i], i, input);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Call `fn` over each element of an array
|
|
15
|
-
*
|
|
16
|
-
* @param {Function|Function[]} fn Iterator function
|
|
17
|
-
* @param {Array} source Source array
|
|
18
|
-
*
|
|
19
|
-
* @returns {undefined}
|
|
20
|
-
*
|
|
21
|
-
* @tag Array
|
|
22
|
-
* @signature (fn: Function|Function[], source: Array): undefined
|
|
23
|
-
*/ export var forEach = curry(_forEach);
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=for-each.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/for-each/for-each.js"],"sourcesContent":["import { curry } from \"../curry/curry.js\"\nimport { pipe } from \"../pipe/pipe.js\"\n\nconst _forEach = (_fn, _input) => {\n const fn = Array.isArray(_fn) ? pipe(..._fn) : _fn\n const input = Array.isArray(_input) ? _input : [_input]\n\n for (let i = 0, length = input.length; i < length; i++) {\n fn(input[i], i, input)\n }\n}\n\n/**\n * Call `fn` over each element of an array\n *\n * @param {Function|Function[]} fn Iterator function\n * @param {Array} source Source array\n *\n * @returns {undefined}\n *\n * @tag Array\n * @signature (fn: Function|Function[], source: Array): undefined\n */\nexport const forEach = curry(_forEach)\n"],"names":["curry","pipe","_forEach","_fn","_input","fn","Array","isArray","input","i","length","forEach"],"mappings":"AAAA;AAAA,SAASA,KAAK,QAAQ,oBAAmB;AACzC,SAASC,IAAI,QAAQ,kBAAiB;AAEtC,IAAMC,WAAW,SAACC,KAAKC,QAAW;IAChC,IAAMC,KAAKC,MAAMC,OAAO,CAACJ,OAAOF,KAAAA,MAAAA,KAAAA,GAAK,qBAAGE,QAAOA,GAAG;IAClD,IAAMK,QAAQF,MAAMC,OAAO,CAACH,UAAUA,SAAS;QAACA;KAAO;IAEvD,IAAK,IAAIK,IAAI,GAAGC,SAASF,MAAME,MAAM,EAAED,IAAIC,QAAQD,IAAK;QACtDJ,GAAGG,KAAK,CAACC,EAAE,EAAEA,GAAGD;IAClB;AACF;AAEA;;;;;;;;;;CAUC,GACD,OAAO,IAAMG,UAAUX,MAAME,UAAS"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import test from "tape";
|
|
2
|
-
import { inc } from "../inc/inc.js";
|
|
3
|
-
import { forEach } from "./for-each.js";
|
|
4
|
-
test("forEach", function(t) {
|
|
5
|
-
{
|
|
6
|
-
var temporary = [];
|
|
7
|
-
forEach(function(item) {
|
|
8
|
-
return temporary.push(item);
|
|
9
|
-
})([
|
|
10
|
-
1,
|
|
11
|
-
2,
|
|
12
|
-
3
|
|
13
|
-
]);
|
|
14
|
-
t.deepEqual(temporary, [
|
|
15
|
-
1,
|
|
16
|
-
2,
|
|
17
|
-
3
|
|
18
|
-
], "Run function over each element of array");
|
|
19
|
-
}
|
|
20
|
-
{
|
|
21
|
-
var temporary1 = [];
|
|
22
|
-
forEach([
|
|
23
|
-
inc,
|
|
24
|
-
function(item) {
|
|
25
|
-
return temporary1.push(item);
|
|
26
|
-
}
|
|
27
|
-
], [
|
|
28
|
-
1,
|
|
29
|
-
2,
|
|
30
|
-
3
|
|
31
|
-
]);
|
|
32
|
-
t.deepEqual(temporary1, [
|
|
33
|
-
2,
|
|
34
|
-
3,
|
|
35
|
-
4
|
|
36
|
-
], "Run piped functions over each element of array");
|
|
37
|
-
}
|
|
38
|
-
t.end();
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
//# sourceMappingURL=for-each.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/for-each/for-each.test.js"],"sourcesContent":["import test from \"tape\"\n\nimport { inc } from \"../inc/inc.js\"\nimport { forEach } from \"./for-each.js\"\n\ntest(\"forEach\", t => {\n {\n const temporary = []\n\n forEach(item => temporary.push(item))([1, 2, 3])\n\n t.deepEqual(temporary, [1, 2, 3], \"Run function over each element of array\")\n }\n\n {\n const temporary = []\n\n forEach([inc, item => temporary.push(item)], [1, 2, 3])\n\n t.deepEqual(\n temporary,\n [2, 3, 4],\n \"Run piped functions over each element of array\"\n )\n }\n\n t.end()\n})\n"],"names":["test","inc","forEach","t","temporary","item","push","deepEqual","end"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AAEvB,SAASC,GAAG,QAAQ,gBAAe;AACnC,SAASC,OAAO,QAAQ,gBAAe;AAEvCF,KAAK,WAAWG,SAAAA,GAAK;IACnB;QACE,IAAMC,YAAY,EAAE;QAEpBF,QAAQG,SAAAA;mBAAQD,UAAUE,IAAI,CAACD;WAAO;YAAC;YAAG;YAAG;SAAE;QAE/CF,EAAEI,SAAS,CAACH,WAAW;YAAC;YAAG;YAAG;SAAE,EAAE;IACpC;IAEA;QACE,IAAMA,aAAY,EAAE;QAEpBF,QAAQ;YAACD;YAAKI,SAAAA;uBAAQD,WAAUE,IAAI,CAACD;;SAAM,EAAE;YAAC;YAAG;YAAG;SAAE;QAEtDF,EAAEI,SAAS,CACTH,YACA;YAAC;YAAG;YAAG;SAAE,EACT;IAEJ;IAEAD,EAAEK,GAAG;AACP"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { curry } from "../curry/curry.js";
|
|
2
|
-
var _groupBy = function(field, input) {
|
|
3
|
-
var result = {};
|
|
4
|
-
for(var i = 0, length = input.length; i < length; i++){
|
|
5
|
-
var groupKey = String(input[i][field]);
|
|
6
|
-
if (result[groupKey]) {
|
|
7
|
-
result[groupKey].push(input[i]);
|
|
8
|
-
} else {
|
|
9
|
-
result[groupKey] = [
|
|
10
|
-
input[i]
|
|
11
|
-
];
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return Object.values(result);
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Group an array of objects by field.
|
|
18
|
-
*
|
|
19
|
-
* @param {string} field The field to index by. Value will be cast to string before indexing.
|
|
20
|
-
* @param {Array} source Input array
|
|
21
|
-
*
|
|
22
|
-
* @returns {Array<Array>}
|
|
23
|
-
*
|
|
24
|
-
* @example
|
|
25
|
-
* groupBy("user_id")([
|
|
26
|
-
* {id: 1, user_id: 2},
|
|
27
|
-
* {id: 2, user_id: 3},
|
|
28
|
-
* {id: 3, user_id: 2},
|
|
29
|
-
* {id: 4, user_id: null},
|
|
30
|
-
* ] )
|
|
31
|
-
* // => [
|
|
32
|
-
* // [{id: 1, user_id: 2}, {id: 3, user_id: 2}],
|
|
33
|
-
* // [{id: 2, user_id: 3}],
|
|
34
|
-
* // [{id: 4, user_id: null}],
|
|
35
|
-
* // ]
|
|
36
|
-
*/ export var groupBy = curry(_groupBy);
|
|
37
|
-
|
|
38
|
-
//# sourceMappingURL=group-by.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/group-by/group-by.js"],"sourcesContent":["import { curry } from \"../curry/curry.js\"\n\nconst _groupBy = (field, input) => {\n const result = {}\n\n for (let i = 0, length = input.length; i < length; i++) {\n const groupKey = String(input[i][field])\n\n if (result[groupKey]) {\n result[groupKey].push(input[i])\n } else {\n result[groupKey] = [input[i]]\n }\n }\n\n return Object.values(result)\n}\n\n/**\n * Group an array of objects by field.\n *\n * @param {string} field The field to index by. Value will be cast to string before indexing.\n * @param {Array} source Input array\n *\n * @returns {Array<Array>}\n *\n * @example\n * groupBy(\"user_id\")([\n * {id: 1, user_id: 2},\n * {id: 2, user_id: 3},\n * {id: 3, user_id: 2},\n * {id: 4, user_id: null},\n * ] )\n * // => [\n * // [{id: 1, user_id: 2}, {id: 3, user_id: 2}],\n * // [{id: 2, user_id: 3}],\n * // [{id: 4, user_id: null}],\n * // ]\n */\nexport const groupBy = curry(_groupBy)\n"],"names":["curry","_groupBy","field","input","result","i","length","groupKey","String","push","Object","values","groupBy"],"mappings":"AAAA,SAASA,KAAK,QAAQ,oBAAmB;AAEzC,IAAMC,WAAW,SAACC,OAAOC,OAAU;IACjC,IAAMC,SAAS,CAAC;IAEhB,IAAK,IAAIC,IAAI,GAAGC,SAASH,MAAMG,MAAM,EAAED,IAAIC,QAAQD,IAAK;QACtD,IAAME,WAAWC,OAAOL,KAAK,CAACE,EAAE,CAACH,MAAM;QAEvC,IAAIE,MAAM,CAACG,SAAS,EAAE;YACpBH,MAAM,CAACG,SAAS,CAACE,IAAI,CAACN,KAAK,CAACE,EAAE;QAChC,OAAO;YACLD,MAAM,CAACG,SAAS,GAAG;gBAACJ,KAAK,CAACE,EAAE;aAAC;QAC/B,CAAC;IACH;IAEA,OAAOK,OAAOC,MAAM,CAACP;AACvB;AAEA;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,IAAMQ,UAAUZ,MAAMC,UAAS"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/* eslint-disable unicorn/no-null */ import test from "tape";
|
|
2
|
-
import { groupBy } from "./group-by.js";
|
|
3
|
-
test("groupBy", function(t) {
|
|
4
|
-
var comments = [
|
|
5
|
-
{
|
|
6
|
-
id: 1,
|
|
7
|
-
user_id: 2
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
id: 2,
|
|
11
|
-
user_id: 3
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
id: 3
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
id: 4,
|
|
18
|
-
user_id: null
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: 5,
|
|
22
|
-
user_id: undefined
|
|
23
|
-
}
|
|
24
|
-
];
|
|
25
|
-
t.deepEqual(groupBy("user_id")(comments), [
|
|
26
|
-
[
|
|
27
|
-
{
|
|
28
|
-
id: 1,
|
|
29
|
-
user_id: 2
|
|
30
|
-
}
|
|
31
|
-
],
|
|
32
|
-
[
|
|
33
|
-
{
|
|
34
|
-
id: 2,
|
|
35
|
-
user_id: 3
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
[
|
|
39
|
-
{
|
|
40
|
-
id: 3
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
id: 5,
|
|
44
|
-
user_id: undefined
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
[
|
|
48
|
-
{
|
|
49
|
-
id: 4,
|
|
50
|
-
user_id: null
|
|
51
|
-
}
|
|
52
|
-
]
|
|
53
|
-
], "Grouping array of objects by field returns array of arrays");
|
|
54
|
-
t.deepEqual(groupBy("user_id", comments), [
|
|
55
|
-
[
|
|
56
|
-
{
|
|
57
|
-
id: 1,
|
|
58
|
-
user_id: 2
|
|
59
|
-
}
|
|
60
|
-
],
|
|
61
|
-
[
|
|
62
|
-
{
|
|
63
|
-
id: 2,
|
|
64
|
-
user_id: 3
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
[
|
|
68
|
-
{
|
|
69
|
-
id: 3
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
id: 5,
|
|
73
|
-
user_id: undefined
|
|
74
|
-
}
|
|
75
|
-
],
|
|
76
|
-
[
|
|
77
|
-
{
|
|
78
|
-
id: 4,
|
|
79
|
-
user_id: null
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
-
], "Grouping array of objects by field returns array of arrays");
|
|
83
|
-
t.end();
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
//# sourceMappingURL=group-by.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/group-by/group-by.test.js"],"sourcesContent":["/* eslint-disable unicorn/no-null */\n\nimport test from \"tape\"\n\nimport { groupBy } from \"./group-by.js\"\n\ntest(\"groupBy\", t => {\n const comments = [\n { id: 1, user_id: 2 },\n { id: 2, user_id: 3 },\n { id: 3 },\n { id: 4, user_id: null },\n { id: 5, user_id: undefined },\n ]\n\n t.deepEqual(\n groupBy(\"user_id\")(comments),\n [\n [{ id: 1, user_id: 2 }],\n [{ id: 2, user_id: 3 }],\n [{ id: 3 }, { id: 5, user_id: undefined }],\n [{ id: 4, user_id: null }],\n ],\n \"Grouping array of objects by field returns array of arrays\"\n )\n\n t.deepEqual(\n groupBy(\"user_id\", comments),\n [\n [{ id: 1, user_id: 2 }],\n [{ id: 2, user_id: 3 }],\n [{ id: 3 }, { id: 5, user_id: undefined }],\n [{ id: 4, user_id: null }],\n ],\n \"Grouping array of objects by field returns array of arrays\"\n )\n\n t.end()\n})\n"],"names":["test","groupBy","t","comments","id","user_id","undefined","deepEqual","end"],"mappings":"AAAA,kCAAkC,GAElC,OAAOA,UAAU,OAAM;AAEvB,SAASC,OAAO,QAAQ,gBAAe;AAEvCD,KAAK,WAAWE,SAAAA,GAAK;IACnB,IAAMC,WAAW;QACf;YAAEC,IAAI;YAAGC,SAAS;QAAE;QACpB;YAAED,IAAI;YAAGC,SAAS;QAAE;QACpB;YAAED,IAAI;QAAE;QACR;YAAEA,IAAI;YAAGC,SAAS,IAAI;QAAC;QACvB;YAAED,IAAI;YAAGC,SAASC;QAAU;KAC7B;IAEDJ,EAAEK,SAAS,CACTN,QAAQ,WAAWE,WACnB;QACE;YAAC;gBAAEC,IAAI;gBAAGC,SAAS;YAAE;SAAE;QACvB;YAAC;gBAAED,IAAI;gBAAGC,SAAS;YAAE;SAAE;QACvB;YAAC;gBAAED,IAAI;YAAE;YAAG;gBAAEA,IAAI;gBAAGC,SAASC;YAAU;SAAE;QAC1C;YAAC;gBAAEF,IAAI;gBAAGC,SAAS,IAAI;YAAC;SAAE;KAC3B,EACD;IAGFH,EAAEK,SAAS,CACTN,QAAQ,WAAWE,WACnB;QACE;YAAC;gBAAEC,IAAI;gBAAGC,SAAS;YAAE;SAAE;QACvB;YAAC;gBAAED,IAAI;gBAAGC,SAAS;YAAE;SAAE;QACvB;YAAC;gBAAED,IAAI;YAAE;YAAG;gBAAEA,IAAI;gBAAGC,SAASC;YAAU;SAAE;QAC1C;YAAC;gBAAEF,IAAI;gBAAGC,SAAS,IAAI;YAAC;SAAE;KAC3B,EACD;IAGFH,EAAEM,GAAG;AACP"}
|
package/dist/gt/gt.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { curry } from "../curry/curry.js";
|
|
2
|
-
var _gt = function(a, b) {
|
|
3
|
-
return a < b;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Grater compare.
|
|
7
|
-
*
|
|
8
|
-
* @param {number} a First number
|
|
9
|
-
* @param {number} b Second number
|
|
10
|
-
*
|
|
11
|
-
* @returns {boolean}
|
|
12
|
-
*
|
|
13
|
-
* @tag Core
|
|
14
|
-
* @signature (a: Number) => (b: Number): Boolean
|
|
15
|
-
* @signature (a: Number, b: Number): Boolean
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* gt(10)(4)
|
|
19
|
-
* // => false
|
|
20
|
-
*
|
|
21
|
-
* gt(10, 14)
|
|
22
|
-
* // => true
|
|
23
|
-
*/ export var gt = curry(_gt);
|
|
24
|
-
|
|
25
|
-
//# sourceMappingURL=gt.js.map
|
package/dist/gt/gt.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/gt/gt.js"],"sourcesContent":["import { curry } from \"../curry/curry.js\"\n\nconst _gt = (a, b) => a < b\n\n/**\n * Grater compare.\n *\n * @param {number} a First number\n * @param {number} b Second number\n *\n * @returns {boolean}\n *\n * @tag Core\n * @signature (a: Number) => (b: Number): Boolean\n * @signature (a: Number, b: Number): Boolean\n *\n * @example\n * gt(10)(4)\n * // => false\n *\n * gt(10, 14)\n * // => true\n */\nexport const gt = curry(_gt)\n"],"names":["curry","_gt","a","b","gt"],"mappings":"AAAA,SAASA,KAAK,QAAQ,oBAAmB;AAEzC,IAAMC,MAAM,SAACC,GAAGC;WAAMD,IAAIC;;AAE1B;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,IAAMC,KAAKJ,MAAMC,KAAI"}
|
package/dist/gt/gt.test.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import test from "tape";
|
|
2
|
-
import { gt } from "./gt.js";
|
|
3
|
-
test("gt", function(t) {
|
|
4
|
-
t.equals(gt(10)(4), false, "4 is not grater than 10");
|
|
5
|
-
t.equals(gt(10)(10), false, "10 is not grater than 10");
|
|
6
|
-
t.equals(gt(10)(14), true, "14 is grater than 10");
|
|
7
|
-
t.equals(gt(10, 10), false, "10 is mpt grater than 10");
|
|
8
|
-
t.end();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
//# sourceMappingURL=gt.test.js.map
|
package/dist/gt/gt.test.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/gt/gt.test.js"],"sourcesContent":["import test from \"tape\"\n\nimport { gt } from \"./gt.js\"\n\ntest(\"gt\", t => {\n t.equals(gt(10)(4), false, \"4 is not grater than 10\")\n t.equals(gt(10)(10), false, \"10 is not grater than 10\")\n t.equals(gt(10)(14), true, \"14 is grater than 10\")\n t.equals(gt(10, 10), false, \"10 is mpt grater than 10\")\n\n t.end()\n})\n"],"names":["test","gt","t","equals","end"],"mappings":"AAAA,OAAOA,UAAU,OAAM;AAEvB,SAASC,EAAE,QAAQ,UAAS;AAE5BD,KAAK,MAAME,SAAAA,GAAK;IACdA,EAAEC,MAAM,CAACF,GAAG,IAAI,IAAI,KAAK,EAAE;IAC3BC,EAAEC,MAAM,CAACF,GAAG,IAAI,KAAK,KAAK,EAAE;IAC5BC,EAAEC,MAAM,CAACF,GAAG,IAAI,KAAK,IAAI,EAAE;IAC3BC,EAAEC,MAAM,CAACF,GAAG,IAAI,KAAK,KAAK,EAAE;IAE5BC,EAAEE,GAAG;AACP"}
|
package/dist/has-key/has-key.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { curry } from "../curry/curry.js";
|
|
2
|
-
import { is } from "../is/is.js";
|
|
3
|
-
var _hasKey = function(key, input) {
|
|
4
|
-
return is(input) && Object.prototype.hasOwnProperty.call(input, key);
|
|
5
|
-
};
|
|
6
|
-
export var hasKey = curry(_hasKey);
|
|
7
|
-
|
|
8
|
-
//# sourceMappingURL=has-key.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/has-key/has-key.js"],"sourcesContent":["import { curry } from \"../curry/curry.js\"\nimport { is } from \"../is/is.js\"\n\nconst _hasKey = (key, input) =>\n is(input) && Object.prototype.hasOwnProperty.call(input, key)\n\nexport const hasKey = curry(_hasKey)\n"],"names":["curry","is","_hasKey","key","input","Object","prototype","hasOwnProperty","call","hasKey"],"mappings":"AAAA,SAASA,KAAK,QAAQ,oBAAmB;AACzC,SAASC,EAAE,QAAQ,cAAa;AAEhC,IAAMC,UAAU,SAACC,KAAKC;WACpBH,GAAGG,UAAUC,OAAOC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACJ,OAAOD;;AAE3D,OAAO,IAAMM,SAAST,MAAME,SAAQ"}
|