@asd14/m 8.0.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/replace/replace.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { map } from "../map/map.js";
|
|
2
|
-
import { isMatch } from "../is-match/is-match.js";
|
|
3
|
-
import { type } from "../type/type.js";
|
|
4
|
-
/**
|
|
5
|
-
* Replace substring in string
|
|
6
|
-
*
|
|
7
|
-
* @param {string} oldString The old string
|
|
8
|
-
* @param {string} newString The new string
|
|
9
|
-
*
|
|
10
|
-
* @returns {string}
|
|
11
|
-
*/ var replaceString = function(oldString, newString) {
|
|
12
|
-
return function(input) {
|
|
13
|
-
return String.prototype.replace.call(input, oldString, newString);
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Replace element in array (shallow equal)
|
|
18
|
-
*
|
|
19
|
-
* @param {any} oldElm
|
|
20
|
-
* @param {any} newElm
|
|
21
|
-
*
|
|
22
|
-
* @returns {Array}
|
|
23
|
-
*/ var replaceArray = function(oldElm, newElm) {
|
|
24
|
-
return function(input) {
|
|
25
|
-
var result = [];
|
|
26
|
-
for(var i = 0, length = input.length - 1; i <= length; i++){
|
|
27
|
-
if (oldElm === input[i]) {
|
|
28
|
-
result.push(newElm);
|
|
29
|
-
} else {
|
|
30
|
-
result.push(input[i]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return result;
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Replace substring if source is string, replace element (shallow equal) if
|
|
38
|
-
* source is Array
|
|
39
|
-
*
|
|
40
|
-
* @param {string|any} oldElm
|
|
41
|
-
* @param {string|any} newElm
|
|
42
|
-
* @param {string|Array} source
|
|
43
|
-
*
|
|
44
|
-
* @returns {string|Array}
|
|
45
|
-
*
|
|
46
|
-
* @tag String,Array
|
|
47
|
-
* @signature (oldElm: string|any, newElm: string|any) => (source: Array): Array
|
|
48
|
-
*
|
|
49
|
-
*/ var replace = function(oldElm, newElm) {
|
|
50
|
-
return function(input) {
|
|
51
|
-
var inputType = type(input);
|
|
52
|
-
var byType = {
|
|
53
|
-
String: replaceString,
|
|
54
|
-
Array: replaceArray
|
|
55
|
-
};
|
|
56
|
-
return byType[inputType](oldElm, newElm)(input);
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Replace object element in array using filter object
|
|
61
|
-
*
|
|
62
|
-
* @tag Array
|
|
63
|
-
* @signature (filter: Obj, replace: Obj|Function) => (source: Obj[]): Obj[]
|
|
64
|
-
*
|
|
65
|
-
* @param {Object} filter Filter object to match against each element
|
|
66
|
-
* @param {Object} newValue Object to replace matching elements
|
|
67
|
-
* @param {Object[]} source
|
|
68
|
-
*
|
|
69
|
-
* @returns {Array}
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* replaceWith(
|
|
73
|
-
* {id: 2},
|
|
74
|
-
* {id: 2, title: "boss", isBoss: true}
|
|
75
|
-
* )([
|
|
76
|
-
* {id: 2, title:"minion"}
|
|
77
|
-
* {id: 3, title:"minion"}
|
|
78
|
-
* ])
|
|
79
|
-
* // => [
|
|
80
|
-
* // {id: 2, title:"boss", isBoss: true},
|
|
81
|
-
* // {id: 3, title:"minion"}
|
|
82
|
-
* // ]
|
|
83
|
-
*
|
|
84
|
-
* replaceWith({ id: 2 }, item => ({
|
|
85
|
-
* ...item,
|
|
86
|
-
* content: ["new", "updated", "field"],
|
|
87
|
-
* }))([
|
|
88
|
-
* { id: 1, name: "foo", content: [] },
|
|
89
|
-
* { id: 2, name: "bar", content: [] },
|
|
90
|
-
* ])
|
|
91
|
-
* // [
|
|
92
|
-
* // { id: 1, name: "foo", content: [] },
|
|
93
|
-
* // { id: 2, name: "bar", content: ["new", "updated", "field"] },
|
|
94
|
-
* // ],
|
|
95
|
-
*/ var replaceWith = function(filter, newValue) {
|
|
96
|
-
return map(function(item) {
|
|
97
|
-
return isMatch(filter)(item) ? typeof newValue === "function" ? newValue(item) : newValue : item;
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
export { replace, replaceWith };
|
|
101
|
-
|
|
102
|
-
//# sourceMappingURL=replace.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/replace/replace.js"],"sourcesContent":["import { map } from \"../map/map.js\"\nimport { isMatch } from \"../is-match/is-match.js\"\nimport { type } from \"../type/type.js\"\n\n/**\n * Replace substring in string\n *\n * @param {string} oldString The old string\n * @param {string} newString The new string\n *\n * @returns {string}\n */\nconst replaceString = (oldString, newString) => input =>\n String.prototype.replace.call(input, oldString, newString)\n\n/**\n * Replace element in array (shallow equal)\n *\n * @param {any} oldElm\n * @param {any} newElm\n *\n * @returns {Array}\n */\nconst replaceArray = (oldElm, newElm) => input => {\n const result = []\n\n for (let i = 0, length = input.length - 1; i <= length; i++) {\n if (oldElm === input[i]) {\n result.push(newElm)\n } else {\n result.push(input[i])\n }\n }\n\n return result\n}\n\n/**\n * Replace substring if source is string, replace element (shallow equal) if\n * source is Array\n *\n * @param {string|any} oldElm\n * @param {string|any} newElm\n * @param {string|Array} source\n *\n * @returns {string|Array}\n *\n * @tag String,Array\n * @signature (oldElm: string|any, newElm: string|any) => (source: Array): Array\n *\n */\nconst replace = (oldElm, newElm) => input => {\n const inputType = type(input)\n const byType = {\n String: replaceString,\n Array: replaceArray,\n }\n\n return byType[inputType](oldElm, newElm)(input)\n}\n\n/**\n * Replace object element in array using filter object\n *\n * @tag Array\n * @signature (filter: Obj, replace: Obj|Function) => (source: Obj[]): Obj[]\n *\n * @param {Object} filter Filter object to match against each element\n * @param {Object} newValue Object to replace matching elements\n * @param {Object[]} source\n *\n * @returns {Array}\n *\n * @example\n * replaceWith(\n * {id: 2},\n * {id: 2, title: \"boss\", isBoss: true}\n * )([\n * {id: 2, title:\"minion\"}\n * {id: 3, title:\"minion\"}\n * ])\n * // => [\n * // {id: 2, title:\"boss\", isBoss: true},\n * // {id: 3, title:\"minion\"}\n * // ]\n *\n * replaceWith({ id: 2 }, item => ({\n * ...item,\n * content: [\"new\", \"updated\", \"field\"],\n * }))([\n * { id: 1, name: \"foo\", content: [] },\n * { id: 2, name: \"bar\", content: [] },\n * ])\n * // [\n * // { id: 1, name: \"foo\", content: [] },\n * // { id: 2, name: \"bar\", content: [\"new\", \"updated\", \"field\"] },\n * // ],\n */\nconst replaceWith = (filter, newValue) =>\n map(item =>\n isMatch(filter)(item)\n ? typeof newValue === \"function\"\n ? newValue(item)\n : newValue\n : item\n )\n\nexport { replace, replaceWith }\n"],"names":["map","isMatch","type","replaceString","oldString","newString","input","String","prototype","replace","call","replaceArray","oldElm","newElm","result","i","length","push","inputType","byType","Array","replaceWith","filter","newValue","item"],"mappings":"AAAA,SAASA,GAAG,QAAQ,eAAe,CAAA;AACnC,SAASC,OAAO,QAAQ,yBAAyB,CAAA;AACjD,SAASC,IAAI,QAAQ,iBAAiB,CAAA;AAEtC;;;;;;;CAOC,GACD,IAAMC,aAAa,GAAG,SAACC,SAAS,EAAEC,SAAS;WAAKC,SAAAA,KAAK;eACnDC,MAAM,CAACC,SAAS,CAACC,OAAO,CAACC,IAAI,CAACJ,KAAK,EAAEF,SAAS,EAAEC,SAAS,CAAC;KAAA;CAAA;AAE5D;;;;;;;CAOC,GACD,IAAMM,YAAY,GAAG,SAACC,MAAM,EAAEC,MAAM;WAAKP,SAAAA,KAAK,EAAI;QAChD,IAAMQ,MAAM,GAAG,EAAE;QAEjB,IAAK,IAAIC,CAAC,GAAG,CAAC,EAAEC,MAAM,GAAGV,KAAK,CAACU,MAAM,GAAG,CAAC,EAAED,CAAC,IAAIC,MAAM,EAAED,CAAC,EAAE,CAAE;YAC3D,IAAIH,MAAM,KAAKN,KAAK,CAACS,CAAC,CAAC,EAAE;gBACvBD,MAAM,CAACG,IAAI,CAACJ,MAAM,CAAC;YACrB,OAAO;gBACLC,MAAM,CAACG,IAAI,CAACX,KAAK,CAACS,CAAC,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;QAED,OAAOD,MAAM,CAAA;IACf,CAAC;CAAA;AAED;;;;;;;;;;;;;CAaC,GACD,IAAML,OAAO,GAAG,SAACG,MAAM,EAAEC,MAAM;WAAKP,SAAAA,KAAK,EAAI;QAC3C,IAAMY,SAAS,GAAGhB,IAAI,CAACI,KAAK,CAAC;QAC7B,IAAMa,MAAM,GAAG;YACbZ,MAAM,EAAEJ,aAAa;YACrBiB,KAAK,EAAET,YAAY;SACpB;QAED,OAAOQ,MAAM,CAACD,SAAS,CAAC,CAACN,MAAM,EAAEC,MAAM,CAAC,CAACP,KAAK,CAAC,CAAA;IACjD,CAAC;CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCC,GACD,IAAMe,WAAW,GAAG,SAACC,MAAM,EAAEC,QAAQ;WACnCvB,GAAG,CAACwB,SAAAA,IAAI;eACNvB,OAAO,CAACqB,MAAM,CAAC,CAACE,IAAI,CAAC,GACjB,OAAOD,QAAQ,KAAK,UAAU,GAC5BA,QAAQ,CAACC,IAAI,CAAC,GACdD,QAAQ,GACVC,IAAI;KAAA,CACT;CAAA;AAEH,SAASf,OAAO,EAAEY,WAAW,GAAE"}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import _object_spread from "@swc/helpers/src/_object_spread.mjs";
|
|
2
|
-
import _object_spread_props from "@swc/helpers/src/_object_spread_props.mjs";
|
|
3
|
-
import test from "tape";
|
|
4
|
-
import { replace, replaceWith } from "./replace.js";
|
|
5
|
-
test("replace(With)", function(t) {
|
|
6
|
-
t.equals(replace("test", "ipsum")("lorem test"), "lorem ipsum", "Replace substring in string");
|
|
7
|
-
t.equals(replace("testx", "ipsum")("lorem test"), "lorem test", "Replacement string does not exist");
|
|
8
|
-
t.deepEquals(replace("test", "ipsum")([
|
|
9
|
-
"lorem",
|
|
10
|
-
"test"
|
|
11
|
-
]), [
|
|
12
|
-
"lorem",
|
|
13
|
-
"ipsum"
|
|
14
|
-
], "Replace string element in array source");
|
|
15
|
-
t.deepEquals(replace("testx", "ipsum")([
|
|
16
|
-
"lorem",
|
|
17
|
-
"test"
|
|
18
|
-
]), [
|
|
19
|
-
"lorem",
|
|
20
|
-
"test"
|
|
21
|
-
], "Replacement string does not exist in array source");
|
|
22
|
-
var input = [
|
|
23
|
-
"lorem",
|
|
24
|
-
"test"
|
|
25
|
-
];
|
|
26
|
-
t.notEquals(replace("test", "ipsum")(input), input, "Imutable");
|
|
27
|
-
t.deepEquals(replace("test", "ipsum")(replace("test", "ipsum")([
|
|
28
|
-
"lorem",
|
|
29
|
-
"test"
|
|
30
|
-
])), [
|
|
31
|
-
"lorem",
|
|
32
|
-
"ipsum"
|
|
33
|
-
], "Idempotent");
|
|
34
|
-
t.deepEqual(replaceWith({
|
|
35
|
-
id: 2
|
|
36
|
-
}, {
|
|
37
|
-
id: 2,
|
|
38
|
-
title: "boss",
|
|
39
|
-
isBoss: true
|
|
40
|
-
})([
|
|
41
|
-
{
|
|
42
|
-
id: 2,
|
|
43
|
-
title: "minion"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
id: 3,
|
|
47
|
-
title: "minion"
|
|
48
|
-
},
|
|
49
|
-
]), [
|
|
50
|
-
{
|
|
51
|
-
id: 2,
|
|
52
|
-
title: "boss",
|
|
53
|
-
isBoss: true
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
id: 3,
|
|
57
|
-
title: "minion"
|
|
58
|
-
},
|
|
59
|
-
], "Replace existing object");
|
|
60
|
-
t.deepEqual(replaceWith({
|
|
61
|
-
"!name": "alice"
|
|
62
|
-
}, {
|
|
63
|
-
name: "bobby",
|
|
64
|
-
title: "tables"
|
|
65
|
-
})([
|
|
66
|
-
{
|
|
67
|
-
name: "alice",
|
|
68
|
-
title: "first"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
name: "bob",
|
|
72
|
-
title: "second"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: "george",
|
|
76
|
-
title: "third"
|
|
77
|
-
},
|
|
78
|
-
]), [
|
|
79
|
-
{
|
|
80
|
-
name: "alice",
|
|
81
|
-
title: "first"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: "bobby",
|
|
85
|
-
title: "tables"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
name: "bobby",
|
|
89
|
-
title: "tables"
|
|
90
|
-
},
|
|
91
|
-
], "Replace multiple objects by using negate in filter object");
|
|
92
|
-
t.deepEquals(replaceWith({
|
|
93
|
-
id: 2
|
|
94
|
-
}, function(item) {
|
|
95
|
-
return _object_spread_props(_object_spread({}, item), {
|
|
96
|
-
content: [
|
|
97
|
-
"new",
|
|
98
|
-
"updated",
|
|
99
|
-
"field"
|
|
100
|
-
]
|
|
101
|
-
});
|
|
102
|
-
})([
|
|
103
|
-
{
|
|
104
|
-
id: 1,
|
|
105
|
-
name: "foo",
|
|
106
|
-
content: []
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
id: 2,
|
|
110
|
-
name: "bar",
|
|
111
|
-
content: []
|
|
112
|
-
},
|
|
113
|
-
]), [
|
|
114
|
-
{
|
|
115
|
-
id: 1,
|
|
116
|
-
name: "foo",
|
|
117
|
-
content: []
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
id: 2,
|
|
121
|
-
name: "bar",
|
|
122
|
-
content: [
|
|
123
|
-
"new",
|
|
124
|
-
"updated",
|
|
125
|
-
"field"
|
|
126
|
-
]
|
|
127
|
-
},
|
|
128
|
-
], "Replace object with custom update function");
|
|
129
|
-
t.end();
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
//# sourceMappingURL=replace.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/replace/replace.test.js"],"sourcesContent":["import test from \"tape\"\nimport { replace, replaceWith } from \"./replace.js\"\n\ntest(\"replace(With)\", t => {\n t.equals(\n replace(\"test\", \"ipsum\")(\"lorem test\"),\n \"lorem ipsum\",\n \"Replace substring in string\"\n )\n\n t.equals(\n replace(\"testx\", \"ipsum\")(\"lorem test\"),\n \"lorem test\",\n \"Replacement string does not exist\"\n )\n\n t.deepEquals(\n replace(\"test\", \"ipsum\")([\"lorem\", \"test\"]),\n [\"lorem\", \"ipsum\"],\n \"Replace string element in array source\"\n )\n\n t.deepEquals(\n replace(\"testx\", \"ipsum\")([\"lorem\", \"test\"]),\n [\"lorem\", \"test\"],\n \"Replacement string does not exist in array source\"\n )\n\n const input = [\"lorem\", \"test\"]\n\n t.notEquals(replace(\"test\", \"ipsum\")(input), input, \"Imutable\")\n\n t.deepEquals(\n replace(\"test\", \"ipsum\")(replace(\"test\", \"ipsum\")([\"lorem\", \"test\"])),\n [\"lorem\", \"ipsum\"],\n \"Idempotent\"\n )\n\n t.deepEqual(\n replaceWith(\n { id: 2 },\n { id: 2, title: \"boss\", isBoss: true }\n )([\n { id: 2, title: \"minion\" },\n { id: 3, title: \"minion\" },\n ]),\n [\n { id: 2, title: \"boss\", isBoss: true },\n { id: 3, title: \"minion\" },\n ],\n \"Replace existing object\"\n )\n\n t.deepEqual(\n replaceWith(\n { \"!name\": \"alice\" },\n { name: \"bobby\", title: \"tables\" }\n )([\n { name: \"alice\", title: \"first\" },\n { name: \"bob\", title: \"second\" },\n { name: \"george\", title: \"third\" },\n ]),\n [\n { name: \"alice\", title: \"first\" },\n { name: \"bobby\", title: \"tables\" },\n { name: \"bobby\", title: \"tables\" },\n ],\n \"Replace multiple objects by using negate in filter object\"\n )\n\n t.deepEquals(\n replaceWith({ id: 2 }, item => ({\n ...item,\n content: [\"new\", \"updated\", \"field\"],\n }))([\n { id: 1, name: \"foo\", content: [] },\n { id: 2, name: \"bar\", content: [] },\n ]),\n [\n { id: 1, name: \"foo\", content: [] },\n { id: 2, name: \"bar\", content: [\"new\", \"updated\", \"field\"] },\n ],\n \"Replace object with custom update function\"\n )\n\n t.end()\n})\n"],"names":["test","replace","replaceWith","t","equals","deepEquals","input","notEquals","deepEqual","id","title","isBoss","name","item","content","end"],"mappings":"AAAA;;AAAA,OAAOA,IAAI,MAAM,MAAM,CAAA;AACvB,SAASC,OAAO,EAAEC,WAAW,QAAQ,cAAc,CAAA;AAEnDF,IAAI,CAAC,eAAe,EAAEG,SAAAA,CAAC,EAAI;IACzBA,CAAC,CAACC,MAAM,CACNH,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,YAAY,CAAC,EACtC,aAAa,EACb,6BAA6B,CAC9B;IAEDE,CAAC,CAACC,MAAM,CACNH,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,YAAY,CAAC,EACvC,YAAY,EACZ,mCAAmC,CACpC;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CAAC"}
|
package/dist/same/same.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Curried funtion that always returns the input given
|
|
3
|
-
*
|
|
4
|
-
* @param {any} input Something, anything
|
|
5
|
-
*
|
|
6
|
-
* @returns {any}
|
|
7
|
-
*/ export var same = function(input) {
|
|
8
|
-
return function() {
|
|
9
|
-
return input;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
//# sourceMappingURL=same.js.map
|
package/dist/same/same.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/same/same.js"],"sourcesContent":["/**\n * Curried funtion that always returns the input given\n *\n * @param {any} input Something, anything\n *\n * @returns {any}\n */\nexport const same = input => () => input\n"],"names":["same","input"],"mappings":"AAAA;;;;;;CAMC,GACD,OAAO,IAAMA,IAAI,GAAGC,SAAAA,KAAK;WAAI;eAAMA,KAAK;KAAA;CAAA,CAAA"}
|
package/dist/same/same.test.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/same/same.test.js"],"sourcesContent":["import test from \"tape\"\n\nimport { same } from \"./same.js\"\n\ntest(\"same\", t => {\n const object = {}\n\n t.equals(\n same(object)(),\n object,\n \"Give value as input, get the same value in return\"\n )\n\n t.end()\n})\n"],"names":["test","same","t","object","equals","end"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM,CAAA;AAEvB,SAASC,IAAI,QAAQ,WAAW,CAAA;AAEhCD,IAAI,CAAC,MAAM,EAAEE,SAAAA,CAAC,EAAI;IAChB,IAAMC,MAAM,GAAG,EAAE;IAEjBD,CAAC,CAACE,MAAM,CACNH,IAAI,CAACE,MAAM,CAAC,EAAE,EACdA,MAAM,EACN,mDAAmD,CACpD;IAEDD,CAAC,CAACG,GAAG,EAAE;AACT,CAAC,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { is } from "../is/is.js";
|
|
2
|
-
var alwaysTrue = function() {
|
|
3
|
-
return true;
|
|
4
|
-
};
|
|
5
|
-
export var sequenceWhile = function(predicateFn, input) {
|
|
6
|
-
if (typeof predicateFn !== "function") {
|
|
7
|
-
throw new TypeError('Invalid predicate control function. Expected function but got "'.concat(JSON.stringify(predicateFn), '"'));
|
|
8
|
-
}
|
|
9
|
-
if (!Array.isArray(input) || Array.isArray(input) && input.length === 0) {
|
|
10
|
-
throw new TypeError('Invalid source array. Expected array of functions but got "'.concat(JSON.stringify(input), '"'));
|
|
11
|
-
}
|
|
12
|
-
var index = 0;
|
|
13
|
-
var resolved = [];
|
|
14
|
-
var queueNext = function(promise) {
|
|
15
|
-
return promise.then(function(result) {
|
|
16
|
-
resolved.push(result);
|
|
17
|
-
if (predicateFn(result) === true) {
|
|
18
|
-
var nextPromiseFn = input[++index];
|
|
19
|
-
if (is(nextPromiseFn)) {
|
|
20
|
-
return queueNext(Promise.resolve(nextPromiseFn(result)));
|
|
21
|
-
}
|
|
22
|
-
// no more functions to process
|
|
23
|
-
return resolved;
|
|
24
|
-
}
|
|
25
|
-
// predicate function failed, return what already resolved and stop
|
|
26
|
-
// processing further
|
|
27
|
-
return resolved;
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
return queueNext(Promise.resolve(input[0]()));
|
|
31
|
-
};
|
|
32
|
-
export var sequence = function(input) {
|
|
33
|
-
return sequenceWhile(alwaysTrue, input);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
//# sourceMappingURL=sequence.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/sequence/sequence.js"],"sourcesContent":["import { is } from \"../is/is.js\"\n\nconst alwaysTrue = () => true\n\nexport const sequenceWhile = (predicateFn, input) => {\n if (typeof predicateFn !== \"function\") {\n throw new TypeError(\n `Invalid predicate control function. Expected function but got \"${JSON.stringify(\n predicateFn\n )}\"`\n )\n }\n\n if (!Array.isArray(input) || (Array.isArray(input) && input.length === 0)) {\n throw new TypeError(\n `Invalid source array. Expected array of functions but got \"${JSON.stringify(\n input\n )}\"`\n )\n }\n\n let index = 0\n const resolved = []\n\n const queueNext = promise =>\n promise.then(result => {\n resolved.push(result)\n\n if (predicateFn(result) === true) {\n const nextPromiseFn = input[++index]\n\n if (is(nextPromiseFn)) {\n return queueNext(Promise.resolve(nextPromiseFn(result)))\n }\n\n // no more functions to process\n return resolved\n }\n\n // predicate function failed, return what already resolved and stop\n // processing further\n return resolved\n })\n\n return queueNext(Promise.resolve(input[0]()))\n}\n\nexport const sequence = input => sequenceWhile(alwaysTrue, input)\n"],"names":["is","alwaysTrue","sequenceWhile","predicateFn","input","TypeError","JSON","stringify","Array","isArray","length","index","resolved","queueNext","promise","then","result","push","nextPromiseFn","Promise","resolve","sequence"],"mappings":"AAAA,SAASA,EAAE,QAAQ,aAAa,CAAA;AAEhC,IAAMC,UAAU,GAAG;WAAM,IAAI;CAAA;AAE7B,OAAO,IAAMC,aAAa,GAAG,SAACC,WAAW,EAAEC,KAAK,EAAK;IACnD,IAAI,OAAOD,WAAW,KAAK,UAAU,EAAE;QACrC,MAAM,IAAIE,SAAS,CACjB,AAAC,iEAA+D,CAE9D,MAAC,CAF+DC,IAAI,CAACC,SAAS,CAC9EJ,WAAW,CACZ,EAAC,GAAC,CAAC,CACL,CAAA;IACH,CAAC;IAED,IAAI,CAACK,KAAK,CAACC,OAAO,CAACL,KAAK,CAAC,IAAKI,KAAK,CAACC,OAAO,CAACL,KAAK,CAAC,IAAIA,KAAK,CAACM,MAAM,KAAK,CAAC,AAAC,EAAE;QACzE,MAAM,IAAIL,SAAS,CACjB,AAAC,6DAA2D,CAE1D,MAAC,CAF2DC,IAAI,CAACC,SAAS,CAC1EH,KAAK,CACN,EAAC,GAAC,CAAC,CACL,CAAA;IACH,CAAC;IAED,IAAIO,KAAK,GAAG,CAAC;IACb,IAAMC,QAAQ,GAAG,EAAE;IAEnB,IAAMC,SAAS,GAAGC,SAAAA,OAAO;eACvBA,OAAO,CAACC,IAAI,CAACC,SAAAA,MAAM,EAAI;YACrBJ,QAAQ,CAACK,IAAI,CAACD,MAAM,CAAC;YAErB,IAAIb,WAAW,CAACa,MAAM,CAAC,KAAK,IAAI,EAAE;gBAChC,IAAME,aAAa,GAAGd,KAAK,CAAC,EAAEO,KAAK,CAAC;gBAEpC,IAAIX,EAAE,CAACkB,aAAa,CAAC,EAAE;oBACrB,OAAOL,SAAS,CAACM,OAAO,CAACC,OAAO,CAACF,aAAa,CAACF,MAAM,CAAC,CAAC,CAAC,CAAA;gBAC1D,CAAC;gBAED,+BAA+B;gBAC/B,OAAOJ,QAAQ,CAAA;YACjB,CAAC;YAED,mEAAmE;YACnE,qBAAqB;YACrB,OAAOA,QAAQ,CAAA;QACjB,CAAC,CAAC;KAAA;IAEJ,OAAOC,SAAS,CAACM,OAAO,CAACC,OAAO,CAAChB,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;AAC/C,CAAC,CAAA;AAED,OAAO,IAAMiB,QAAQ,GAAGjB,SAAAA,KAAK;WAAIF,aAAa,CAACD,UAAU,EAAEG,KAAK,CAAC;CAAA,CAAA"}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import test from "tape";
|
|
2
|
-
import { isTrue } from "../is/is.js";
|
|
3
|
-
import { sequence, sequenceWhile } from "./sequence.js";
|
|
4
|
-
var delay = function(ms, value) {
|
|
5
|
-
return new Promise(function(resolve) {
|
|
6
|
-
return setTimeout(function() {
|
|
7
|
-
return resolve(value);
|
|
8
|
-
}, ms);
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
test("sequence", function(t) {
|
|
12
|
-
t.throws(function() {
|
|
13
|
-
return sequence();
|
|
14
|
-
}, /Invalid source array. Expected array of functions but got "undefined"/, "Throw error when source array is not array");
|
|
15
|
-
t.throws(function() {
|
|
16
|
-
return sequence([]);
|
|
17
|
-
}, /Invalid source array. Expected array of functions but got "\[]"/, "Throw error when source array is empty");
|
|
18
|
-
var sum = 0;
|
|
19
|
-
var input = [
|
|
20
|
-
function() {
|
|
21
|
-
sum++;
|
|
22
|
-
return 1;
|
|
23
|
-
},
|
|
24
|
-
function(previous) {
|
|
25
|
-
sum += previous;
|
|
26
|
-
return delay(10, 2);
|
|
27
|
-
},
|
|
28
|
-
function(previous) {
|
|
29
|
-
sum += previous;
|
|
30
|
-
return Promise.resolve("abc");
|
|
31
|
-
},
|
|
32
|
-
function(previous) {
|
|
33
|
-
sum += previous;
|
|
34
|
-
return Promise.all([
|
|
35
|
-
Promise.resolve(3),
|
|
36
|
-
Promise.resolve(4)
|
|
37
|
-
]);
|
|
38
|
-
},
|
|
39
|
-
];
|
|
40
|
-
return sequence(input).then(function(result) {
|
|
41
|
-
t.deepEqual([
|
|
42
|
-
sum,
|
|
43
|
-
result
|
|
44
|
-
], [
|
|
45
|
-
"".concat(1 + 1 + 2, "abc"),
|
|
46
|
-
[
|
|
47
|
-
1,
|
|
48
|
-
2,
|
|
49
|
-
"abc",
|
|
50
|
-
[
|
|
51
|
-
3,
|
|
52
|
-
4
|
|
53
|
-
]
|
|
54
|
-
]
|
|
55
|
-
], "All promise functions run in sequence, each having access to previous result");
|
|
56
|
-
t.end();
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
test("sequenceWith", function(t) {
|
|
60
|
-
t.throws(function() {
|
|
61
|
-
return sequenceWhile();
|
|
62
|
-
}, /Invalid predicate control function. Expected function but got "undefined"/, "Throw error when predicate function invalid");
|
|
63
|
-
var sum = 1;
|
|
64
|
-
return sequenceWhile(isTrue, [
|
|
65
|
-
function() {
|
|
66
|
-
return true;
|
|
67
|
-
},
|
|
68
|
-
function() {
|
|
69
|
-
return false;
|
|
70
|
-
},
|
|
71
|
-
function() {
|
|
72
|
-
return true;
|
|
73
|
-
}
|
|
74
|
-
]).then(function(result) {
|
|
75
|
-
t.deepEqual(result, [
|
|
76
|
-
true,
|
|
77
|
-
false
|
|
78
|
-
], "Two promise fn resolve with array of both resolved values");
|
|
79
|
-
}).then(function() {
|
|
80
|
-
return sequenceWhile(isTrue, [
|
|
81
|
-
function() {
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
]);
|
|
85
|
-
}).then(function(result) {
|
|
86
|
-
t.deepEqual(result, [
|
|
87
|
-
true
|
|
88
|
-
], "One successfull promise fn resolve with array of resolved value");
|
|
89
|
-
}).then(function() {
|
|
90
|
-
return sequenceWhile(isTrue, [
|
|
91
|
-
function() {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
]);
|
|
95
|
-
}).then(function(result) {
|
|
96
|
-
t.deepEqual(result, [
|
|
97
|
-
false
|
|
98
|
-
], "One failing promise fn resolve with array of resolved value");
|
|
99
|
-
}).then(function() {
|
|
100
|
-
return sequenceWhile(function(input) {
|
|
101
|
-
return input <= 5;
|
|
102
|
-
}, [
|
|
103
|
-
function() {
|
|
104
|
-
return 1;
|
|
105
|
-
},
|
|
106
|
-
function(previous) {
|
|
107
|
-
sum += previous;
|
|
108
|
-
return delay(10, 2);
|
|
109
|
-
},
|
|
110
|
-
function(previous) {
|
|
111
|
-
sum += previous;
|
|
112
|
-
return delay(10, 100);
|
|
113
|
-
},
|
|
114
|
-
function(previous) {
|
|
115
|
-
sum += previous;
|
|
116
|
-
return delay(10, 2);
|
|
117
|
-
},
|
|
118
|
-
function(previous) {
|
|
119
|
-
sum += previous;
|
|
120
|
-
return delay(10, 5);
|
|
121
|
-
},
|
|
122
|
-
]);
|
|
123
|
-
}).then(function(result) {
|
|
124
|
-
t.deepEqual([
|
|
125
|
-
sum,
|
|
126
|
-
result
|
|
127
|
-
], [
|
|
128
|
-
1 + 1 + 2,
|
|
129
|
-
[
|
|
130
|
-
1,
|
|
131
|
-
2,
|
|
132
|
-
100
|
|
133
|
-
]
|
|
134
|
-
], "Promise functions run in sequence until control fn fails. No further promises will run");
|
|
135
|
-
t.end();
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
//# sourceMappingURL=sequence.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/sequence/sequence.test.js"],"sourcesContent":["import test from \"tape\"\n\nimport { isTrue } from \"../is/is.js\"\nimport { sequence, sequenceWhile } from \"./sequence.js\"\n\nconst delay = (ms, value) =>\n new Promise(resolve => setTimeout(() => resolve(value), ms))\n\ntest(\"sequence\", t => {\n t.throws(\n () => sequence(),\n /Invalid source array. Expected array of functions but got \"undefined\"/,\n \"Throw error when source array is not array\"\n )\n\n t.throws(\n () => sequence([]),\n /Invalid source array. Expected array of functions but got \"\\[]\"/,\n \"Throw error when source array is empty\"\n )\n\n let sum = 0\n\n const input = [\n () => {\n sum++\n\n return 1\n },\n previous => {\n sum += previous\n\n return delay(10, 2)\n },\n previous => {\n sum += previous\n\n return Promise.resolve(\"abc\")\n },\n previous => {\n sum += previous\n\n return Promise.all([Promise.resolve(3), Promise.resolve(4)])\n },\n ]\n\n return sequence(input).then(result => {\n t.deepEqual(\n [sum, result],\n [`${1 + 1 + 2}abc`, [1, 2, \"abc\", [3, 4]]],\n \"All promise functions run in sequence, each having access to previous result\"\n )\n\n t.end()\n })\n})\n\ntest(\"sequenceWith\", t => {\n t.throws(\n () => sequenceWhile(),\n /Invalid predicate control function. Expected function but got \"undefined\"/,\n \"Throw error when predicate function invalid\"\n )\n\n let sum = 1\n\n return sequenceWhile(isTrue, [() => true, () => false, () => true])\n .then(result => {\n t.deepEqual(\n result,\n [true, false],\n \"Two promise fn resolve with array of both resolved values\"\n )\n })\n .then(() => sequenceWhile(isTrue, [() => true]))\n .then(result => {\n t.deepEqual(\n result,\n [true],\n \"One successfull promise fn resolve with array of resolved value\"\n )\n })\n .then(() => sequenceWhile(isTrue, [() => false]))\n .then(result => {\n t.deepEqual(\n result,\n [false],\n \"One failing promise fn resolve with array of resolved value\"\n )\n })\n .then(() =>\n sequenceWhile(\n input => input <= 5,\n [\n () => 1,\n\n previous => {\n sum += previous\n\n return delay(10, 2)\n },\n\n previous => {\n sum += previous\n\n return delay(10, 100)\n },\n\n previous => {\n sum += previous\n\n return delay(10, 2)\n },\n\n previous => {\n sum += previous\n\n return delay(10, 5)\n },\n ]\n )\n )\n .then(result => {\n t.deepEqual(\n [sum, result],\n [1 + 1 + 2, [1, 2, 100]],\n \"Promise functions run in sequence until control fn fails. No further promises will run\"\n )\n\n t.end()\n })\n})\n"],"names":["test","isTrue","sequence","sequenceWhile","delay","ms","value","Promise","resolve","setTimeout","t","throws","sum","input","previous","all","then","result","deepEqual","end"],"mappings":"AAAA,OAAOA,IAAI,MAAM,MAAM,CAAA;AAEvB,SAASC,MAAM,QAAQ,aAAa,CAAA;AACpC,SAASC,QAAQ,EAAEC,aAAa,QAAQ,eAAe,CAAA;AAEvD,IAAMC,KAAK,GAAG,SAACC,EAAE,EAAEC,KAAK;WACtB,IAAIC,OAAO,CAACC,SAAAA,OAAO;eAAIC,UAAU,CAAC;mBAAMD,OAAO,CAACF,KAAK,CAAC;SAAA,EAAED,EAAE,CAAC;KAAA,CAAC;CAAA;AAE9DL,IAAI,CAAC,UAAU,EAAEU,SAAAA,CAAC,EAAI;IACpBA,CAAC,CAACC,MAAM,CACN;eAAMT,QAAQ,EAAE;KAAA,2EAEhB,4CAA4C,CAC7C;IAEDQ,CAAC,CAACC,MAAM,CACN;eAAMT,QAAQ,CAAC,EAAE,CAAC;KAAA,qEAElB,wCAAwC,CACzC;IAED,IAAIU,GAAG,GAAG,CAAC;IAEX,IAAMC,KAAK,GAAG;QACZ,WAAM;YACJD,GAAG,EAAE;YAEL,OAAO,CAAC,CAAA;QACV,CAAC;QACDE,SAAAA,QAAQ,EAAI;YACVF,GAAG,IAAIE,QAAQ;YAEf,OAAOV,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;QACrB,CAAC;QACDU,SAAAA,QAAQ,EAAI;YACVF,GAAG,IAAIE,QAAQ;YAEf,OAAOP,OAAO,CAACC,OAAO,CAAC,KAAK,CAAC,CAAA;QAC/B,CAAC;QACDM,SAA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.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs";
|
|
2
|
-
import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs";
|
|
3
|
-
import { is } from "../is/is.js";
|
|
4
|
-
var _compareTwoValues = function(direction, a, b) {
|
|
5
|
-
var valueIfFieldMissing = direction === "asc" ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
6
|
-
var aValue = is(a) ? a : valueIfFieldMissing;
|
|
7
|
-
var bValue = is(b) ? b : valueIfFieldMissing;
|
|
8
|
-
if (a === null && b === undefined) {
|
|
9
|
-
return direction === "desc" ? -1 : 1;
|
|
10
|
-
}
|
|
11
|
-
if (a === undefined && b === null) {
|
|
12
|
-
return direction === "desc" ? 1 : -1;
|
|
13
|
-
}
|
|
14
|
-
if (aValue === bValue) {
|
|
15
|
-
return 0;
|
|
16
|
-
}
|
|
17
|
-
if (aValue < bValue) {
|
|
18
|
-
return direction === "desc" ? 1 : -1;
|
|
19
|
-
}
|
|
20
|
-
// aValue > bValue
|
|
21
|
-
return direction === "desc" ? -1 : 1;
|
|
22
|
-
};
|
|
23
|
-
var _validateProps = function(subset) {
|
|
24
|
-
var sorters = Object.entries(subset);
|
|
25
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
26
|
-
try {
|
|
27
|
-
for(var _iterator = sorters[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
28
|
-
var _value = _sliced_to_array(_step.value, 2), key = _value[0], sorter = _value[1];
|
|
29
|
-
var ref = _sliced_to_array(Array.isArray(sorter) ? sorter : typeof sorter === "function" ? [
|
|
30
|
-
sorter
|
|
31
|
-
] : [
|
|
32
|
-
undefined,
|
|
33
|
-
sorter
|
|
34
|
-
], 2), sortFn = ref[0], tmp = ref[1], direction = tmp === void 0 ? "asc" : tmp;
|
|
35
|
-
if (direction !== "asc" && direction !== "desc") {
|
|
36
|
-
throw new Error('@asd14/m/sortWith: Unsuported sort direction for key "'.concat(key, '". Accepting "asc" or "desc", received "').concat(direction, '".'));
|
|
37
|
-
}
|
|
38
|
-
if (typeof sortFn === "function" && (sortFn.length === 0 || sortFn.length > 2)) {
|
|
39
|
-
throw new Error('@asd14/m/sortWith: Unsuported sort function signature for key "'.concat(key, '". Accepting function with one or two parameters, received ').concat(sortFn.length, "."));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
} catch (err) {
|
|
43
|
-
_didIteratorError = true;
|
|
44
|
-
_iteratorError = err;
|
|
45
|
-
} finally{
|
|
46
|
-
try {
|
|
47
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
48
|
-
_iterator.return();
|
|
49
|
-
}
|
|
50
|
-
} finally{
|
|
51
|
-
if (_didIteratorError) {
|
|
52
|
-
throw _iteratorError;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
var _sortWith = function(subset, input) {
|
|
58
|
-
_validateProps(subset);
|
|
59
|
-
var sorters = Object.entries(subset);
|
|
60
|
-
return _to_consumable_array(input).sort(function(a, b) {
|
|
61
|
-
for(var i = 0; i < sorters.length; ++i){
|
|
62
|
-
var _i = _sliced_to_array(sorters[i], 2), key = _i[0], sorter = _i[1];
|
|
63
|
-
var ref = _sliced_to_array(Array.isArray(sorter) ? sorter : typeof sorter === "function" ? [
|
|
64
|
-
sorter
|
|
65
|
-
] : [
|
|
66
|
-
undefined,
|
|
67
|
-
sorter
|
|
68
|
-
], 2), sortFn = ref[0], tmp = ref[1], direction = tmp === void 0 ? "asc" : tmp;
|
|
69
|
-
var isLastSorter = i === sorters.length - 1;
|
|
70
|
-
var result = void 0;
|
|
71
|
-
if (typeof sortFn === "function") {
|
|
72
|
-
// one param, treat as lens: (source) => source.field
|
|
73
|
-
// two params, treas as compare func: (a, b) => a - b
|
|
74
|
-
result = sortFn.length === 2 ? sortFn(a[key], b[key]) : _compareTwoValues(direction, sortFn(a[key]), sortFn(b[key]));
|
|
75
|
-
} else {
|
|
76
|
-
// { key: "direction" }
|
|
77
|
-
result = _compareTwoValues(direction, a[key], b[key]);
|
|
78
|
-
}
|
|
79
|
-
if (result !== 0 || isLastSorter) {
|
|
80
|
-
return result;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Sort an array of objects by multiple fields
|
|
87
|
-
*
|
|
88
|
-
* @param {Object} subset
|
|
89
|
-
* @param {Array} source
|
|
90
|
-
*
|
|
91
|
-
* @param {...any} params
|
|
92
|
-
* @returns {Array}
|
|
93
|
-
*
|
|
94
|
-
* @name sortWith
|
|
95
|
-
* @tag Array
|
|
96
|
-
* @signature (subset: Object, source: Array): Array
|
|
97
|
-
*
|
|
98
|
-
* @see {@link sort}
|
|
99
|
-
* @see {@link sortBy}
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* sortWith({position: "asc"},
|
|
103
|
-
* { id: 1, position: 3 },
|
|
104
|
-
* { id: 2, position: 2 },
|
|
105
|
-
* { id: 3 },
|
|
106
|
-
* { id: 4, position: 5 },
|
|
107
|
-
* { id: 5, position: null },
|
|
108
|
-
* ])
|
|
109
|
-
* // [
|
|
110
|
-
* // { id: 2, position: 2 },
|
|
111
|
-
* // { id: 1, position: 3 },
|
|
112
|
-
* // { id: 4, position: 5 },
|
|
113
|
-
* // { id: 5, position: null },
|
|
114
|
-
* // { id: 3 },
|
|
115
|
-
* //]
|
|
116
|
-
*/ export var sortWith = function() {
|
|
117
|
-
for(var _len = arguments.length, params = new Array(_len), _key = 0; _key < _len; _key++){
|
|
118
|
-
params[_key] = arguments[_key];
|
|
119
|
-
}
|
|
120
|
-
// @signature (subset) => (source)
|
|
121
|
-
if (params.length <= 1) {
|
|
122
|
-
return function(input) {
|
|
123
|
-
return _sortWith(params[0], input);
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
// @signature (subset, source)
|
|
127
|
-
return _sortWith.apply(void 0, _to_consumable_array(params));
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
//# sourceMappingURL=sort-with.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/sort/sort-with.js"],"sourcesContent":["import { is } from \"../is/is.js\"\n\nconst _compareTwoValues = (direction, a, b) => {\n const valueIfFieldMissing =\n direction === \"asc\" ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY\n const aValue = is(a) ? a : valueIfFieldMissing\n const bValue = is(b) ? b : valueIfFieldMissing\n\n if (a === null && b === undefined) {\n return direction === \"desc\" ? -1 : 1\n }\n\n if (a === undefined && b === null) {\n return direction === \"desc\" ? 1 : -1\n }\n\n if (aValue === bValue) {\n return 0\n }\n\n if (aValue < bValue) {\n return direction === \"desc\" ? 1 : -1\n }\n\n // aValue > bValue\n return direction === \"desc\" ? -1 : 1\n}\n\nconst _validateProps = subset => {\n const sorters = Object.entries(subset)\n\n for (const [key, sorter] of sorters) {\n const [sortFn, direction = \"asc\"] = Array.isArray(sorter)\n ? sorter\n : typeof sorter === \"function\"\n ? [sorter]\n : [undefined, sorter]\n\n if (direction !== \"asc\" && direction !== \"desc\") {\n throw new Error(\n `@asd14/m/sortWith: Unsuported sort direction for key \"${key}\". Accepting \"asc\" or \"desc\", received \"${direction}\".`\n )\n }\n\n if (\n typeof sortFn === \"function\" &&\n (sortFn.length === 0 || sortFn.length > 2)\n ) {\n throw new Error(\n `@asd14/m/sortWith: Unsuported sort function signature for key \"${key}\". Accepting function with one or two parameters, received ${sortFn.length}.`\n )\n }\n }\n}\n\nconst _sortWith = (subset, input) => {\n _validateProps(subset)\n\n const sorters = Object.entries(subset)\n\n return [...input].sort((a, b) => {\n for (let i = 0; i < sorters.length; ++i) {\n const [key, sorter] = sorters[i]\n const [sortFn, direction = \"asc\"] = Array.isArray(sorter)\n ? sorter\n : typeof sorter === \"function\"\n ? [sorter]\n : [undefined, sorter]\n const isLastSorter = i === sorters.length - 1\n\n let result\n\n if (typeof sortFn === \"function\") {\n // one param, treat as lens: (source) => source.field\n // two params, treas as compare func: (a, b) => a - b\n\n result =\n sortFn.length === 2\n ? sortFn(a[key], b[key])\n : _compareTwoValues(direction, sortFn(a[key]), sortFn(b[key]))\n } else {\n // { key: \"direction\" }\n result = _compareTwoValues(direction, a[key], b[key])\n }\n\n if (result !== 0 || isLastSorter) {\n return result\n }\n }\n })\n}\n\n/**\n * Sort an array of objects by multiple fields\n *\n * @param {Object} subset\n * @param {Array} source\n *\n * @param {...any} params\n * @returns {Array}\n *\n * @name sortWith\n * @tag Array\n * @signature (subset: Object, source: Array): Array\n *\n * @see {@link sort}\n * @see {@link sortBy}\n *\n * @example\n * sortWith({position: \"asc\"},\n * { id: 1, position: 3 },\n * { id: 2, position: 2 },\n * { id: 3 },\n * { id: 4, position: 5 },\n * { id: 5, position: null },\n * ])\n * // [\n * // { id: 2, position: 2 },\n * // { id: 1, position: 3 },\n * // { id: 4, position: 5 },\n * // { id: 5, position: null },\n * // { id: 3 },\n * //]\n */\nexport const sortWith = (...params) => {\n // @signature (subset) => (source)\n if (params.length <= 1) {\n return input => _sortWith(params[0], input)\n }\n\n // @signature (subset, source)\n return _sortWith(...params)\n}\n"],"names":["is","_compareTwoValues","direction","a","b","valueIfFieldMissing","Number","POSITIVE_INFINITY","NEGATIVE_INFINITY","aValue","bValue","undefined","_validateProps","subset","sorters","Object","entries","key","sorter","Array","isArray","sortFn","Error","length","_sortWith","input","sort","i","isLastSorter","result","sortWith","params"],"mappings":"AAAA;;AAAA,SAASA,EAAE,QAAQ,aAAa,CAAA;AAEhC,IAAMC,iBAAiB,GAAG,SAACC,SAAS,EAAEC,CAAC,EAAEC,CAAC,EAAK;IAC7C,IAAMC,mBAAmB,GACvBH,SAAS,KAAK,KAAK,GAAGI,MAAM,CAACC,iBAAiB,GAAGD,MAAM,CAACE,iBAAiB;IAC3E,IAAMC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