@vinicunca/perkakas 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/commonjs/aria/index.js +17 -0
- package/dist/commonjs/aria/key-codes.js +25 -0
- package/dist/commonjs/array/all-pass.js +11 -0
- package/dist/commonjs/array/any-pass.js +11 -0
- package/dist/commonjs/array/chunk.js +17 -0
- package/dist/commonjs/array/compact.js +8 -0
- package/dist/commonjs/array/concat.js +11 -0
- package/dist/commonjs/array/count-by.js +22 -0
- package/dist/commonjs/array/difference-with.js +31 -0
- package/dist/commonjs/array/difference.js +32 -0
- package/dist/commonjs/array/drop-first-by.js +26 -0
- package/dist/commonjs/array/drop-last-while.js +16 -0
- package/dist/commonjs/array/drop-last.js +15 -0
- package/dist/commonjs/array/drop-while.js +16 -0
- package/dist/commonjs/array/drop.js +32 -0
- package/dist/commonjs/array/filter.js +41 -0
- package/dist/commonjs/array/find-index.js +46 -0
- package/dist/commonjs/array/find-last-index.js +24 -0
- package/dist/commonjs/array/find-last.js +24 -0
- package/dist/commonjs/array/find.js +38 -0
- package/dist/commonjs/array/first-by.js +22 -0
- package/dist/commonjs/array/first.js +26 -0
- package/dist/commonjs/array/flat-map-to-obj.js +25 -0
- package/dist/commonjs/array/flat-map.js +33 -0
- package/dist/commonjs/array/flatten-deep.js +48 -0
- package/dist/commonjs/array/flatten.js +32 -0
- package/dist/commonjs/array/for-each.js +40 -0
- package/dist/commonjs/array/group-by.js +33 -0
- package/dist/commonjs/array/has-at-least.js +11 -0
- package/dist/commonjs/array/index-by.js +24 -0
- package/dist/commonjs/array/index.js +81 -0
- package/dist/commonjs/array/intersection-with.js +31 -0
- package/dist/commonjs/array/intersection.js +32 -0
- package/dist/commonjs/array/join.js +11 -0
- package/dist/commonjs/array/last.js +11 -0
- package/dist/commonjs/array/length.js +11 -0
- package/dist/commonjs/array/map-to-obj.js +23 -0
- package/dist/commonjs/array/map.js +35 -0
- package/dist/commonjs/array/max-by.js +28 -0
- package/dist/commonjs/array/mean-by.js +26 -0
- package/dist/commonjs/array/merge-all.js +7 -0
- package/dist/commonjs/array/min-by.js +28 -0
- package/dist/commonjs/array/nth-by.js +12 -0
- package/dist/commonjs/array/only.js +14 -0
- package/dist/commonjs/array/partition.js +24 -0
- package/dist/commonjs/array/range.js +15 -0
- package/dist/commonjs/array/rank-by.js +17 -0
- package/dist/commonjs/array/reduce.js +19 -0
- package/dist/commonjs/array/reject.js +41 -0
- package/dist/commonjs/array/reverse.js +11 -0
- package/dist/commonjs/array/sample.js +34 -0
- package/dist/commonjs/array/shuffle.js +18 -0
- package/dist/commonjs/array/sort-by.js +52 -0
- package/dist/commonjs/array/sort.js +16 -0
- package/dist/commonjs/array/splice.js +13 -0
- package/dist/commonjs/array/split-at.js +13 -0
- package/dist/commonjs/array/split-when.js +17 -0
- package/dist/commonjs/array/sum-by.js +24 -0
- package/dist/commonjs/array/swap-indices.js +34 -0
- package/dist/commonjs/array/take-first-by.js +24 -0
- package/dist/commonjs/array/take-while.js +18 -0
- package/dist/commonjs/array/take.js +38 -0
- package/dist/commonjs/array/uniq-by.js +30 -0
- package/dist/commonjs/array/uniq-with.js +33 -0
- package/dist/commonjs/array/uniq.js +32 -0
- package/dist/commonjs/array/zip-obj.js +16 -0
- package/dist/commonjs/array/zip-with.js +23 -0
- package/dist/commonjs/array/zip.js +19 -0
- package/dist/commonjs/function/conditional.js +34 -0
- package/dist/commonjs/function/create-pipe.js +8 -0
- package/dist/commonjs/function/debounce.js +88 -0
- package/dist/commonjs/function/identity.js +7 -0
- package/dist/commonjs/function/index.js +25 -0
- package/dist/commonjs/function/noop.js +7 -0
- package/dist/commonjs/function/once.js +15 -0
- package/dist/commonjs/function/pipe.js +106 -0
- package/dist/commonjs/function/purry.js +20 -0
- package/dist/commonjs/function/sleep.js +9 -0
- package/dist/commonjs/guard/index.js +32 -0
- package/dist/commonjs/guard/is-array.js +7 -0
- package/dist/commonjs/guard/is-boolean.js +7 -0
- package/dist/commonjs/guard/is-date.js +7 -0
- package/dist/commonjs/guard/is-defined.js +13 -0
- package/dist/commonjs/guard/is-empty.js +19 -0
- package/dist/commonjs/guard/is-error.js +7 -0
- package/dist/commonjs/guard/is-function.js +7 -0
- package/dist/commonjs/guard/is-nil.js +7 -0
- package/dist/commonjs/guard/is-non-null.js +7 -0
- package/dist/commonjs/guard/is-not.js +9 -0
- package/dist/commonjs/guard/is-number.js +7 -0
- package/dist/commonjs/guard/is-object.js +11 -0
- package/dist/commonjs/guard/is-promise.js +7 -0
- package/dist/commonjs/guard/is-string.js +7 -0
- package/dist/commonjs/guard/is-symbol.js +7 -0
- package/dist/commonjs/guard/is-truthy.js +7 -0
- package/dist/commonjs/index.js +26 -0
- package/dist/commonjs/number/add.js +11 -0
- package/dist/commonjs/number/ceil.js +9 -0
- package/dist/commonjs/number/clamp.js +17 -0
- package/dist/commonjs/number/divide.js +11 -0
- package/dist/commonjs/number/floor.js +9 -0
- package/dist/commonjs/number/index.js +24 -0
- package/dist/commonjs/number/multiply.js +11 -0
- package/dist/commonjs/number/round.js +9 -0
- package/dist/commonjs/number/subtract.js +11 -0
- package/dist/commonjs/object/add-prop.js +14 -0
- package/dist/commonjs/object/clone.js +49 -0
- package/dist/commonjs/object/equals.js +71 -0
- package/dist/commonjs/object/for-each-obj.js +30 -0
- package/dist/commonjs/object/from-pairs.js +14 -0
- package/dist/commonjs/object/index.js +39 -0
- package/dist/commonjs/object/invert.js +15 -0
- package/dist/commonjs/object/keys.js +10 -0
- package/dist/commonjs/object/map-keys.js +16 -0
- package/dist/commonjs/object/map-values.js +16 -0
- package/dist/commonjs/object/merge-deep.js +31 -0
- package/dist/commonjs/object/merge.js +11 -0
- package/dist/commonjs/object/omit-by.js +20 -0
- package/dist/commonjs/object/omit.js +25 -0
- package/dist/commonjs/object/path-or.js +18 -0
- package/dist/commonjs/object/pick-by.js +20 -0
- package/dist/commonjs/object/pick.js +19 -0
- package/dist/commonjs/object/prop.js +7 -0
- package/dist/commonjs/object/set-path.js +26 -0
- package/dist/commonjs/object/set.js +14 -0
- package/dist/commonjs/object/swap-props.js +16 -0
- package/dist/commonjs/object/to-pairs.js +11 -0
- package/dist/commonjs/object/values.js +7 -0
- package/dist/commonjs/string/cases-types.js +2 -0
- package/dist/commonjs/string/cases.js +107 -0
- package/dist/commonjs/string/human-readable-file-size.js +16 -0
- package/dist/commonjs/string/index.js +21 -0
- package/dist/commonjs/string/random-string.js +10 -0
- package/dist/commonjs/string/slugify.js +13 -0
- package/dist/commonjs/string/string-to-path.js +18 -0
- package/dist/commonjs/type/index.js +17 -0
- package/dist/commonjs/type/type.js +13 -0
- package/dist/commonjs/utils/heap.js +43 -0
- package/dist/commonjs/utils/narrow.js +2 -0
- package/dist/commonjs/utils/paths.js +2 -0
- package/dist/commonjs/utils/purry-on.js +10 -0
- package/dist/commonjs/utils/purry-order-rules.js +66 -0
- package/dist/commonjs/utils/quick-select.js +31 -0
- package/dist/commonjs/utils/reduce-lazy.js +18 -0
- package/dist/commonjs/utils/swap-in-place.js +7 -0
- package/dist/commonjs/utils/to-lazy-indexed.js +7 -0
- package/dist/commonjs/utils/to-single.js +8 -0
- package/dist/commonjs/utils/types.js +2 -0
- package/dist/commonjs/utils/with-precision.js +23 -0
- package/dist/es/aria/index.js +1 -0
- package/dist/es/aria/key-codes.js +22 -0
- package/dist/es/array/all-pass.js +7 -0
- package/dist/es/array/any-pass.js +7 -0
- package/dist/es/array/chunk.js +13 -0
- package/dist/es/array/compact.js +4 -0
- package/dist/es/array/concat.js +7 -0
- package/dist/es/array/count-by.js +18 -0
- package/dist/es/array/difference-with.js +27 -0
- package/dist/es/array/difference.js +28 -0
- package/dist/es/array/drop-first-by.js +22 -0
- package/dist/es/array/drop-last-while.js +12 -0
- package/dist/es/array/drop-last.js +11 -0
- package/dist/es/array/drop-while.js +12 -0
- package/dist/es/array/drop.js +28 -0
- package/dist/es/array/filter.js +37 -0
- package/dist/es/array/find-index.js +42 -0
- package/dist/es/array/find-last-index.js +20 -0
- package/dist/es/array/find-last.js +20 -0
- package/dist/es/array/find.js +34 -0
- package/dist/es/array/first-by.js +18 -0
- package/dist/es/array/first.js +22 -0
- package/dist/es/array/flat-map-to-obj.js +21 -0
- package/dist/es/array/flat-map.js +29 -0
- package/dist/es/array/flatten-deep.js +44 -0
- package/dist/es/array/flatten.js +28 -0
- package/dist/es/array/for-each.js +36 -0
- package/dist/es/array/group-by.js +29 -0
- package/dist/es/array/has-at-least.js +7 -0
- package/dist/es/array/index-by.js +20 -0
- package/dist/es/array/index.js +65 -0
- package/dist/es/array/intersection-with.js +27 -0
- package/dist/es/array/intersection.js +28 -0
- package/dist/es/array/join.js +7 -0
- package/dist/es/array/last.js +7 -0
- package/dist/es/array/length.js +7 -0
- package/dist/es/array/map-to-obj.js +19 -0
- package/dist/es/array/map.js +31 -0
- package/dist/es/array/max-by.js +24 -0
- package/dist/es/array/mean-by.js +22 -0
- package/dist/es/array/merge-all.js +3 -0
- package/dist/es/array/min-by.js +24 -0
- package/dist/es/array/nth-by.js +8 -0
- package/dist/es/array/only.js +10 -0
- package/dist/es/array/partition.js +20 -0
- package/dist/es/array/range.js +11 -0
- package/dist/es/array/rank-by.js +13 -0
- package/dist/es/array/reduce.js +15 -0
- package/dist/es/array/reject.js +37 -0
- package/dist/es/array/reverse.js +7 -0
- package/dist/es/array/sample.js +30 -0
- package/dist/es/array/shuffle.js +14 -0
- package/dist/es/array/sort-by.js +48 -0
- package/dist/es/array/sort.js +12 -0
- package/dist/es/array/splice.js +9 -0
- package/dist/es/array/split-at.js +9 -0
- package/dist/es/array/split-when.js +13 -0
- package/dist/es/array/sum-by.js +20 -0
- package/dist/es/array/swap-indices.js +30 -0
- package/dist/es/array/take-first-by.js +20 -0
- package/dist/es/array/take-while.js +14 -0
- package/dist/es/array/take.js +34 -0
- package/dist/es/array/uniq-by.js +26 -0
- package/dist/es/array/uniq-with.js +29 -0
- package/dist/es/array/uniq.js +28 -0
- package/dist/es/array/zip-obj.js +12 -0
- package/dist/es/array/zip-with.js +19 -0
- package/dist/es/array/zip.js +15 -0
- package/dist/es/function/conditional.js +30 -0
- package/dist/es/function/create-pipe.js +4 -0
- package/dist/es/function/debounce.js +84 -0
- package/dist/es/function/identity.js +3 -0
- package/dist/es/function/index.js +9 -0
- package/dist/es/function/noop.js +3 -0
- package/dist/es/function/once.js +11 -0
- package/dist/es/function/pipe.js +102 -0
- package/dist/es/function/purry.js +16 -0
- package/dist/es/function/sleep.js +5 -0
- package/dist/es/guard/index.js +16 -0
- package/dist/es/guard/is-array.js +3 -0
- package/dist/es/guard/is-boolean.js +3 -0
- package/dist/es/guard/is-date.js +3 -0
- package/dist/es/guard/is-defined.js +9 -0
- package/dist/es/guard/is-empty.js +15 -0
- package/dist/es/guard/is-error.js +3 -0
- package/dist/es/guard/is-function.js +3 -0
- package/dist/es/guard/is-nil.js +3 -0
- package/dist/es/guard/is-non-null.js +3 -0
- package/dist/es/guard/is-not.js +5 -0
- package/dist/es/guard/is-number.js +3 -0
- package/dist/es/guard/is-object.js +7 -0
- package/dist/es/guard/is-promise.js +3 -0
- package/dist/es/guard/is-string.js +3 -0
- package/dist/es/guard/is-symbol.js +3 -0
- package/dist/es/guard/is-truthy.js +3 -0
- package/dist/es/index.js +9 -0
- package/dist/es/number/add.js +7 -0
- package/dist/es/number/ceil.js +5 -0
- package/dist/es/number/clamp.js +13 -0
- package/dist/es/number/divide.js +7 -0
- package/dist/es/number/floor.js +5 -0
- package/dist/es/number/index.js +8 -0
- package/dist/es/number/multiply.js +7 -0
- package/dist/es/number/round.js +5 -0
- package/dist/es/number/subtract.js +7 -0
- package/dist/es/object/add-prop.js +10 -0
- package/dist/es/object/clone.js +45 -0
- package/dist/es/object/equals.js +67 -0
- package/dist/es/object/for-each-obj.js +26 -0
- package/dist/es/object/from-pairs.js +10 -0
- package/dist/es/object/index.js +23 -0
- package/dist/es/object/invert.js +11 -0
- package/dist/es/object/keys.js +6 -0
- package/dist/es/object/map-keys.js +12 -0
- package/dist/es/object/map-values.js +12 -0
- package/dist/es/object/merge-deep.js +27 -0
- package/dist/es/object/merge.js +7 -0
- package/dist/es/object/omit-by.js +16 -0
- package/dist/es/object/omit.js +21 -0
- package/dist/es/object/path-or.js +14 -0
- package/dist/es/object/pick-by.js +16 -0
- package/dist/es/object/pick.js +15 -0
- package/dist/es/object/prop.js +3 -0
- package/dist/es/object/set-path.js +21 -0
- package/dist/es/object/set.js +10 -0
- package/dist/es/object/swap-props.js +12 -0
- package/dist/es/object/to-pairs.js +7 -0
- package/dist/es/object/values.js +3 -0
- package/dist/es/string/cases-types.js +1 -0
- package/dist/es/string/cases.js +93 -0
- package/dist/es/string/human-readable-file-size.js +12 -0
- package/dist/es/string/index.js +5 -0
- package/dist/es/string/random-string.js +6 -0
- package/dist/es/string/slugify.js +9 -0
- package/dist/es/string/string-to-path.js +14 -0
- package/dist/es/type/index.js +1 -0
- package/dist/es/type/type.js +9 -0
- package/dist/es/utils/heap.js +38 -0
- package/dist/es/utils/narrow.js +1 -0
- package/dist/es/utils/paths.js +1 -0
- package/dist/es/utils/purry-on.js +6 -0
- package/dist/es/utils/purry-order-rules.js +61 -0
- package/dist/es/utils/quick-select.js +27 -0
- package/dist/es/utils/reduce-lazy.js +14 -0
- package/dist/es/utils/swap-in-place.js +3 -0
- package/dist/es/utils/to-lazy-indexed.js +3 -0
- package/dist/es/utils/to-single.js +4 -0
- package/dist/es/utils/types.js +1 -0
- package/dist/es/utils/with-precision.js +19 -0
- package/dist/metadata.json +48311 -0
- package/dist/types/aria/index.d.ts +2 -0
- package/dist/types/aria/index.d.ts.map +1 -0
- package/dist/types/aria/key-codes.d.ts +26 -0
- package/dist/types/aria/key-codes.d.ts.map +1 -0
- package/dist/types/array/all-pass.d.ts +32 -0
- package/dist/types/array/all-pass.d.ts.map +1 -0
- package/dist/types/array/any-pass.d.ts +32 -0
- package/dist/types/array/any-pass.d.ts.map +1 -0
- package/dist/types/array/chunk.d.ts +29 -0
- package/dist/types/array/chunk.d.ts.map +1 -0
- package/dist/types/array/compact.d.ts +12 -0
- package/dist/types/array/compact.d.ts.map +1 -0
- package/dist/types/array/concat.d.ts +24 -0
- package/dist/types/array/concat.d.ts.map +1 -0
- package/dist/types/array/count-by.d.ts +20 -0
- package/dist/types/array/count-by.d.ts.map +1 -0
- package/dist/types/array/difference-with.d.ts +48 -0
- package/dist/types/array/difference-with.d.ts.map +1 -0
- package/dist/types/array/difference.d.ts +35 -0
- package/dist/types/array/difference.d.ts.map +1 -0
- package/dist/types/array/drop-first-by.d.ts +39 -0
- package/dist/types/array/drop-first-by.d.ts.map +1 -0
- package/dist/types/array/drop-last-while.d.ts +30 -0
- package/dist/types/array/drop-last-while.d.ts.map +1 -0
- package/dist/types/array/drop-last.d.ts +25 -0
- package/dist/types/array/drop-last.d.ts.map +1 -0
- package/dist/types/array/drop-while.d.ts +33 -0
- package/dist/types/array/drop-while.d.ts.map +1 -0
- package/dist/types/array/drop.d.ts +31 -0
- package/dist/types/array/drop.d.ts.map +1 -0
- package/dist/types/array/filter.d.ts +49 -0
- package/dist/types/array/filter.d.ts.map +1 -0
- package/dist/types/array/find-index.d.ts +67 -0
- package/dist/types/array/find-index.d.ts.map +1 -0
- package/dist/types/array/find-last-index.d.ts +43 -0
- package/dist/types/array/find-last-index.d.ts.map +1 -0
- package/dist/types/array/find-last.d.ts +45 -0
- package/dist/types/array/find-last.d.ts.map +1 -0
- package/dist/types/array/find.d.ts +59 -0
- package/dist/types/array/find.d.ts.map +1 -0
- package/dist/types/array/first-by.d.ts +57 -0
- package/dist/types/array/first-by.d.ts.map +1 -0
- package/dist/types/array/first.d.ts +35 -0
- package/dist/types/array/first.d.ts.map +1 -0
- package/dist/types/array/flat-map-to-obj.d.ts +50 -0
- package/dist/types/array/flat-map-to-obj.d.ts.map +1 -0
- package/dist/types/array/flat-map.d.ts +39 -0
- package/dist/types/array/flat-map.d.ts.map +1 -0
- package/dist/types/array/flatten-deep.d.ts +26 -0
- package/dist/types/array/flatten-deep.d.ts.map +1 -0
- package/dist/types/array/flatten.d.ts +23 -0
- package/dist/types/array/flatten.d.ts.map +1 -0
- package/dist/types/array/for-each.d.ts +57 -0
- package/dist/types/array/for-each.d.ts.map +1 -0
- package/dist/types/array/group-by.d.ts +36 -0
- package/dist/types/array/group-by.d.ts.map +1 -0
- package/dist/types/array/has-at-least.d.ts +47 -0
- package/dist/types/array/has-at-least.d.ts.map +1 -0
- package/dist/types/array/index-by.d.ts +34 -0
- package/dist/types/array/index-by.d.ts.map +1 -0
- package/dist/types/array/index.d.ts +66 -0
- package/dist/types/array/index.d.ts.map +1 -0
- package/dist/types/array/intersection-with.d.ts +54 -0
- package/dist/types/array/intersection-with.d.ts.map +1 -0
- package/dist/types/array/intersection.d.ts +30 -0
- package/dist/types/array/intersection.d.ts.map +1 -0
- package/dist/types/array/join.d.ts +45 -0
- package/dist/types/array/join.d.ts.map +1 -0
- package/dist/types/array/last.d.ts +24 -0
- package/dist/types/array/last.d.ts.map +1 -0
- package/dist/types/array/length.d.ts +14 -0
- package/dist/types/array/length.d.ts.map +1 -0
- package/dist/types/array/map-to-obj.d.ts +42 -0
- package/dist/types/array/map-to-obj.d.ts.map +1 -0
- package/dist/types/array/map.d.ts +62 -0
- package/dist/types/array/map.d.ts.map +1 -0
- package/dist/types/array/max-by.d.ts +39 -0
- package/dist/types/array/max-by.d.ts.map +1 -0
- package/dist/types/array/mean-by.d.ts +39 -0
- package/dist/types/array/mean-by.d.ts.map +1 -0
- package/dist/types/array/merge-all.d.ts +16 -0
- package/dist/types/array/merge-all.d.ts.map +1 -0
- package/dist/types/array/min-by.d.ts +39 -0
- package/dist/types/array/min-by.d.ts.map +1 -0
- package/dist/types/array/nth-by.d.ts +45 -0
- package/dist/types/array/nth-by.d.ts.map +1 -0
- package/dist/types/array/only.d.ts +36 -0
- package/dist/types/array/only.d.ts.map +1 -0
- package/dist/types/array/partition.d.ts +60 -0
- package/dist/types/array/partition.d.ts.map +1 -0
- package/dist/types/array/range.d.ts +22 -0
- package/dist/types/array/range.d.ts.map +1 -0
- package/dist/types/array/rank-by.d.ts +41 -0
- package/dist/types/array/rank-by.d.ts.map +1 -0
- package/dist/types/array/reduce.d.ts +35 -0
- package/dist/types/array/reduce.d.ts.map +1 -0
- package/dist/types/array/reject.d.ts +42 -0
- package/dist/types/array/reject.d.ts.map +1 -0
- package/dist/types/array/reverse.d.ts +25 -0
- package/dist/types/array/reverse.d.ts.map +1 -0
- package/dist/types/array/sample.d.ts +54 -0
- package/dist/types/array/sample.d.ts.map +1 -0
- package/dist/types/array/shuffle.d.ts +22 -0
- package/dist/types/array/shuffle.d.ts.map +1 -0
- package/dist/types/array/sort-by.d.ts +99 -0
- package/dist/types/array/sort-by.d.ts.map +1 -0
- package/dist/types/array/sort.d.ts +52 -0
- package/dist/types/array/sort.d.ts.map +1 -0
- package/dist/types/array/splice.d.ts +31 -0
- package/dist/types/array/splice.d.ts.map +1 -0
- package/dist/types/array/split-at.d.ts +26 -0
- package/dist/types/array/split-at.d.ts.map +1 -0
- package/dist/types/array/split-when.d.ts +24 -0
- package/dist/types/array/split-when.d.ts.map +1 -0
- package/dist/types/array/sum-by.d.ts +39 -0
- package/dist/types/array/sum-by.d.ts.map +1 -0
- package/dist/types/array/swap-indices.d.ts +68 -0
- package/dist/types/array/swap-indices.d.ts.map +1 -0
- package/dist/types/array/take-first-by.d.ts +43 -0
- package/dist/types/array/take-first-by.d.ts.map +1 -0
- package/dist/types/array/take-while.d.ts +24 -0
- package/dist/types/array/take-while.d.ts.map +1 -0
- package/dist/types/array/take.d.ts +30 -0
- package/dist/types/array/take.d.ts.map +1 -0
- package/dist/types/array/uniq-by.d.ts +22 -0
- package/dist/types/array/uniq-by.d.ts.map +1 -0
- package/dist/types/array/uniq-with.d.ts +44 -0
- package/dist/types/array/uniq-with.d.ts.map +1 -0
- package/dist/types/array/uniq.d.ts +24 -0
- package/dist/types/array/uniq.d.ts.map +1 -0
- package/dist/types/array/zip-obj.d.ts +26 -0
- package/dist/types/array/zip-obj.d.ts.map +1 -0
- package/dist/types/array/zip-with.d.ts +42 -0
- package/dist/types/array/zip-with.d.ts.map +1 -0
- package/dist/types/array/zip.d.ts +52 -0
- package/dist/types/array/zip.d.ts.map +1 -0
- package/dist/types/function/conditional.d.ts +108 -0
- package/dist/types/function/conditional.d.ts.map +1 -0
- package/dist/types/function/create-pipe.d.ts +19 -0
- package/dist/types/function/create-pipe.d.ts.map +1 -0
- package/dist/types/function/debounce.d.ts +92 -0
- package/dist/types/function/debounce.d.ts.map +1 -0
- package/dist/types/function/identity.d.ts +10 -0
- package/dist/types/function/identity.d.ts.map +1 -0
- package/dist/types/function/index.d.ts +10 -0
- package/dist/types/function/index.d.ts.map +1 -0
- package/dist/types/function/noop.d.ts +10 -0
- package/dist/types/function/noop.d.ts.map +1 -0
- package/dist/types/function/once.d.ts +13 -0
- package/dist/types/function/once.d.ts.map +1 -0
- package/dist/types/function/pipe.d.ts +32 -0
- package/dist/types/function/pipe.d.ts.map +1 -0
- package/dist/types/function/purry.d.ts +32 -0
- package/dist/types/function/purry.d.ts.map +1 -0
- package/dist/types/function/sleep.d.ts +12 -0
- package/dist/types/function/sleep.d.ts.map +1 -0
- package/dist/types/guard/index.d.ts +17 -0
- package/dist/types/guard/index.d.ts.map +1 -0
- package/dist/types/guard/is-array.d.ts +15 -0
- package/dist/types/guard/is-array.d.ts.map +1 -0
- package/dist/types/guard/is-boolean.d.ts +15 -0
- package/dist/types/guard/is-boolean.d.ts.map +1 -0
- package/dist/types/guard/is-date.d.ts +13 -0
- package/dist/types/guard/is-date.d.ts.map +1 -0
- package/dist/types/guard/is-defined.d.ts +22 -0
- package/dist/types/guard/is-defined.d.ts.map +1 -0
- package/dist/types/guard/is-empty.d.ts +19 -0
- package/dist/types/guard/is-empty.d.ts.map +1 -0
- package/dist/types/guard/is-error.d.ts +15 -0
- package/dist/types/guard/is-error.d.ts.map +1 -0
- package/dist/types/guard/is-function.d.ts +15 -0
- package/dist/types/guard/is-function.d.ts.map +1 -0
- package/dist/types/guard/is-nil.d.ts +14 -0
- package/dist/types/guard/is-nil.d.ts.map +1 -0
- package/dist/types/guard/is-non-null.d.ts +15 -0
- package/dist/types/guard/is-non-null.d.ts.map +1 -0
- package/dist/types/guard/is-not.d.ts +15 -0
- package/dist/types/guard/is-not.d.ts.map +1 -0
- package/dist/types/guard/is-number.d.ts +14 -0
- package/dist/types/guard/is-number.d.ts.map +1 -0
- package/dist/types/guard/is-object.d.ts +28 -0
- package/dist/types/guard/is-object.d.ts.map +1 -0
- package/dist/types/guard/is-promise.d.ts +14 -0
- package/dist/types/guard/is-promise.d.ts.map +1 -0
- package/dist/types/guard/is-string.d.ts +14 -0
- package/dist/types/guard/is-string.d.ts.map +1 -0
- package/dist/types/guard/is-symbol.d.ts +14 -0
- package/dist/types/guard/is-symbol.d.ts.map +1 -0
- package/dist/types/guard/is-truthy.d.ts +17 -0
- package/dist/types/guard/is-truthy.d.ts.map +1 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/number/add.d.ts +29 -0
- package/dist/types/number/add.d.ts.map +1 -0
- package/dist/types/number/ceil.d.ts +35 -0
- package/dist/types/number/ceil.d.ts.map +1 -0
- package/dist/types/number/clamp.d.ts +38 -0
- package/dist/types/number/clamp.d.ts.map +1 -0
- package/dist/types/number/divide.d.ts +27 -0
- package/dist/types/number/divide.d.ts.map +1 -0
- package/dist/types/number/floor.d.ts +35 -0
- package/dist/types/number/floor.d.ts.map +1 -0
- package/dist/types/number/index.d.ts +9 -0
- package/dist/types/number/index.d.ts.map +1 -0
- package/dist/types/number/multiply.d.ts +27 -0
- package/dist/types/number/multiply.d.ts.map +1 -0
- package/dist/types/number/round.d.ts +35 -0
- package/dist/types/number/round.d.ts.map +1 -0
- package/dist/types/number/subtract.d.ts +29 -0
- package/dist/types/number/subtract.d.ts.map +1 -0
- package/dist/types/object/add-prop.d.ts +30 -0
- package/dist/types/object/add-prop.d.ts.map +1 -0
- package/dist/types/object/clone.d.ts +10 -0
- package/dist/types/object/clone.d.ts.map +1 -0
- package/dist/types/object/equals.d.ts +30 -0
- package/dist/types/object/equals.d.ts.map +1 -0
- package/dist/types/object/for-each-obj.d.ts +44 -0
- package/dist/types/object/for-each-obj.d.ts.map +1 -0
- package/dist/types/object/from-pairs.d.ts +38 -0
- package/dist/types/object/from-pairs.d.ts.map +1 -0
- package/dist/types/object/index.d.ts +24 -0
- package/dist/types/object/index.d.ts.map +1 -0
- package/dist/types/object/invert.d.ts +28 -0
- package/dist/types/object/invert.d.ts.map +1 -0
- package/dist/types/object/keys.d.ts +34 -0
- package/dist/types/object/keys.d.ts.map +1 -0
- package/dist/types/object/map-keys.d.ts +24 -0
- package/dist/types/object/map-keys.d.ts.map +1 -0
- package/dist/types/object/map-values.d.ts +25 -0
- package/dist/types/object/map-values.d.ts.map +1 -0
- package/dist/types/object/merge-deep.d.ts +32 -0
- package/dist/types/object/merge-deep.d.ts.map +1 -0
- package/dist/types/object/merge.d.ts +25 -0
- package/dist/types/object/merge.d.ts.map +1 -0
- package/dist/types/object/omit-by.d.ts +22 -0
- package/dist/types/object/omit-by.d.ts.map +1 -0
- package/dist/types/object/omit.d.ts +24 -0
- package/dist/types/object/omit.d.ts.map +1 -0
- package/dist/types/object/path-or.d.ts +76 -0
- package/dist/types/object/path-or.d.ts.map +1 -0
- package/dist/types/object/pick-by.d.ts +22 -0
- package/dist/types/object/pick-by.d.ts.map +1 -0
- package/dist/types/object/pick.d.ts +22 -0
- package/dist/types/object/pick.d.ts.map +1 -0
- package/dist/types/object/prop.d.ts +11 -0
- package/dist/types/object/prop.d.ts.map +1 -0
- package/dist/types/object/set-path.d.ts +29 -0
- package/dist/types/object/set-path.d.ts.map +1 -0
- package/dist/types/object/set.d.ts +26 -0
- package/dist/types/object/set.d.ts.map +1 -0
- package/dist/types/object/swap-props.d.ts +44 -0
- package/dist/types/object/swap-props.d.ts.map +1 -0
- package/dist/types/object/to-pairs.d.ts +33 -0
- package/dist/types/object/to-pairs.d.ts.map +1 -0
- package/dist/types/object/values.d.ts +20 -0
- package/dist/types/object/values.d.ts.map +1 -0
- package/dist/types/string/cases-types.d.ts +36 -0
- package/dist/types/string/cases-types.d.ts.map +1 -0
- package/dist/types/string/cases.d.ts +22 -0
- package/dist/types/string/cases.d.ts.map +1 -0
- package/dist/types/string/human-readable-file-size.d.ts +13 -0
- package/dist/types/string/human-readable-file-size.d.ts.map +1 -0
- package/dist/types/string/index.d.ts +6 -0
- package/dist/types/string/index.d.ts.map +1 -0
- package/dist/types/string/random-string.d.ts +10 -0
- package/dist/types/string/random-string.d.ts.map +1 -0
- package/dist/types/string/slugify.d.ts +12 -0
- package/dist/types/string/slugify.d.ts.map +1 -0
- package/dist/types/string/string-to-path.d.ts +11 -0
- package/dist/types/string/string-to-path.d.ts.map +1 -0
- package/dist/types/type/index.d.ts +2 -0
- package/dist/types/type/index.d.ts.map +1 -0
- package/dist/types/type/type.d.ts +19 -0
- package/dist/types/type/type.d.ts.map +1 -0
- package/dist/types/utils/heap.d.ts +24 -0
- package/dist/types/utils/heap.d.ts.map +1 -0
- package/dist/types/utils/narrow.d.ts +52 -0
- package/dist/types/utils/narrow.d.ts.map +1 -0
- package/dist/types/utils/paths.d.ts +9 -0
- package/dist/types/utils/paths.d.ts.map +1 -0
- package/dist/types/utils/purry-on.d.ts +7 -0
- package/dist/types/utils/purry-on.d.ts.map +1 -0
- package/dist/types/utils/purry-order-rules.d.ts +52 -0
- package/dist/types/utils/purry-order-rules.d.ts.map +1 -0
- package/dist/types/utils/quick-select.d.ts +18 -0
- package/dist/types/utils/quick-select.d.ts.map +1 -0
- package/dist/types/utils/reduce-lazy.d.ts +22 -0
- package/dist/types/utils/reduce-lazy.d.ts.map +1 -0
- package/dist/types/utils/swap-in-place.d.ts +5 -0
- package/dist/types/utils/swap-in-place.d.ts.map +1 -0
- package/dist/types/utils/to-lazy-indexed.d.ts +4 -0
- package/dist/types/utils/to-lazy-indexed.d.ts.map +1 -0
- package/dist/types/utils/to-single.d.ts +4 -0
- package/dist/types/utils/to-single.d.ts.map +1 -0
- package/dist/types/utils/types.d.ts +32 -0
- package/dist/types/utils/types.d.ts.map +1 -0
- package/dist/types/utils/with-precision.d.ts +2 -0
- package/dist/types/utils/with-precision.d.ts.map +1 -0
- package/package.json +34 -23
- package/dist/index.cjs +0 -2843
- package/dist/index.d.cts +0 -4175
- package/dist/index.d.ts +0 -4175
- package/dist/index.js +0 -2678
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -7
package/dist/index.cjs
DELETED
|
@@ -1,2843 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/index.ts
|
|
21
|
-
var src_exports = {};
|
|
22
|
-
__export(src_exports, {
|
|
23
|
-
KEY_CODES: () => KEY_CODES,
|
|
24
|
-
_setPath: () => _setPath,
|
|
25
|
-
add: () => add,
|
|
26
|
-
addProp: () => addProp,
|
|
27
|
-
allPass: () => allPass,
|
|
28
|
-
anyPass: () => anyPass,
|
|
29
|
-
ceil: () => ceil,
|
|
30
|
-
chunk: () => chunk,
|
|
31
|
-
clamp: () => clamp,
|
|
32
|
-
clone: () => clone,
|
|
33
|
-
compact: () => compact,
|
|
34
|
-
concat: () => concat,
|
|
35
|
-
conditional: () => conditional,
|
|
36
|
-
countBy: () => countBy,
|
|
37
|
-
createPipe: () => createPipe,
|
|
38
|
-
debounce: () => debounce,
|
|
39
|
-
difference: () => difference,
|
|
40
|
-
differenceWith: () => differenceWith,
|
|
41
|
-
divide: () => divide,
|
|
42
|
-
drop: () => drop,
|
|
43
|
-
dropFirstBy: () => dropFirstBy,
|
|
44
|
-
dropLast: () => dropLast,
|
|
45
|
-
dropLastWhile: () => dropLastWhile,
|
|
46
|
-
dropWhile: () => dropWhile,
|
|
47
|
-
equals: () => equals,
|
|
48
|
-
filter: () => filter,
|
|
49
|
-
find: () => find,
|
|
50
|
-
findIndex: () => findIndex,
|
|
51
|
-
findLast: () => findLast,
|
|
52
|
-
findLastIndex: () => findLastIndex,
|
|
53
|
-
first: () => first,
|
|
54
|
-
firstBy: () => firstBy,
|
|
55
|
-
flatMap: () => flatMap,
|
|
56
|
-
flatMapToObj: () => flatMapToObj,
|
|
57
|
-
flatten: () => flatten,
|
|
58
|
-
flattenDeep: () => flattenDeep,
|
|
59
|
-
floor: () => floor,
|
|
60
|
-
forEach: () => forEach,
|
|
61
|
-
forEachObj: () => forEachObj,
|
|
62
|
-
fromPairs: () => fromPairs,
|
|
63
|
-
groupBy: () => groupBy,
|
|
64
|
-
hasAtLeast: () => hasAtLeast,
|
|
65
|
-
humanReadableFileSize: () => humanReadableFileSize,
|
|
66
|
-
identity: () => identity,
|
|
67
|
-
indexBy: () => indexBy,
|
|
68
|
-
intersection: () => intersection,
|
|
69
|
-
intersectionWith: () => intersectionWith,
|
|
70
|
-
invert: () => invert,
|
|
71
|
-
isArray: () => isArray,
|
|
72
|
-
isBoolean: () => isBoolean,
|
|
73
|
-
isBrowser: () => isBrowser,
|
|
74
|
-
isDate: () => isDate,
|
|
75
|
-
isDefined: () => isDefined,
|
|
76
|
-
isEmpty: () => isEmpty,
|
|
77
|
-
isError: () => isError,
|
|
78
|
-
isFunction: () => isFunction,
|
|
79
|
-
isNil: () => isNil,
|
|
80
|
-
isNonNull: () => isNonNull,
|
|
81
|
-
isNot: () => isNot,
|
|
82
|
-
isNumber: () => isNumber,
|
|
83
|
-
isObject: () => isObject,
|
|
84
|
-
isPromise: () => isPromise,
|
|
85
|
-
isString: () => isString,
|
|
86
|
-
isSymbol: () => isSymbol,
|
|
87
|
-
isTruthy: () => isTruthy,
|
|
88
|
-
isUppercase: () => isUppercase,
|
|
89
|
-
join: () => join,
|
|
90
|
-
keys: () => keys,
|
|
91
|
-
last: () => last,
|
|
92
|
-
length: () => length,
|
|
93
|
-
map: () => map,
|
|
94
|
-
mapKeys: () => mapKeys,
|
|
95
|
-
mapToObj: () => mapToObj,
|
|
96
|
-
mapValues: () => mapValues,
|
|
97
|
-
maxBy: () => maxBy,
|
|
98
|
-
meanBy: () => meanBy,
|
|
99
|
-
merge: () => merge,
|
|
100
|
-
mergeAll: () => mergeAll,
|
|
101
|
-
mergeDeep: () => mergeDeep,
|
|
102
|
-
minBy: () => minBy,
|
|
103
|
-
multiply: () => multiply,
|
|
104
|
-
noop: () => noop,
|
|
105
|
-
nthBy: () => nthBy,
|
|
106
|
-
omit: () => omit,
|
|
107
|
-
omitBy: () => omitBy,
|
|
108
|
-
once: () => once,
|
|
109
|
-
only: () => only,
|
|
110
|
-
partition: () => partition2,
|
|
111
|
-
pathOr: () => pathOr,
|
|
112
|
-
pick: () => pick,
|
|
113
|
-
pickBy: () => pickBy,
|
|
114
|
-
pipe: () => pipe,
|
|
115
|
-
prop: () => prop,
|
|
116
|
-
purry: () => purry,
|
|
117
|
-
randomString: () => randomString,
|
|
118
|
-
range: () => range,
|
|
119
|
-
rankBy: () => rankBy,
|
|
120
|
-
reduce: () => reduce,
|
|
121
|
-
reject: () => reject,
|
|
122
|
-
reverse: () => reverse,
|
|
123
|
-
round: () => round,
|
|
124
|
-
sample: () => sample,
|
|
125
|
-
set: () => set,
|
|
126
|
-
setPath: () => setPath,
|
|
127
|
-
shuffle: () => shuffle,
|
|
128
|
-
sleep: () => sleep,
|
|
129
|
-
slugify: () => slugify,
|
|
130
|
-
sort: () => sort,
|
|
131
|
-
sortBy: () => sortBy,
|
|
132
|
-
splice: () => splice,
|
|
133
|
-
splitAt: () => splitAt,
|
|
134
|
-
splitByCase: () => splitByCase,
|
|
135
|
-
splitWhen: () => splitWhen,
|
|
136
|
-
stringToPath: () => stringToPath,
|
|
137
|
-
subtract: () => subtract,
|
|
138
|
-
sumBy: () => sumBy,
|
|
139
|
-
swapIndices: () => swapIndices,
|
|
140
|
-
swapProps: () => swapProps,
|
|
141
|
-
take: () => take,
|
|
142
|
-
takeFirstBy: () => takeFirstBy,
|
|
143
|
-
takeWhile: () => takeWhile,
|
|
144
|
-
titleCase: () => titleCase,
|
|
145
|
-
toCamelCase: () => toCamelCase,
|
|
146
|
-
toFlatCase: () => toFlatCase,
|
|
147
|
-
toKebabCase: () => toKebabCase,
|
|
148
|
-
toLowerFirst: () => toLowerFirst,
|
|
149
|
-
toPairs: () => toPairs,
|
|
150
|
-
toPascalCase: () => toPascalCase,
|
|
151
|
-
toSnakeCase: () => toSnakeCase,
|
|
152
|
-
toTrainCase: () => toTrainCase,
|
|
153
|
-
toUpperFirst: () => toUpperFirst,
|
|
154
|
-
type: () => type,
|
|
155
|
-
uniq: () => uniq,
|
|
156
|
-
uniqBy: () => uniqBy,
|
|
157
|
-
uniqWith: () => uniqWith,
|
|
158
|
-
values: () => values,
|
|
159
|
-
zip: () => zip,
|
|
160
|
-
zipObj: () => zipObj,
|
|
161
|
-
zipWith: () => zipWith
|
|
162
|
-
});
|
|
163
|
-
module.exports = __toCommonJS(src_exports);
|
|
164
|
-
|
|
165
|
-
// src/aria/key-codes.ts
|
|
166
|
-
var KEY_CODES = {
|
|
167
|
-
ALT: "Alt",
|
|
168
|
-
ARROW_DOWN: "ArrowDown",
|
|
169
|
-
ARROW_LEFT: "ArrowLeft",
|
|
170
|
-
ARROW_RIGHT: "ArrowRight",
|
|
171
|
-
ARROW_UP: "ArrowUp",
|
|
172
|
-
AT: "@",
|
|
173
|
-
BACKSPACE: "Backspace",
|
|
174
|
-
CTRL: "Control",
|
|
175
|
-
DELETE: "Delete",
|
|
176
|
-
END: "End",
|
|
177
|
-
ENTER: "Enter",
|
|
178
|
-
ESC: "Escape",
|
|
179
|
-
HOME: "Home",
|
|
180
|
-
KEY_F: "KEY_F",
|
|
181
|
-
META: "Meta",
|
|
182
|
-
PAGE_DOWN: "PageDown",
|
|
183
|
-
PAGE_UP: "PageUp",
|
|
184
|
-
SHIFT: "Shift",
|
|
185
|
-
SPACE: "Space",
|
|
186
|
-
TAB: "Tab"
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
// src/function/purry.ts
|
|
190
|
-
function purry(fn, args, lazy) {
|
|
191
|
-
const diff = fn.length - args.length;
|
|
192
|
-
const arrayArgs = Array.from(args);
|
|
193
|
-
if (diff === 0) {
|
|
194
|
-
return fn(...arrayArgs);
|
|
195
|
-
}
|
|
196
|
-
if (diff === 1) {
|
|
197
|
-
const ret = (data) => fn(data, ...arrayArgs);
|
|
198
|
-
if (lazy || fn.lazy) {
|
|
199
|
-
ret.lazy = lazy || fn.lazy;
|
|
200
|
-
ret.lazyArgs = args;
|
|
201
|
-
}
|
|
202
|
-
return ret;
|
|
203
|
-
}
|
|
204
|
-
throw new Error("Wrong number of arguments");
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// src/array/all-pass.ts
|
|
208
|
-
function allPass(...args) {
|
|
209
|
-
return purry(_allPass, args);
|
|
210
|
-
}
|
|
211
|
-
function _allPass(data, fns) {
|
|
212
|
-
return fns.every((fn) => fn(data));
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// src/array/any-pass.ts
|
|
216
|
-
function anyPass(...args) {
|
|
217
|
-
return purry(_anyPass, args);
|
|
218
|
-
}
|
|
219
|
-
function _anyPass(data, fns) {
|
|
220
|
-
return fns.some((fn) => fn(data));
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// src/array/chunk.ts
|
|
224
|
-
function chunk(...args) {
|
|
225
|
-
return purry(_chunk, args);
|
|
226
|
-
}
|
|
227
|
-
function _chunk(array, size) {
|
|
228
|
-
const ret = Array.from({
|
|
229
|
-
length: Math.ceil(array.length / size)
|
|
230
|
-
});
|
|
231
|
-
for (let index = 0; index < ret.length; index += 1) {
|
|
232
|
-
ret[index] = array.slice(index * size, (index + 1) * size);
|
|
233
|
-
}
|
|
234
|
-
return ret;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// src/guard/is-truthy.ts
|
|
238
|
-
function isTruthy(data) {
|
|
239
|
-
return !!data;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// src/array/compact.ts
|
|
243
|
-
function compact(items) {
|
|
244
|
-
return items.filter(isTruthy);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
// src/array/concat.ts
|
|
248
|
-
function concat(...args) {
|
|
249
|
-
return purry(_concat, args);
|
|
250
|
-
}
|
|
251
|
-
function _concat(arr1, arr2) {
|
|
252
|
-
return arr1.concat(arr2);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// src/array/count-by.ts
|
|
256
|
-
function _countBy(indexed) {
|
|
257
|
-
return (array, fn) => {
|
|
258
|
-
return array.reduce((ret, item, index) => {
|
|
259
|
-
const value = indexed ? fn(item, index, array) : fn(item);
|
|
260
|
-
return ret + (value ? 1 : 0);
|
|
261
|
-
}, 0);
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
function countBy(...args) {
|
|
265
|
-
return purry(_countBy(false), args);
|
|
266
|
-
}
|
|
267
|
-
((countBy2) => {
|
|
268
|
-
function indexed(...args) {
|
|
269
|
-
return purry(_countBy(true), args);
|
|
270
|
-
}
|
|
271
|
-
countBy2.indexed = indexed;
|
|
272
|
-
})(countBy || (countBy = {}));
|
|
273
|
-
|
|
274
|
-
// src/utils/reduce-lazy.ts
|
|
275
|
-
function reduceLazy(array, lazy, indexed) {
|
|
276
|
-
const newArray = [];
|
|
277
|
-
for (let index = 0; index < array.length; index++) {
|
|
278
|
-
const item = array[index];
|
|
279
|
-
const result = indexed ? lazy(item, index, array) : lazy(item);
|
|
280
|
-
if (result.hasMany === true) {
|
|
281
|
-
newArray.push(...result.next);
|
|
282
|
-
} else if (result.hasNext) {
|
|
283
|
-
newArray.push(result.next);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
return newArray;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// src/array/difference-with.ts
|
|
290
|
-
function differenceWith(...args) {
|
|
291
|
-
return purry(_differenceWith, args, differenceWith.lazy);
|
|
292
|
-
}
|
|
293
|
-
function _differenceWith(array, other, isEquals) {
|
|
294
|
-
const lazy = differenceWith.lazy(other, isEquals);
|
|
295
|
-
return reduceLazy(array, lazy);
|
|
296
|
-
}
|
|
297
|
-
((differenceWith2) => {
|
|
298
|
-
function lazy(other, isEquals) {
|
|
299
|
-
return (value) => {
|
|
300
|
-
if (other.every((otherValue) => !isEquals(value, otherValue))) {
|
|
301
|
-
return {
|
|
302
|
-
done: false,
|
|
303
|
-
hasNext: true,
|
|
304
|
-
next: value
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
return {
|
|
308
|
-
done: false,
|
|
309
|
-
hasNext: false
|
|
310
|
-
};
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
differenceWith2.lazy = lazy;
|
|
314
|
-
})(differenceWith || (differenceWith = {}));
|
|
315
|
-
|
|
316
|
-
// src/array/difference.ts
|
|
317
|
-
function difference(...args) {
|
|
318
|
-
return purry(_difference, args, difference.lazy);
|
|
319
|
-
}
|
|
320
|
-
function _difference(array, other) {
|
|
321
|
-
const lazy = difference.lazy(other);
|
|
322
|
-
return reduceLazy(array, lazy);
|
|
323
|
-
}
|
|
324
|
-
((difference2) => {
|
|
325
|
-
function lazy(other) {
|
|
326
|
-
const set2 = new Set(other);
|
|
327
|
-
return (value) => {
|
|
328
|
-
if (!set2.has(value)) {
|
|
329
|
-
return {
|
|
330
|
-
done: false,
|
|
331
|
-
hasNext: true,
|
|
332
|
-
next: value
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
return {
|
|
336
|
-
done: false,
|
|
337
|
-
hasNext: false
|
|
338
|
-
};
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
difference2.lazy = lazy;
|
|
342
|
-
})(difference || (difference = {}));
|
|
343
|
-
|
|
344
|
-
// src/array/drop-last.ts
|
|
345
|
-
function dropLast(...args) {
|
|
346
|
-
return purry(_dropLast, args);
|
|
347
|
-
}
|
|
348
|
-
function _dropLast(array, n) {
|
|
349
|
-
const copy = [...array];
|
|
350
|
-
if (n > 0) {
|
|
351
|
-
copy.splice(-n);
|
|
352
|
-
}
|
|
353
|
-
return copy;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
// src/array/drop.ts
|
|
357
|
-
function drop(...args) {
|
|
358
|
-
return purry(_drop, args, drop.lazy);
|
|
359
|
-
}
|
|
360
|
-
function _drop(array, n) {
|
|
361
|
-
return reduceLazy(array, drop.lazy(n));
|
|
362
|
-
}
|
|
363
|
-
((drop2) => {
|
|
364
|
-
function lazy(n) {
|
|
365
|
-
let left = n;
|
|
366
|
-
return (value) => {
|
|
367
|
-
if (left > 0) {
|
|
368
|
-
left--;
|
|
369
|
-
return {
|
|
370
|
-
done: false,
|
|
371
|
-
hasNext: false
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
return {
|
|
375
|
-
done: false,
|
|
376
|
-
hasNext: true,
|
|
377
|
-
next: value
|
|
378
|
-
};
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
drop2.lazy = lazy;
|
|
382
|
-
})(drop || (drop = {}));
|
|
383
|
-
|
|
384
|
-
// src/array/has-at-least.ts
|
|
385
|
-
function hasAtLeast(...args) {
|
|
386
|
-
return purry(hasAtLeastImplementation, args);
|
|
387
|
-
}
|
|
388
|
-
function hasAtLeastImplementation(data, minimum) {
|
|
389
|
-
return data.length >= minimum;
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
// src/utils/swap-in-place.ts
|
|
393
|
-
function swapInPlace(data, i, j) {
|
|
394
|
-
[data[i], data[j]] = [data[j], data[i]];
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
// src/utils/heap.ts
|
|
398
|
-
function heapify(heap, compareFn) {
|
|
399
|
-
for (let i = Math.floor(heap.length / 2) - 1; i >= 0; i--) {
|
|
400
|
-
heapSiftDown(heap, i, compareFn);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
function heapMaybeInsert(heap, compareFn, item) {
|
|
404
|
-
if (!hasAtLeast(heap, 1)) {
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
const head = heap[0];
|
|
408
|
-
if (compareFn(item, head) >= 0) {
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
heap[0] = item;
|
|
412
|
-
heapSiftDown(heap, 0, compareFn);
|
|
413
|
-
return head;
|
|
414
|
-
}
|
|
415
|
-
function heapSiftDown(heap, index, compareFn) {
|
|
416
|
-
let currentIndex = index;
|
|
417
|
-
while (currentIndex * 2 + 1 < heap.length) {
|
|
418
|
-
const firstChildIndex = currentIndex * 2 + 1;
|
|
419
|
-
let swapIndex = compareFn(heap[currentIndex], heap[firstChildIndex]) < 0 ? firstChildIndex : currentIndex;
|
|
420
|
-
const secondChildIndex = firstChildIndex + 1;
|
|
421
|
-
if (secondChildIndex < heap.length && compareFn(heap[swapIndex], heap[secondChildIndex]) < 0) {
|
|
422
|
-
swapIndex = secondChildIndex;
|
|
423
|
-
}
|
|
424
|
-
if (swapIndex === currentIndex) {
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
swapInPlace(heap, currentIndex, swapIndex);
|
|
428
|
-
currentIndex = swapIndex;
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
// src/utils/purry-order-rules.ts
|
|
433
|
-
var COMPARATORS = {
|
|
434
|
-
asc: (x, y) => x > y,
|
|
435
|
-
desc: (x, y) => x < y
|
|
436
|
-
};
|
|
437
|
-
function purryOrderRules(func, inputArgs) {
|
|
438
|
-
const [dataOrRule, ...rules] = Array.isArray(inputArgs) ? inputArgs : Array.from(inputArgs);
|
|
439
|
-
if (!isOrderRule(dataOrRule)) {
|
|
440
|
-
const compareFn2 = orderRuleComparer(...rules);
|
|
441
|
-
return func(dataOrRule, compareFn2);
|
|
442
|
-
}
|
|
443
|
-
const compareFn = orderRuleComparer(dataOrRule, ...rules);
|
|
444
|
-
return (data) => func(data, compareFn);
|
|
445
|
-
}
|
|
446
|
-
function purryOrderRulesWithArgument(func, inputArgs) {
|
|
447
|
-
const [first2, second, ...rest] = Array.from(inputArgs);
|
|
448
|
-
let arg;
|
|
449
|
-
let argRemoved;
|
|
450
|
-
if (isOrderRule(second)) {
|
|
451
|
-
arg = first2;
|
|
452
|
-
argRemoved = [second, ...rest];
|
|
453
|
-
} else {
|
|
454
|
-
arg = second;
|
|
455
|
-
argRemoved = [first2, ...rest];
|
|
456
|
-
}
|
|
457
|
-
return purryOrderRules((...args) => func(...args, arg), argRemoved);
|
|
458
|
-
}
|
|
459
|
-
function orderRuleComparer(primaryRule, secondaryRule, ...otherRules) {
|
|
460
|
-
const projector = typeof primaryRule === "function" ? primaryRule : primaryRule[0];
|
|
461
|
-
const direction = typeof primaryRule === "function" ? "asc" : primaryRule[1];
|
|
462
|
-
const comparator = COMPARATORS[direction];
|
|
463
|
-
const nextComparer = secondaryRule === void 0 ? void 0 : orderRuleComparer(secondaryRule, ...otherRules);
|
|
464
|
-
return (a, b) => {
|
|
465
|
-
const projectedA = projector(a);
|
|
466
|
-
const projectedB = projector(b);
|
|
467
|
-
if (comparator(projectedA, projectedB)) {
|
|
468
|
-
return 1;
|
|
469
|
-
}
|
|
470
|
-
if (comparator(projectedB, projectedA)) {
|
|
471
|
-
return -1;
|
|
472
|
-
}
|
|
473
|
-
return nextComparer?.(a, b) ?? 0;
|
|
474
|
-
};
|
|
475
|
-
}
|
|
476
|
-
function isOrderRule(x) {
|
|
477
|
-
if (isProjection(x)) {
|
|
478
|
-
return true;
|
|
479
|
-
}
|
|
480
|
-
if (typeof x !== "object" || !Array.isArray(x)) {
|
|
481
|
-
return false;
|
|
482
|
-
}
|
|
483
|
-
const [maybeProjection, maybeDirection, ...rest] = x;
|
|
484
|
-
return isProjection(maybeProjection) && maybeDirection in COMPARATORS && rest.length === 0;
|
|
485
|
-
}
|
|
486
|
-
function isProjection(x) {
|
|
487
|
-
return typeof x === "function" && x.length === 1;
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
// src/array/drop-first-by.ts
|
|
491
|
-
function dropFirstBy(...args) {
|
|
492
|
-
return purryOrderRulesWithArgument(dropFirstByImplementation, args);
|
|
493
|
-
}
|
|
494
|
-
function dropFirstByImplementation(data, compareFn, n) {
|
|
495
|
-
if (n >= data.length) {
|
|
496
|
-
return [];
|
|
497
|
-
}
|
|
498
|
-
if (n <= 0) {
|
|
499
|
-
return [...data];
|
|
500
|
-
}
|
|
501
|
-
const heap = data.slice(0, n);
|
|
502
|
-
heapify(heap, compareFn);
|
|
503
|
-
const out = [];
|
|
504
|
-
const rest = data.slice(n);
|
|
505
|
-
for (const item of rest) {
|
|
506
|
-
const previousHead = heapMaybeInsert(heap, compareFn, item);
|
|
507
|
-
out.push(previousHead ?? item);
|
|
508
|
-
}
|
|
509
|
-
return out;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
// src/array/drop-last-while.ts
|
|
513
|
-
function dropLastWhile(...args) {
|
|
514
|
-
return purry(_dropLastWhile, args);
|
|
515
|
-
}
|
|
516
|
-
function _dropLastWhile(data, predicate) {
|
|
517
|
-
for (let i = data.length - 1; i >= 0; i--) {
|
|
518
|
-
if (!predicate(data[i])) {
|
|
519
|
-
return data.slice(0, i + 1);
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
return [];
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
// src/array/drop-while.ts
|
|
526
|
-
function dropWhile(...args) {
|
|
527
|
-
return purry(_dropWhile, args);
|
|
528
|
-
}
|
|
529
|
-
function _dropWhile(data, predicate) {
|
|
530
|
-
for (let i = 0; i < data.length; i++) {
|
|
531
|
-
if (!predicate(data[i])) {
|
|
532
|
-
return data.slice(i);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
return [];
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
// src/utils/to-lazy-indexed.ts
|
|
539
|
-
function toLazyIndexed(fn) {
|
|
540
|
-
return Object.assign(fn, { indexed: true });
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
// src/array/filter.ts
|
|
544
|
-
function filter(...args) {
|
|
545
|
-
return purry(filter_(false), args, filter.lazy);
|
|
546
|
-
}
|
|
547
|
-
function filter_(indexed) {
|
|
548
|
-
return (array, fn) => {
|
|
549
|
-
return reduceLazy(
|
|
550
|
-
array,
|
|
551
|
-
indexed ? filter.lazyIndexed(fn) : filter.lazy(fn),
|
|
552
|
-
indexed
|
|
553
|
-
);
|
|
554
|
-
};
|
|
555
|
-
}
|
|
556
|
-
function lazy_(indexed) {
|
|
557
|
-
return (fn) => {
|
|
558
|
-
return (value, index, array) => {
|
|
559
|
-
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
560
|
-
if (valid) {
|
|
561
|
-
return {
|
|
562
|
-
done: false,
|
|
563
|
-
hasNext: true,
|
|
564
|
-
next: value
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
return {
|
|
568
|
-
done: false,
|
|
569
|
-
hasNext: false
|
|
570
|
-
};
|
|
571
|
-
};
|
|
572
|
-
};
|
|
573
|
-
}
|
|
574
|
-
((filter2) => {
|
|
575
|
-
function indexed(...args) {
|
|
576
|
-
return purry(filter_(true), args, filter2.lazyIndexed);
|
|
577
|
-
}
|
|
578
|
-
filter2.indexed = indexed;
|
|
579
|
-
filter2.lazy = lazy_(false);
|
|
580
|
-
filter2.lazyIndexed = toLazyIndexed(lazy_(true));
|
|
581
|
-
})(filter || (filter = {}));
|
|
582
|
-
|
|
583
|
-
// src/utils/to-single.ts
|
|
584
|
-
function toSingle(fn) {
|
|
585
|
-
fn.single = true;
|
|
586
|
-
return fn;
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
// src/array/find-index.ts
|
|
590
|
-
function findIndex(...args) {
|
|
591
|
-
return purry(_findIndex(false), args, findIndex.lazy);
|
|
592
|
-
}
|
|
593
|
-
function _findIndex(indexed) {
|
|
594
|
-
return (array, fn) => {
|
|
595
|
-
if (indexed) {
|
|
596
|
-
return array.findIndex(fn);
|
|
597
|
-
}
|
|
598
|
-
return array.findIndex((x) => fn(x));
|
|
599
|
-
};
|
|
600
|
-
}
|
|
601
|
-
function _lazy(indexed) {
|
|
602
|
-
return (fn) => {
|
|
603
|
-
let i = 0;
|
|
604
|
-
return (value, index, array) => {
|
|
605
|
-
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
606
|
-
if (valid) {
|
|
607
|
-
return {
|
|
608
|
-
done: true,
|
|
609
|
-
hasNext: true,
|
|
610
|
-
next: i
|
|
611
|
-
};
|
|
612
|
-
}
|
|
613
|
-
i++;
|
|
614
|
-
return {
|
|
615
|
-
done: false,
|
|
616
|
-
hasNext: false
|
|
617
|
-
};
|
|
618
|
-
};
|
|
619
|
-
};
|
|
620
|
-
}
|
|
621
|
-
((findIndex2) => {
|
|
622
|
-
function indexed(...args) {
|
|
623
|
-
return purry(_findIndex(true), args, findIndex2.lazyIndexed);
|
|
624
|
-
}
|
|
625
|
-
findIndex2.indexed = indexed;
|
|
626
|
-
findIndex2.lazy = toSingle(_lazy(false));
|
|
627
|
-
findIndex2.lazyIndexed = toSingle(toLazyIndexed(_lazy(true)));
|
|
628
|
-
})(findIndex || (findIndex = {}));
|
|
629
|
-
|
|
630
|
-
// src/array/find-last-index.ts
|
|
631
|
-
function findLastIndex(...args) {
|
|
632
|
-
return purry(_findLastIndex(false), args);
|
|
633
|
-
}
|
|
634
|
-
function _findLastIndex(indexed) {
|
|
635
|
-
return (array, fn) => {
|
|
636
|
-
for (let i = array.length - 1; i >= 0; i--) {
|
|
637
|
-
if (indexed ? fn(array[i], i, array) : fn(array[i])) {
|
|
638
|
-
return i;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
return -1;
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
|
-
((findLastIndex2) => {
|
|
645
|
-
function indexed(...args) {
|
|
646
|
-
return purry(_findLastIndex(true), args);
|
|
647
|
-
}
|
|
648
|
-
findLastIndex2.indexed = indexed;
|
|
649
|
-
})(findLastIndex || (findLastIndex = {}));
|
|
650
|
-
|
|
651
|
-
// src/array/find-last.ts
|
|
652
|
-
function findLast(...args) {
|
|
653
|
-
return purry(_findLast(false), args);
|
|
654
|
-
}
|
|
655
|
-
function _findLast(indexed) {
|
|
656
|
-
return (array, fn) => {
|
|
657
|
-
for (let i = array.length - 1; i >= 0; i--) {
|
|
658
|
-
if (indexed ? fn(array[i], i, array) : fn(array[i])) {
|
|
659
|
-
return array[i];
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
return void 0;
|
|
663
|
-
};
|
|
664
|
-
}
|
|
665
|
-
((findLast2) => {
|
|
666
|
-
function indexed(...args) {
|
|
667
|
-
return purry(_findLast(true), args);
|
|
668
|
-
}
|
|
669
|
-
findLast2.indexed = indexed;
|
|
670
|
-
})(findLast || (findLast = {}));
|
|
671
|
-
|
|
672
|
-
// src/array/find.ts
|
|
673
|
-
function find(...args) {
|
|
674
|
-
return purry(_find(false), args, find.lazy);
|
|
675
|
-
}
|
|
676
|
-
function _find(indexed) {
|
|
677
|
-
return (array, fn) => {
|
|
678
|
-
if (indexed) {
|
|
679
|
-
return array.find(fn);
|
|
680
|
-
}
|
|
681
|
-
return array.find((x) => fn(x));
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
function _lazy2(indexed) {
|
|
685
|
-
return (fn) => {
|
|
686
|
-
return (value, index, array) => {
|
|
687
|
-
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
688
|
-
return {
|
|
689
|
-
done: valid,
|
|
690
|
-
hasNext: valid,
|
|
691
|
-
next: value
|
|
692
|
-
};
|
|
693
|
-
};
|
|
694
|
-
};
|
|
695
|
-
}
|
|
696
|
-
((find2) => {
|
|
697
|
-
function indexed(...args) {
|
|
698
|
-
return purry(_find(true), args, find2.lazyIndexed);
|
|
699
|
-
}
|
|
700
|
-
find2.indexed = indexed;
|
|
701
|
-
find2.lazy = toSingle(_lazy2(false));
|
|
702
|
-
find2.lazyIndexed = toSingle(toLazyIndexed(_lazy2(true)));
|
|
703
|
-
})(find || (find = {}));
|
|
704
|
-
|
|
705
|
-
// src/array/first.ts
|
|
706
|
-
function first(...args) {
|
|
707
|
-
return purry(_first, args, first.lazy);
|
|
708
|
-
}
|
|
709
|
-
function _first([first2]) {
|
|
710
|
-
return first2;
|
|
711
|
-
}
|
|
712
|
-
((first2) => {
|
|
713
|
-
function lazy() {
|
|
714
|
-
return (value) => {
|
|
715
|
-
return {
|
|
716
|
-
done: true,
|
|
717
|
-
hasNext: true,
|
|
718
|
-
next: value
|
|
719
|
-
};
|
|
720
|
-
};
|
|
721
|
-
}
|
|
722
|
-
first2.lazy = lazy;
|
|
723
|
-
((lazy2) => {
|
|
724
|
-
lazy2.single = true;
|
|
725
|
-
})(lazy = first2.lazy || (first2.lazy = {}));
|
|
726
|
-
})(first || (first = {}));
|
|
727
|
-
|
|
728
|
-
// src/array/first-by.ts
|
|
729
|
-
function firstBy(...args) {
|
|
730
|
-
return purryOrderRules(firstByImplementation, args);
|
|
731
|
-
}
|
|
732
|
-
function firstByImplementation(data, compareFn) {
|
|
733
|
-
if (!hasAtLeast(data, 2)) {
|
|
734
|
-
return data[0];
|
|
735
|
-
}
|
|
736
|
-
let [currentFirst] = data;
|
|
737
|
-
const [, ...rest] = data;
|
|
738
|
-
for (const item of rest) {
|
|
739
|
-
if (compareFn(item, currentFirst) < 0) {
|
|
740
|
-
currentFirst = item;
|
|
741
|
-
}
|
|
742
|
-
}
|
|
743
|
-
return currentFirst;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
// src/array/flat-map-to-obj.ts
|
|
747
|
-
function flatMapToObj(...args) {
|
|
748
|
-
return purry(_flatMapToObj(false), args);
|
|
749
|
-
}
|
|
750
|
-
function _flatMapToObj(indexed) {
|
|
751
|
-
return (array, fn) => {
|
|
752
|
-
return array.reduce((result, element, index) => {
|
|
753
|
-
const items = indexed ? fn(element, index, array) : fn(element);
|
|
754
|
-
items.forEach(([key, value]) => {
|
|
755
|
-
result[key] = value;
|
|
756
|
-
});
|
|
757
|
-
return result;
|
|
758
|
-
}, {});
|
|
759
|
-
};
|
|
760
|
-
}
|
|
761
|
-
((flatMapToObj2) => {
|
|
762
|
-
function indexed(...args) {
|
|
763
|
-
return purry(_flatMapToObj(true), args);
|
|
764
|
-
}
|
|
765
|
-
flatMapToObj2.indexed = indexed;
|
|
766
|
-
})(flatMapToObj || (flatMapToObj = {}));
|
|
767
|
-
|
|
768
|
-
// src/array/flatten.ts
|
|
769
|
-
function flatten(...args) {
|
|
770
|
-
return purry(_flatten, args, flatten.lazy);
|
|
771
|
-
}
|
|
772
|
-
function _flatten(items) {
|
|
773
|
-
return reduceLazy(items, flatten.lazy());
|
|
774
|
-
}
|
|
775
|
-
((flatten2) => {
|
|
776
|
-
function lazy() {
|
|
777
|
-
return (next) => {
|
|
778
|
-
if (Array.isArray(next)) {
|
|
779
|
-
return {
|
|
780
|
-
done: false,
|
|
781
|
-
hasMany: true,
|
|
782
|
-
hasNext: true,
|
|
783
|
-
next
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
|
-
return {
|
|
787
|
-
done: false,
|
|
788
|
-
hasNext: true,
|
|
789
|
-
next
|
|
790
|
-
};
|
|
791
|
-
};
|
|
792
|
-
}
|
|
793
|
-
flatten2.lazy = lazy;
|
|
794
|
-
})(flatten || (flatten = {}));
|
|
795
|
-
|
|
796
|
-
// src/array/flat-map.ts
|
|
797
|
-
function flatMap(...args) {
|
|
798
|
-
return purry(_flatMap, args, flatMap.lazy);
|
|
799
|
-
}
|
|
800
|
-
function _flatMap(array, fn) {
|
|
801
|
-
return flatten(array.map((item) => fn(item)));
|
|
802
|
-
}
|
|
803
|
-
((flatMap2) => {
|
|
804
|
-
function lazy(fn) {
|
|
805
|
-
return (value) => {
|
|
806
|
-
const next = fn(value);
|
|
807
|
-
if (Array.isArray(next)) {
|
|
808
|
-
return {
|
|
809
|
-
done: false,
|
|
810
|
-
hasMany: true,
|
|
811
|
-
hasNext: true,
|
|
812
|
-
next
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
return {
|
|
816
|
-
done: false,
|
|
817
|
-
hasNext: true,
|
|
818
|
-
next
|
|
819
|
-
};
|
|
820
|
-
};
|
|
821
|
-
}
|
|
822
|
-
flatMap2.lazy = lazy;
|
|
823
|
-
})(flatMap || (flatMap = {}));
|
|
824
|
-
|
|
825
|
-
// src/array/flatten-deep.ts
|
|
826
|
-
function flattenDeep(...args) {
|
|
827
|
-
return purry(_flattenDeep, args, flattenDeep.lazy);
|
|
828
|
-
}
|
|
829
|
-
function _flattenDeep(items) {
|
|
830
|
-
return reduceLazy(items, flattenDeep.lazy());
|
|
831
|
-
}
|
|
832
|
-
function _flattenDeepValue(value) {
|
|
833
|
-
if (!Array.isArray(value)) {
|
|
834
|
-
return value;
|
|
835
|
-
}
|
|
836
|
-
const ret = [];
|
|
837
|
-
value.forEach((item) => {
|
|
838
|
-
if (Array.isArray(item)) {
|
|
839
|
-
ret.push(...flattenDeep(item));
|
|
840
|
-
} else {
|
|
841
|
-
ret.push(item);
|
|
842
|
-
}
|
|
843
|
-
});
|
|
844
|
-
return ret;
|
|
845
|
-
}
|
|
846
|
-
((flattenDeep2) => {
|
|
847
|
-
function lazy() {
|
|
848
|
-
return (value) => {
|
|
849
|
-
const next = _flattenDeepValue(value);
|
|
850
|
-
if (Array.isArray(next)) {
|
|
851
|
-
return {
|
|
852
|
-
done: false,
|
|
853
|
-
hasMany: true,
|
|
854
|
-
hasNext: true,
|
|
855
|
-
next
|
|
856
|
-
};
|
|
857
|
-
}
|
|
858
|
-
return {
|
|
859
|
-
done: false,
|
|
860
|
-
hasNext: true,
|
|
861
|
-
next
|
|
862
|
-
};
|
|
863
|
-
};
|
|
864
|
-
}
|
|
865
|
-
flattenDeep2.lazy = lazy;
|
|
866
|
-
})(flattenDeep || (flattenDeep = {}));
|
|
867
|
-
|
|
868
|
-
// src/array/for-each.ts
|
|
869
|
-
function forEach(...args) {
|
|
870
|
-
return purry(_forEach(false), args, forEach.lazy);
|
|
871
|
-
}
|
|
872
|
-
function _forEach(indexed) {
|
|
873
|
-
return (array, fn) => {
|
|
874
|
-
return reduceLazy(
|
|
875
|
-
array,
|
|
876
|
-
indexed ? forEach.lazyIndexed(fn) : forEach.lazy(fn),
|
|
877
|
-
indexed
|
|
878
|
-
);
|
|
879
|
-
};
|
|
880
|
-
}
|
|
881
|
-
function _lazy3(indexed) {
|
|
882
|
-
return (fn) => {
|
|
883
|
-
return (value, index, array) => {
|
|
884
|
-
if (indexed) {
|
|
885
|
-
fn(value, index, array);
|
|
886
|
-
} else {
|
|
887
|
-
fn(value);
|
|
888
|
-
}
|
|
889
|
-
return {
|
|
890
|
-
done: false,
|
|
891
|
-
hasNext: true,
|
|
892
|
-
next: value
|
|
893
|
-
};
|
|
894
|
-
};
|
|
895
|
-
};
|
|
896
|
-
}
|
|
897
|
-
((forEach2) => {
|
|
898
|
-
function indexed(...args) {
|
|
899
|
-
return purry(_forEach(true), args, forEach2.lazyIndexed);
|
|
900
|
-
}
|
|
901
|
-
forEach2.indexed = indexed;
|
|
902
|
-
forEach2.lazy = _lazy3(false);
|
|
903
|
-
forEach2.lazyIndexed = toLazyIndexed(_lazy3(true));
|
|
904
|
-
})(forEach || (forEach = {}));
|
|
905
|
-
|
|
906
|
-
// src/array/group-by.ts
|
|
907
|
-
function groupBy(...args) {
|
|
908
|
-
return purry(_groupBy(false), args);
|
|
909
|
-
}
|
|
910
|
-
function _groupBy(indexed) {
|
|
911
|
-
return (array, fn) => {
|
|
912
|
-
const ret = {};
|
|
913
|
-
array.forEach((item, index) => {
|
|
914
|
-
const key = indexed ? fn(item, index, array) : fn(item);
|
|
915
|
-
if (key !== void 0) {
|
|
916
|
-
const actualKey = String(key);
|
|
917
|
-
let items = ret[actualKey];
|
|
918
|
-
if (items === void 0) {
|
|
919
|
-
items = [];
|
|
920
|
-
ret[actualKey] = items;
|
|
921
|
-
}
|
|
922
|
-
items.push(item);
|
|
923
|
-
}
|
|
924
|
-
});
|
|
925
|
-
return ret;
|
|
926
|
-
};
|
|
927
|
-
}
|
|
928
|
-
((groupBy2) => {
|
|
929
|
-
function indexed(...args) {
|
|
930
|
-
return purry(_groupBy(true), args);
|
|
931
|
-
}
|
|
932
|
-
groupBy2.indexed = indexed;
|
|
933
|
-
groupBy2.strict = groupBy2;
|
|
934
|
-
})(groupBy || (groupBy = {}));
|
|
935
|
-
|
|
936
|
-
// src/array/index-by.ts
|
|
937
|
-
function indexBy(...args) {
|
|
938
|
-
return purry(_indexBy(false), args);
|
|
939
|
-
}
|
|
940
|
-
function _indexBy(indexed) {
|
|
941
|
-
return (array, fn) => {
|
|
942
|
-
return array.reduce((ret, item, index) => {
|
|
943
|
-
const value = indexed ? fn(item, index, array) : fn(item);
|
|
944
|
-
const key = String(value);
|
|
945
|
-
ret[key] = item;
|
|
946
|
-
return ret;
|
|
947
|
-
}, {});
|
|
948
|
-
};
|
|
949
|
-
}
|
|
950
|
-
((indexBy2) => {
|
|
951
|
-
function indexed(...args) {
|
|
952
|
-
return purry(_indexBy(true), args);
|
|
953
|
-
}
|
|
954
|
-
indexBy2.indexed = indexed;
|
|
955
|
-
})(indexBy || (indexBy = {}));
|
|
956
|
-
|
|
957
|
-
// src/array/intersection.ts
|
|
958
|
-
function intersection(...args) {
|
|
959
|
-
return purry(_intersection, args, intersection.lazy);
|
|
960
|
-
}
|
|
961
|
-
function _intersection(array, other) {
|
|
962
|
-
const lazy = intersection.lazy(other);
|
|
963
|
-
return reduceLazy(array, lazy);
|
|
964
|
-
}
|
|
965
|
-
((intersection2) => {
|
|
966
|
-
function lazy(other) {
|
|
967
|
-
return (value) => {
|
|
968
|
-
const set2 = new Set(other);
|
|
969
|
-
if (set2.has(value)) {
|
|
970
|
-
return {
|
|
971
|
-
done: false,
|
|
972
|
-
hasNext: true,
|
|
973
|
-
next: value
|
|
974
|
-
};
|
|
975
|
-
}
|
|
976
|
-
return {
|
|
977
|
-
done: false,
|
|
978
|
-
hasNext: false
|
|
979
|
-
};
|
|
980
|
-
};
|
|
981
|
-
}
|
|
982
|
-
intersection2.lazy = lazy;
|
|
983
|
-
})(intersection || (intersection = {}));
|
|
984
|
-
|
|
985
|
-
// src/array/intersection-with.ts
|
|
986
|
-
function intersectionWith(...args) {
|
|
987
|
-
return purry(_intersectionWith, args, intersectionWith.lazy);
|
|
988
|
-
}
|
|
989
|
-
function _intersectionWith(array, other, comparator) {
|
|
990
|
-
const lazy = intersectionWith.lazy(other, comparator);
|
|
991
|
-
return reduceLazy(array, lazy);
|
|
992
|
-
}
|
|
993
|
-
((intersectionWith2) => {
|
|
994
|
-
function lazy(other, comparator) {
|
|
995
|
-
return (value) => {
|
|
996
|
-
if (other.some((otherValue) => comparator(value, otherValue))) {
|
|
997
|
-
return {
|
|
998
|
-
done: false,
|
|
999
|
-
hasNext: true,
|
|
1000
|
-
next: value
|
|
1001
|
-
};
|
|
1002
|
-
}
|
|
1003
|
-
return {
|
|
1004
|
-
done: false,
|
|
1005
|
-
hasNext: false
|
|
1006
|
-
};
|
|
1007
|
-
};
|
|
1008
|
-
}
|
|
1009
|
-
intersectionWith2.lazy = lazy;
|
|
1010
|
-
})(intersectionWith || (intersectionWith = {}));
|
|
1011
|
-
|
|
1012
|
-
// src/array/join.ts
|
|
1013
|
-
function join(...args) {
|
|
1014
|
-
return purry(joinImplementation, args);
|
|
1015
|
-
}
|
|
1016
|
-
function joinImplementation(data, glue) {
|
|
1017
|
-
return data.join(glue);
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
// src/array/last.ts
|
|
1021
|
-
function last(...args) {
|
|
1022
|
-
return purry(_last, args);
|
|
1023
|
-
}
|
|
1024
|
-
function _last(array) {
|
|
1025
|
-
return array[array.length - 1];
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
|
-
// src/array/length.ts
|
|
1029
|
-
function length(...args) {
|
|
1030
|
-
return purry(_length, args);
|
|
1031
|
-
}
|
|
1032
|
-
function _length(items) {
|
|
1033
|
-
return "length" in items ? items.length : Array.from(items).length;
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
// src/array/map.ts
|
|
1037
|
-
function map(...args) {
|
|
1038
|
-
return purry(_map(false), args, map.lazy);
|
|
1039
|
-
}
|
|
1040
|
-
function _map(indexed) {
|
|
1041
|
-
return (array, fn) => {
|
|
1042
|
-
return reduceLazy(
|
|
1043
|
-
array,
|
|
1044
|
-
indexed ? map.lazyIndexed(fn) : map.lazy(fn),
|
|
1045
|
-
indexed
|
|
1046
|
-
);
|
|
1047
|
-
};
|
|
1048
|
-
}
|
|
1049
|
-
function _lazy4(indexed) {
|
|
1050
|
-
return (fn) => {
|
|
1051
|
-
return (value, index, array) => {
|
|
1052
|
-
return {
|
|
1053
|
-
done: false,
|
|
1054
|
-
hasNext: true,
|
|
1055
|
-
next: indexed ? fn(value, index, array) : fn(value)
|
|
1056
|
-
};
|
|
1057
|
-
};
|
|
1058
|
-
};
|
|
1059
|
-
}
|
|
1060
|
-
((map2) => {
|
|
1061
|
-
function indexed(...args) {
|
|
1062
|
-
return purry(_map(true), args, map2.lazyIndexed);
|
|
1063
|
-
}
|
|
1064
|
-
map2.indexed = indexed;
|
|
1065
|
-
map2.lazy = _lazy4(false);
|
|
1066
|
-
map2.lazyIndexed = toLazyIndexed(_lazy4(true));
|
|
1067
|
-
map2.strict = map2;
|
|
1068
|
-
})(map || (map = {}));
|
|
1069
|
-
|
|
1070
|
-
// src/array/map-to-obj.ts
|
|
1071
|
-
function mapToObj(...args) {
|
|
1072
|
-
return purry(_mapToObj(false), args);
|
|
1073
|
-
}
|
|
1074
|
-
function _mapToObj(indexed) {
|
|
1075
|
-
return (array, fn) => {
|
|
1076
|
-
return array.reduce(
|
|
1077
|
-
(result, element, index) => {
|
|
1078
|
-
const [key, value] = indexed ? fn(element, index, array) : fn(element);
|
|
1079
|
-
result[key] = value;
|
|
1080
|
-
return result;
|
|
1081
|
-
},
|
|
1082
|
-
{}
|
|
1083
|
-
);
|
|
1084
|
-
};
|
|
1085
|
-
}
|
|
1086
|
-
((mapToObj2) => {
|
|
1087
|
-
function indexed(...args) {
|
|
1088
|
-
return purry(_mapToObj(true), args);
|
|
1089
|
-
}
|
|
1090
|
-
mapToObj2.indexed = indexed;
|
|
1091
|
-
})(mapToObj || (mapToObj = {}));
|
|
1092
|
-
|
|
1093
|
-
// src/array/max-by.ts
|
|
1094
|
-
function _maxBy(indexed) {
|
|
1095
|
-
return (array, fn) => {
|
|
1096
|
-
let ret;
|
|
1097
|
-
let retMax;
|
|
1098
|
-
array.forEach((item, i) => {
|
|
1099
|
-
const max = indexed ? fn(item, i, array) : fn(item);
|
|
1100
|
-
if (retMax === void 0 || max > retMax) {
|
|
1101
|
-
ret = item;
|
|
1102
|
-
retMax = max;
|
|
1103
|
-
}
|
|
1104
|
-
});
|
|
1105
|
-
return ret;
|
|
1106
|
-
};
|
|
1107
|
-
}
|
|
1108
|
-
function maxBy(...args) {
|
|
1109
|
-
return purry(_maxBy(false), args);
|
|
1110
|
-
}
|
|
1111
|
-
((maxBy2) => {
|
|
1112
|
-
function indexed(...args) {
|
|
1113
|
-
return purry(_maxBy(true), args);
|
|
1114
|
-
}
|
|
1115
|
-
maxBy2.indexed = indexed;
|
|
1116
|
-
})(maxBy || (maxBy = {}));
|
|
1117
|
-
|
|
1118
|
-
// src/array/mean-by.ts
|
|
1119
|
-
function _meanBy(indexed) {
|
|
1120
|
-
return (array, fn) => {
|
|
1121
|
-
if (array.length === 0) {
|
|
1122
|
-
return Number.NaN;
|
|
1123
|
-
}
|
|
1124
|
-
let sum = 0;
|
|
1125
|
-
array.forEach((item, i) => {
|
|
1126
|
-
sum += indexed ? fn(item, i, array) : fn(item);
|
|
1127
|
-
});
|
|
1128
|
-
return sum / array.length;
|
|
1129
|
-
};
|
|
1130
|
-
}
|
|
1131
|
-
function meanBy(...args) {
|
|
1132
|
-
return purry(_meanBy(false), args);
|
|
1133
|
-
}
|
|
1134
|
-
((meanBy2) => {
|
|
1135
|
-
function indexed(...args) {
|
|
1136
|
-
return purry(_meanBy(true), args);
|
|
1137
|
-
}
|
|
1138
|
-
meanBy2.indexed = indexed;
|
|
1139
|
-
})(meanBy || (meanBy = {}));
|
|
1140
|
-
|
|
1141
|
-
// src/array/merge-all.ts
|
|
1142
|
-
function mergeAll(items) {
|
|
1143
|
-
return items.reduce((acc, x) => ({ ...acc, ...x }), {});
|
|
1144
|
-
}
|
|
1145
|
-
|
|
1146
|
-
// src/array/min-by.ts
|
|
1147
|
-
function _minBy(indexed) {
|
|
1148
|
-
return (array, fn) => {
|
|
1149
|
-
let ret;
|
|
1150
|
-
let retMin;
|
|
1151
|
-
array.forEach((item, i) => {
|
|
1152
|
-
const min = indexed ? fn(item, i, array) : fn(item);
|
|
1153
|
-
if (retMin === void 0 || min < retMin) {
|
|
1154
|
-
ret = item;
|
|
1155
|
-
retMin = min;
|
|
1156
|
-
}
|
|
1157
|
-
});
|
|
1158
|
-
return ret;
|
|
1159
|
-
};
|
|
1160
|
-
}
|
|
1161
|
-
function minBy(...args) {
|
|
1162
|
-
return purry(_minBy(false), args);
|
|
1163
|
-
}
|
|
1164
|
-
((minBy2) => {
|
|
1165
|
-
function indexed(...args) {
|
|
1166
|
-
return purry(_minBy(true), args);
|
|
1167
|
-
}
|
|
1168
|
-
minBy2.indexed = indexed;
|
|
1169
|
-
})(minBy || (minBy = {}));
|
|
1170
|
-
|
|
1171
|
-
// src/utils/quick-select.ts
|
|
1172
|
-
function quickSelect(data, index, compareFn) {
|
|
1173
|
-
return index < 0 || index >= data.length ? void 0 : quickSelectImplementation(
|
|
1174
|
-
// We need to clone the array because quickSelect mutates it in-place.
|
|
1175
|
-
[...data],
|
|
1176
|
-
0,
|
|
1177
|
-
data.length - 1,
|
|
1178
|
-
index,
|
|
1179
|
-
compareFn
|
|
1180
|
-
);
|
|
1181
|
-
}
|
|
1182
|
-
function quickSelectImplementation(data, left, right, index, compareFn) {
|
|
1183
|
-
if (left === right) {
|
|
1184
|
-
return data[left];
|
|
1185
|
-
}
|
|
1186
|
-
const pivotIndex = partition(data, left, right, compareFn);
|
|
1187
|
-
return index === pivotIndex ? data[index] : quickSelectImplementation(
|
|
1188
|
-
data,
|
|
1189
|
-
// We continue by recursing into the partition where index would be
|
|
1190
|
-
index < pivotIndex ? left : pivotIndex + 1,
|
|
1191
|
-
index < pivotIndex ? pivotIndex - 1 : right,
|
|
1192
|
-
index,
|
|
1193
|
-
compareFn
|
|
1194
|
-
);
|
|
1195
|
-
}
|
|
1196
|
-
function partition(data, left, right, compareFn) {
|
|
1197
|
-
const pivot = data[right];
|
|
1198
|
-
let i = left;
|
|
1199
|
-
for (let j = left; j < right; j++) {
|
|
1200
|
-
if (compareFn(data[j], pivot) < 0) {
|
|
1201
|
-
swapInPlace(data, i, j);
|
|
1202
|
-
i++;
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
swapInPlace(data, i, right);
|
|
1206
|
-
return i;
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
// src/array/nth-by.ts
|
|
1210
|
-
function nthBy(...args) {
|
|
1211
|
-
return purryOrderRulesWithArgument(nthByImplementation, args);
|
|
1212
|
-
}
|
|
1213
|
-
function nthByImplementation(data, compareFn, index) {
|
|
1214
|
-
return quickSelect(
|
|
1215
|
-
data,
|
|
1216
|
-
// Allow negative indices gracefully
|
|
1217
|
-
index >= 0 ? index : data.length + index,
|
|
1218
|
-
compareFn
|
|
1219
|
-
);
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
// src/array/only.ts
|
|
1223
|
-
function only(...args) {
|
|
1224
|
-
return purry(_only, args);
|
|
1225
|
-
}
|
|
1226
|
-
function _only(array) {
|
|
1227
|
-
if (array.length === 1) {
|
|
1228
|
-
return array[0];
|
|
1229
|
-
}
|
|
1230
|
-
return void 0;
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
// src/array/partition.ts
|
|
1234
|
-
function partition2(...args) {
|
|
1235
|
-
return purry(_partition(false), args);
|
|
1236
|
-
}
|
|
1237
|
-
function _partition(indexed) {
|
|
1238
|
-
return (array, fn) => {
|
|
1239
|
-
const ret = [[], []];
|
|
1240
|
-
array.forEach((item, index) => {
|
|
1241
|
-
const matches = indexed ? fn(item, index, array) : fn(item);
|
|
1242
|
-
ret[matches ? 0 : 1].push(item);
|
|
1243
|
-
});
|
|
1244
|
-
return ret;
|
|
1245
|
-
};
|
|
1246
|
-
}
|
|
1247
|
-
((partition3) => {
|
|
1248
|
-
function indexed(...args) {
|
|
1249
|
-
return purry(_partition(true), args);
|
|
1250
|
-
}
|
|
1251
|
-
partition3.indexed = indexed;
|
|
1252
|
-
})(partition2 || (partition2 = {}));
|
|
1253
|
-
|
|
1254
|
-
// src/array/range.ts
|
|
1255
|
-
function range(...args) {
|
|
1256
|
-
return purry(_range, args);
|
|
1257
|
-
}
|
|
1258
|
-
function _range(start, end) {
|
|
1259
|
-
const ret = [];
|
|
1260
|
-
for (let i = start; i < end; i++) {
|
|
1261
|
-
ret.push(i);
|
|
1262
|
-
}
|
|
1263
|
-
return ret;
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
// src/array/rank-by.ts
|
|
1267
|
-
function rankBy(...args) {
|
|
1268
|
-
return purryOrderRulesWithArgument(rankByImplementation, args);
|
|
1269
|
-
}
|
|
1270
|
-
function rankByImplementation(data, compareFn, targetItem) {
|
|
1271
|
-
let rank = 0;
|
|
1272
|
-
for (const item of data) {
|
|
1273
|
-
if (compareFn(targetItem, item) > 0) {
|
|
1274
|
-
rank++;
|
|
1275
|
-
}
|
|
1276
|
-
}
|
|
1277
|
-
return rank;
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
// src/array/reduce.ts
|
|
1281
|
-
function reduce(...args) {
|
|
1282
|
-
return purry(_reduce(false), args);
|
|
1283
|
-
}
|
|
1284
|
-
function _reduce(indexed) {
|
|
1285
|
-
return (items, fn, initialValue) => {
|
|
1286
|
-
return items.reduce(
|
|
1287
|
-
(acc, item, index) => indexed ? fn(acc, item, index, items) : fn(acc, item),
|
|
1288
|
-
initialValue
|
|
1289
|
-
);
|
|
1290
|
-
};
|
|
1291
|
-
}
|
|
1292
|
-
((reduce2) => {
|
|
1293
|
-
function indexed(...args) {
|
|
1294
|
-
return purry(_reduce(true), args);
|
|
1295
|
-
}
|
|
1296
|
-
reduce2.indexed = indexed;
|
|
1297
|
-
})(reduce || (reduce = {}));
|
|
1298
|
-
|
|
1299
|
-
// src/array/reject.ts
|
|
1300
|
-
function reject(...args) {
|
|
1301
|
-
return purry(_reject(false), args, reject.lazy);
|
|
1302
|
-
}
|
|
1303
|
-
function _reject(indexed) {
|
|
1304
|
-
return (array, fn) => {
|
|
1305
|
-
return reduceLazy(
|
|
1306
|
-
array,
|
|
1307
|
-
indexed ? reject.lazyIndexed(fn) : reject.lazy(fn),
|
|
1308
|
-
indexed
|
|
1309
|
-
);
|
|
1310
|
-
};
|
|
1311
|
-
}
|
|
1312
|
-
function _lazy5(indexed) {
|
|
1313
|
-
return (fn) => {
|
|
1314
|
-
return (value, index, array) => {
|
|
1315
|
-
const valid = indexed ? fn(value, index, array) : fn(value);
|
|
1316
|
-
if (!valid) {
|
|
1317
|
-
return {
|
|
1318
|
-
done: false,
|
|
1319
|
-
hasNext: true,
|
|
1320
|
-
next: value
|
|
1321
|
-
};
|
|
1322
|
-
}
|
|
1323
|
-
return {
|
|
1324
|
-
done: false,
|
|
1325
|
-
hasNext: false
|
|
1326
|
-
};
|
|
1327
|
-
};
|
|
1328
|
-
};
|
|
1329
|
-
}
|
|
1330
|
-
((reject2) => {
|
|
1331
|
-
function indexed(...args) {
|
|
1332
|
-
return purry(_reject(true), args, reject2.lazyIndexed);
|
|
1333
|
-
}
|
|
1334
|
-
reject2.indexed = indexed;
|
|
1335
|
-
reject2.lazy = _lazy5(false);
|
|
1336
|
-
reject2.lazyIndexed = toLazyIndexed(_lazy5(true));
|
|
1337
|
-
})(reject || (reject = {}));
|
|
1338
|
-
|
|
1339
|
-
// src/array/reverse.ts
|
|
1340
|
-
function reverse(...args) {
|
|
1341
|
-
return purry(_reverse, args);
|
|
1342
|
-
}
|
|
1343
|
-
function _reverse(array) {
|
|
1344
|
-
return array.slice().reverse();
|
|
1345
|
-
}
|
|
1346
|
-
|
|
1347
|
-
// src/array/sample.ts
|
|
1348
|
-
function sample(...args) {
|
|
1349
|
-
return purry(sampleImplementation, args);
|
|
1350
|
-
}
|
|
1351
|
-
function sampleImplementation(data, sampleSize) {
|
|
1352
|
-
if (sampleSize < 0) {
|
|
1353
|
-
throw new RangeError(`sampleSize must cannot be negative: ${sampleSize}`);
|
|
1354
|
-
}
|
|
1355
|
-
if (!Number.isInteger(sampleSize)) {
|
|
1356
|
-
throw new TypeError(`sampleSize must be an integer: ${sampleSize}`);
|
|
1357
|
-
}
|
|
1358
|
-
if (sampleSize >= data.length) {
|
|
1359
|
-
return data;
|
|
1360
|
-
}
|
|
1361
|
-
if (sampleSize === 0) {
|
|
1362
|
-
return [];
|
|
1363
|
-
}
|
|
1364
|
-
const actualSampleSize = Math.min(sampleSize, data.length - sampleSize);
|
|
1365
|
-
const sampleIndices = /* @__PURE__ */ new Set();
|
|
1366
|
-
while (sampleIndices.size < actualSampleSize) {
|
|
1367
|
-
const randomIndex = Math.floor(Math.random() * data.length);
|
|
1368
|
-
sampleIndices.add(randomIndex);
|
|
1369
|
-
}
|
|
1370
|
-
if (sampleSize === actualSampleSize) {
|
|
1371
|
-
return Array.from(sampleIndices).sort((a, b) => a - b).map((index) => data[index]);
|
|
1372
|
-
}
|
|
1373
|
-
return data.filter((_, index) => !sampleIndices.has(index));
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
// src/array/shuffle.ts
|
|
1377
|
-
function shuffle(...args) {
|
|
1378
|
-
return purry(_shuffle, args);
|
|
1379
|
-
}
|
|
1380
|
-
function _shuffle(items) {
|
|
1381
|
-
const result = items.slice();
|
|
1382
|
-
for (let index = 0; index < items.length; index += 1) {
|
|
1383
|
-
const rand = index + Math.floor(Math.random() * (items.length - index));
|
|
1384
|
-
const value = result[rand];
|
|
1385
|
-
result[rand] = result[index];
|
|
1386
|
-
result[index] = value;
|
|
1387
|
-
}
|
|
1388
|
-
return result;
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
// src/array/sort.ts
|
|
1392
|
-
function sort(...args) {
|
|
1393
|
-
return purry(_sort, args);
|
|
1394
|
-
}
|
|
1395
|
-
function _sort(items, cmp) {
|
|
1396
|
-
const ret = [...items];
|
|
1397
|
-
ret.sort(cmp);
|
|
1398
|
-
return ret;
|
|
1399
|
-
}
|
|
1400
|
-
((sort2) => {
|
|
1401
|
-
sort2.strict = sort2;
|
|
1402
|
-
})(sort || (sort = {}));
|
|
1403
|
-
|
|
1404
|
-
// src/array/sort-by.ts
|
|
1405
|
-
var ALL_DIRECTIONS = ["asc", "desc"];
|
|
1406
|
-
var COMPARATOR = {
|
|
1407
|
-
asc: (x, y) => x > y,
|
|
1408
|
-
desc: (x, y) => x < y
|
|
1409
|
-
};
|
|
1410
|
-
function sortBy(arrayOrSortRule, ...sortRules) {
|
|
1411
|
-
const args = isSortRule(arrayOrSortRule) ? [[arrayOrSortRule, ...sortRules]] : [arrayOrSortRule, sortRules];
|
|
1412
|
-
return purry(_sortBy, args);
|
|
1413
|
-
}
|
|
1414
|
-
function isSortRule(x) {
|
|
1415
|
-
if (typeof x === "function") {
|
|
1416
|
-
return true;
|
|
1417
|
-
}
|
|
1418
|
-
const [maybeProjection, maybeDirection, ...rest] = x;
|
|
1419
|
-
if (rest.length > 0) {
|
|
1420
|
-
return false;
|
|
1421
|
-
}
|
|
1422
|
-
return typeof maybeProjection === "function" && ALL_DIRECTIONS.includes(maybeDirection);
|
|
1423
|
-
}
|
|
1424
|
-
function _sortBy(array, sorts) {
|
|
1425
|
-
return [...array].sort(comparer(...sorts));
|
|
1426
|
-
}
|
|
1427
|
-
function comparer(primaryRule, secondaryRule, ...otherRules) {
|
|
1428
|
-
const projector = typeof primaryRule === "function" ? primaryRule : primaryRule[0];
|
|
1429
|
-
const direction = typeof primaryRule === "function" ? "asc" : primaryRule[1];
|
|
1430
|
-
const comparator = COMPARATOR[direction];
|
|
1431
|
-
const nextComparer = secondaryRule === void 0 ? void 0 : comparer(secondaryRule, ...otherRules);
|
|
1432
|
-
return (a, b) => {
|
|
1433
|
-
const projectedA = projector(a);
|
|
1434
|
-
const projectedB = projector(b);
|
|
1435
|
-
if (comparator(projectedA, projectedB)) {
|
|
1436
|
-
return 1;
|
|
1437
|
-
}
|
|
1438
|
-
if (comparator(projectedB, projectedA)) {
|
|
1439
|
-
return -1;
|
|
1440
|
-
}
|
|
1441
|
-
return nextComparer?.(a, b) ?? 0;
|
|
1442
|
-
};
|
|
1443
|
-
}
|
|
1444
|
-
((sortBy2) => {
|
|
1445
|
-
sortBy2.strict = sortBy2;
|
|
1446
|
-
})(sortBy || (sortBy = {}));
|
|
1447
|
-
|
|
1448
|
-
// src/array/splice.ts
|
|
1449
|
-
function splice(...args) {
|
|
1450
|
-
return purry(_splice, args);
|
|
1451
|
-
}
|
|
1452
|
-
function _splice(items, start, deleteCount, replacement) {
|
|
1453
|
-
const result = [...items];
|
|
1454
|
-
result.splice(start, deleteCount, ...replacement);
|
|
1455
|
-
return result;
|
|
1456
|
-
}
|
|
1457
|
-
|
|
1458
|
-
// src/array/split-at.ts
|
|
1459
|
-
function splitAt(...args) {
|
|
1460
|
-
return purry(_splitAt, args);
|
|
1461
|
-
}
|
|
1462
|
-
function _splitAt(array, index) {
|
|
1463
|
-
const copy = [...array];
|
|
1464
|
-
const tail = copy.splice(index);
|
|
1465
|
-
return [copy, tail];
|
|
1466
|
-
}
|
|
1467
|
-
|
|
1468
|
-
// src/array/split-when.ts
|
|
1469
|
-
function splitWhen(...args) {
|
|
1470
|
-
return purry(_splitWhen, args);
|
|
1471
|
-
}
|
|
1472
|
-
function _splitWhen(array, fn) {
|
|
1473
|
-
for (let i = 0; i < array.length; i++) {
|
|
1474
|
-
if (fn(array[i])) {
|
|
1475
|
-
return splitAt(array, i);
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
return [array, []];
|
|
1479
|
-
}
|
|
1480
|
-
|
|
1481
|
-
// src/array/sum-by.ts
|
|
1482
|
-
function _sumBy(indexed) {
|
|
1483
|
-
return (array, fn) => {
|
|
1484
|
-
let sum = 0;
|
|
1485
|
-
array.forEach((item, i) => {
|
|
1486
|
-
const summand = indexed ? fn(item, i, array) : fn(item);
|
|
1487
|
-
sum += summand;
|
|
1488
|
-
});
|
|
1489
|
-
return sum;
|
|
1490
|
-
};
|
|
1491
|
-
}
|
|
1492
|
-
function sumBy(...args) {
|
|
1493
|
-
return purry(_sumBy(false), args);
|
|
1494
|
-
}
|
|
1495
|
-
((sumBy2) => {
|
|
1496
|
-
function indexed(...args) {
|
|
1497
|
-
return purry(_sumBy(true), args);
|
|
1498
|
-
}
|
|
1499
|
-
sumBy2.indexed = indexed;
|
|
1500
|
-
})(sumBy || (sumBy = {}));
|
|
1501
|
-
|
|
1502
|
-
// src/array/swap-indices.ts
|
|
1503
|
-
function swapIndices(...args) {
|
|
1504
|
-
return purry(_swapIndices, args);
|
|
1505
|
-
}
|
|
1506
|
-
function _swapIndices(item, index1, index2) {
|
|
1507
|
-
return typeof item === "string" ? _swapString(item, index1, index2) : _swapArray(item, index1, index2);
|
|
1508
|
-
}
|
|
1509
|
-
function _swapArray(item, index1, index2) {
|
|
1510
|
-
const result = item.slice();
|
|
1511
|
-
if (Number.isNaN(index1) || Number.isNaN(index2)) {
|
|
1512
|
-
return result;
|
|
1513
|
-
}
|
|
1514
|
-
const positiveIndexA = index1 < 0 ? item.length + index1 : index1;
|
|
1515
|
-
const positiveIndexB = index2 < 0 ? item.length + index2 : index2;
|
|
1516
|
-
if (positiveIndexA < 0 || positiveIndexA > item.length) {
|
|
1517
|
-
return result;
|
|
1518
|
-
}
|
|
1519
|
-
if (positiveIndexB < 0 || positiveIndexB > item.length) {
|
|
1520
|
-
return result;
|
|
1521
|
-
}
|
|
1522
|
-
result[positiveIndexA] = item[positiveIndexB];
|
|
1523
|
-
result[positiveIndexB] = item[positiveIndexA];
|
|
1524
|
-
return result;
|
|
1525
|
-
}
|
|
1526
|
-
function _swapString(item, index1, index2) {
|
|
1527
|
-
const result = _swapArray(item.split(""), index1, index2);
|
|
1528
|
-
return result.join("");
|
|
1529
|
-
}
|
|
1530
|
-
|
|
1531
|
-
// src/array/take.ts
|
|
1532
|
-
function take(...args) {
|
|
1533
|
-
return purry(_take, args, take.lazy);
|
|
1534
|
-
}
|
|
1535
|
-
function _take(array, n) {
|
|
1536
|
-
return reduceLazy(array, take.lazy(n));
|
|
1537
|
-
}
|
|
1538
|
-
((take2) => {
|
|
1539
|
-
function lazy(n) {
|
|
1540
|
-
return (value) => {
|
|
1541
|
-
if (n === 0) {
|
|
1542
|
-
return {
|
|
1543
|
-
done: true,
|
|
1544
|
-
hasNext: false
|
|
1545
|
-
};
|
|
1546
|
-
}
|
|
1547
|
-
n--;
|
|
1548
|
-
if (n === 0) {
|
|
1549
|
-
return {
|
|
1550
|
-
done: true,
|
|
1551
|
-
hasNext: true,
|
|
1552
|
-
next: value
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1555
|
-
return {
|
|
1556
|
-
done: false,
|
|
1557
|
-
hasNext: true,
|
|
1558
|
-
next: value
|
|
1559
|
-
};
|
|
1560
|
-
};
|
|
1561
|
-
}
|
|
1562
|
-
take2.lazy = lazy;
|
|
1563
|
-
})(take || (take = {}));
|
|
1564
|
-
|
|
1565
|
-
// src/array/take-first-by.ts
|
|
1566
|
-
function takeFirstBy(...args) {
|
|
1567
|
-
return purryOrderRulesWithArgument(takeFirstByImplementation, args);
|
|
1568
|
-
}
|
|
1569
|
-
function takeFirstByImplementation(data, compareFn, n) {
|
|
1570
|
-
if (n <= 0) {
|
|
1571
|
-
return [];
|
|
1572
|
-
}
|
|
1573
|
-
if (n >= data.length) {
|
|
1574
|
-
return [...data];
|
|
1575
|
-
}
|
|
1576
|
-
const heap = data.slice(0, n);
|
|
1577
|
-
heapify(heap, compareFn);
|
|
1578
|
-
const rest = data.slice(n);
|
|
1579
|
-
for (const item of rest) {
|
|
1580
|
-
heapMaybeInsert(heap, compareFn, item);
|
|
1581
|
-
}
|
|
1582
|
-
return heap;
|
|
1583
|
-
}
|
|
1584
|
-
|
|
1585
|
-
// src/array/take-while.ts
|
|
1586
|
-
function takeWhile(...args) {
|
|
1587
|
-
return purry(_takeWhile, args);
|
|
1588
|
-
}
|
|
1589
|
-
function _takeWhile(array, fn) {
|
|
1590
|
-
const ret = [];
|
|
1591
|
-
for (const item of array) {
|
|
1592
|
-
if (!fn(item)) {
|
|
1593
|
-
break;
|
|
1594
|
-
}
|
|
1595
|
-
ret.push(item);
|
|
1596
|
-
}
|
|
1597
|
-
return ret;
|
|
1598
|
-
}
|
|
1599
|
-
|
|
1600
|
-
// src/array/uniq.ts
|
|
1601
|
-
function uniq(...args) {
|
|
1602
|
-
return purry(_uniq, args, uniq.lazy);
|
|
1603
|
-
}
|
|
1604
|
-
function _uniq(array) {
|
|
1605
|
-
return reduceLazy(array, uniq.lazy());
|
|
1606
|
-
}
|
|
1607
|
-
((uniq2) => {
|
|
1608
|
-
function lazy() {
|
|
1609
|
-
const set2 = /* @__PURE__ */ new Set();
|
|
1610
|
-
return (value) => {
|
|
1611
|
-
if (set2.has(value)) {
|
|
1612
|
-
return {
|
|
1613
|
-
done: false,
|
|
1614
|
-
hasNext: false
|
|
1615
|
-
};
|
|
1616
|
-
}
|
|
1617
|
-
set2.add(value);
|
|
1618
|
-
return {
|
|
1619
|
-
done: false,
|
|
1620
|
-
hasNext: true,
|
|
1621
|
-
next: value
|
|
1622
|
-
};
|
|
1623
|
-
};
|
|
1624
|
-
}
|
|
1625
|
-
uniq2.lazy = lazy;
|
|
1626
|
-
})(uniq || (uniq = {}));
|
|
1627
|
-
|
|
1628
|
-
// src/array/uniq-by.ts
|
|
1629
|
-
function uniqBy(...args) {
|
|
1630
|
-
return purry(_uniqBy, args, lazyUniqBy);
|
|
1631
|
-
}
|
|
1632
|
-
function _uniqBy(array, transformer) {
|
|
1633
|
-
return reduceLazy(array, lazyUniqBy(transformer));
|
|
1634
|
-
}
|
|
1635
|
-
function lazyUniqBy(transformer) {
|
|
1636
|
-
const set2 = /* @__PURE__ */ new Set();
|
|
1637
|
-
return (value) => {
|
|
1638
|
-
const appliedItem = transformer(value);
|
|
1639
|
-
if (set2.has(appliedItem)) {
|
|
1640
|
-
return {
|
|
1641
|
-
done: false,
|
|
1642
|
-
hasNext: false
|
|
1643
|
-
};
|
|
1644
|
-
}
|
|
1645
|
-
set2.add(appliedItem);
|
|
1646
|
-
return {
|
|
1647
|
-
done: false,
|
|
1648
|
-
hasNext: true,
|
|
1649
|
-
next: value
|
|
1650
|
-
};
|
|
1651
|
-
};
|
|
1652
|
-
}
|
|
1653
|
-
|
|
1654
|
-
// src/array/uniq-with.ts
|
|
1655
|
-
function uniqWith(...args) {
|
|
1656
|
-
return purry(_uniqWith, args, uniqWith.lazy);
|
|
1657
|
-
}
|
|
1658
|
-
function _uniqWith(array, isEquals) {
|
|
1659
|
-
const lazy = uniqWith.lazy(isEquals);
|
|
1660
|
-
return reduceLazy(array, lazy, true);
|
|
1661
|
-
}
|
|
1662
|
-
function _lazy6(isEquals) {
|
|
1663
|
-
return (value, index, array) => {
|
|
1664
|
-
if (array && array.findIndex((otherValue) => isEquals(value, otherValue)) === index) {
|
|
1665
|
-
return {
|
|
1666
|
-
done: false,
|
|
1667
|
-
hasNext: true,
|
|
1668
|
-
next: value
|
|
1669
|
-
};
|
|
1670
|
-
}
|
|
1671
|
-
return {
|
|
1672
|
-
done: false,
|
|
1673
|
-
hasNext: false
|
|
1674
|
-
};
|
|
1675
|
-
};
|
|
1676
|
-
}
|
|
1677
|
-
((uniqWith2) => {
|
|
1678
|
-
uniqWith2.lazy = toLazyIndexed(_lazy6);
|
|
1679
|
-
})(uniqWith || (uniqWith = {}));
|
|
1680
|
-
|
|
1681
|
-
// src/array/zip.ts
|
|
1682
|
-
function zip(...args) {
|
|
1683
|
-
return purry(_zip, args);
|
|
1684
|
-
}
|
|
1685
|
-
function _zip(first2, second) {
|
|
1686
|
-
const resultLength = first2.length > second.length ? second.length : first2.length;
|
|
1687
|
-
const result = [];
|
|
1688
|
-
for (let i = 0; i < resultLength; i++) {
|
|
1689
|
-
result.push([first2[i], second[i]]);
|
|
1690
|
-
}
|
|
1691
|
-
return result;
|
|
1692
|
-
}
|
|
1693
|
-
((zip2) => {
|
|
1694
|
-
zip2.strict = zip2;
|
|
1695
|
-
})(zip || (zip = {}));
|
|
1696
|
-
|
|
1697
|
-
// src/array/zip-obj.ts
|
|
1698
|
-
function zipObj(...args) {
|
|
1699
|
-
return purry(_zipObj, args);
|
|
1700
|
-
}
|
|
1701
|
-
function _zipObj(first2, second) {
|
|
1702
|
-
const resultLength = first2.length > second.length ? second.length : first2.length;
|
|
1703
|
-
const result = {};
|
|
1704
|
-
for (let i = 0; i < resultLength; i++) {
|
|
1705
|
-
result[first2[i]] = second[i];
|
|
1706
|
-
}
|
|
1707
|
-
return result;
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
// src/array/zip-with.ts
|
|
1711
|
-
function zipWith(arg0, arg1, arg2) {
|
|
1712
|
-
if (typeof arg0 === "function") {
|
|
1713
|
-
return arg1 === void 0 ? (f, s) => _zipWith(f, s, arg0) : (f) => _zipWith(f, arg1, arg0);
|
|
1714
|
-
}
|
|
1715
|
-
if (arg1 === void 0 || arg2 === void 0) {
|
|
1716
|
-
throw new Error("zipWith: Missing arguments in dataFirst function call");
|
|
1717
|
-
}
|
|
1718
|
-
return _zipWith(arg0, arg1, arg2);
|
|
1719
|
-
}
|
|
1720
|
-
function _zipWith(first2, second, fn) {
|
|
1721
|
-
const resultLength = first2.length > second.length ? second.length : first2.length;
|
|
1722
|
-
const result = [];
|
|
1723
|
-
for (let i = 0; i < resultLength; i++) {
|
|
1724
|
-
result.push(fn(first2[i], second[i]));
|
|
1725
|
-
}
|
|
1726
|
-
return result;
|
|
1727
|
-
}
|
|
1728
|
-
|
|
1729
|
-
// src/utils/purry-on.ts
|
|
1730
|
-
function purryOn(isArg, implementation, args) {
|
|
1731
|
-
const callArgs = Array.from(args);
|
|
1732
|
-
return isArg(args[0]) ? (data) => implementation(data, ...callArgs) : implementation(...callArgs);
|
|
1733
|
-
}
|
|
1734
|
-
|
|
1735
|
-
// src/function/conditional.ts
|
|
1736
|
-
function conditional(...args) {
|
|
1737
|
-
return purryOn(isCase, conditionalImplementation, args);
|
|
1738
|
-
}
|
|
1739
|
-
function conditionalImplementation(data, ...cases) {
|
|
1740
|
-
for (const [when, then] of cases) {
|
|
1741
|
-
if (when(data)) {
|
|
1742
|
-
return then(data);
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
throw new Error("conditional: data failed for all cases");
|
|
1746
|
-
}
|
|
1747
|
-
function isCase(maybeCase) {
|
|
1748
|
-
if (!Array.isArray(maybeCase)) {
|
|
1749
|
-
return false;
|
|
1750
|
-
}
|
|
1751
|
-
const [when, then, ...rest] = maybeCase;
|
|
1752
|
-
return typeof when === "function" && when.length <= 1 && typeof then === "function" && then.length <= 1 && rest.length === 0;
|
|
1753
|
-
}
|
|
1754
|
-
var trivialDefaultCase = () => void 0;
|
|
1755
|
-
((conditional2) => {
|
|
1756
|
-
function defaultCase(then = trivialDefaultCase) {
|
|
1757
|
-
return [() => true, then];
|
|
1758
|
-
}
|
|
1759
|
-
conditional2.defaultCase = defaultCase;
|
|
1760
|
-
})(conditional || (conditional = {}));
|
|
1761
|
-
|
|
1762
|
-
// src/function/pipe.ts
|
|
1763
|
-
function pipe(input, ...operations) {
|
|
1764
|
-
let output = input;
|
|
1765
|
-
const lazyOperations = operations.map(
|
|
1766
|
-
(op) => "lazy" in op ? toPipedLazy(op) : void 0
|
|
1767
|
-
);
|
|
1768
|
-
let operationIndex = 0;
|
|
1769
|
-
while (operationIndex < operations.length) {
|
|
1770
|
-
const lazyOperation = lazyOperations[operationIndex];
|
|
1771
|
-
if (lazyOperation === void 0 || !isIterable(output)) {
|
|
1772
|
-
const operation = operations[operationIndex];
|
|
1773
|
-
output = operation(output);
|
|
1774
|
-
operationIndex++;
|
|
1775
|
-
continue;
|
|
1776
|
-
}
|
|
1777
|
-
const lazySequence = [];
|
|
1778
|
-
for (let j = operationIndex; j < operations.length; j++) {
|
|
1779
|
-
const lazyOp = lazyOperations[j];
|
|
1780
|
-
if (lazyOp === void 0) {
|
|
1781
|
-
break;
|
|
1782
|
-
}
|
|
1783
|
-
lazySequence.push(lazyOp);
|
|
1784
|
-
if (lazyOp.isSingle) {
|
|
1785
|
-
break;
|
|
1786
|
-
}
|
|
1787
|
-
}
|
|
1788
|
-
const accumulator = [];
|
|
1789
|
-
const iterator = output[Symbol.iterator]();
|
|
1790
|
-
while (true) {
|
|
1791
|
-
const result = iterator.next();
|
|
1792
|
-
if (result.done ?? false) {
|
|
1793
|
-
break;
|
|
1794
|
-
}
|
|
1795
|
-
const shouldExitEarly = processItem_(
|
|
1796
|
-
result.value,
|
|
1797
|
-
accumulator,
|
|
1798
|
-
lazySequence
|
|
1799
|
-
);
|
|
1800
|
-
if (shouldExitEarly) {
|
|
1801
|
-
break;
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
const { isSingle } = lazySequence[lazySequence.length - 1];
|
|
1805
|
-
if (isSingle) {
|
|
1806
|
-
output = accumulator[0];
|
|
1807
|
-
} else {
|
|
1808
|
-
output = accumulator;
|
|
1809
|
-
}
|
|
1810
|
-
operationIndex += lazySequence.length;
|
|
1811
|
-
}
|
|
1812
|
-
return output;
|
|
1813
|
-
}
|
|
1814
|
-
function processItem_(item, accumulator, lazySequence) {
|
|
1815
|
-
if (lazySequence.length === 0) {
|
|
1816
|
-
accumulator.push(item);
|
|
1817
|
-
return false;
|
|
1818
|
-
}
|
|
1819
|
-
let lazyResult = { done: false, hasNext: false };
|
|
1820
|
-
let isDone = false;
|
|
1821
|
-
for (let i = 0; i < lazySequence.length; i++) {
|
|
1822
|
-
const lazyFn = lazySequence[i];
|
|
1823
|
-
const { index, isIndexed, items } = lazyFn;
|
|
1824
|
-
items.push(item);
|
|
1825
|
-
lazyResult = isIndexed ? lazyFn(item, index, items) : lazyFn(item);
|
|
1826
|
-
lazyFn.index++;
|
|
1827
|
-
if (lazyResult.hasNext) {
|
|
1828
|
-
if (lazyResult.hasMany) {
|
|
1829
|
-
const nextValues = lazyResult.next;
|
|
1830
|
-
for (const subItem of nextValues) {
|
|
1831
|
-
const subResult = processItem_(
|
|
1832
|
-
subItem,
|
|
1833
|
-
accumulator,
|
|
1834
|
-
lazySequence.slice(i + 1)
|
|
1835
|
-
);
|
|
1836
|
-
if (subResult) {
|
|
1837
|
-
return true;
|
|
1838
|
-
}
|
|
1839
|
-
}
|
|
1840
|
-
return false;
|
|
1841
|
-
} else {
|
|
1842
|
-
item = lazyResult.next;
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
|
-
if (!lazyResult.hasNext) {
|
|
1846
|
-
break;
|
|
1847
|
-
}
|
|
1848
|
-
if (lazyResult.done) {
|
|
1849
|
-
isDone = true;
|
|
1850
|
-
}
|
|
1851
|
-
}
|
|
1852
|
-
if (lazyResult.hasNext) {
|
|
1853
|
-
accumulator.push(item);
|
|
1854
|
-
}
|
|
1855
|
-
return isDone;
|
|
1856
|
-
}
|
|
1857
|
-
function toPipedLazy(op) {
|
|
1858
|
-
const { lazy, lazyArgs } = op;
|
|
1859
|
-
const fn = lazy(...lazyArgs ?? []);
|
|
1860
|
-
return Object.assign(fn, {
|
|
1861
|
-
index: 0,
|
|
1862
|
-
isIndexed: lazy.indexed,
|
|
1863
|
-
isSingle: lazy.single,
|
|
1864
|
-
items: []
|
|
1865
|
-
});
|
|
1866
|
-
}
|
|
1867
|
-
function isIterable(something) {
|
|
1868
|
-
return typeof something === "string" || typeof something === "object" && something !== null && Symbol.iterator in something;
|
|
1869
|
-
}
|
|
1870
|
-
|
|
1871
|
-
// src/function/create-pipe.ts
|
|
1872
|
-
function createPipe(...operations) {
|
|
1873
|
-
return (value) => pipe(value, ...operations);
|
|
1874
|
-
}
|
|
1875
|
-
|
|
1876
|
-
// src/function/identity.ts
|
|
1877
|
-
function identity(value) {
|
|
1878
|
-
return value;
|
|
1879
|
-
}
|
|
1880
|
-
|
|
1881
|
-
// src/function/noop.ts
|
|
1882
|
-
function noop() {
|
|
1883
|
-
return void 0;
|
|
1884
|
-
}
|
|
1885
|
-
|
|
1886
|
-
// src/function/once.ts
|
|
1887
|
-
function once(fn) {
|
|
1888
|
-
let called = false;
|
|
1889
|
-
let ret;
|
|
1890
|
-
return () => {
|
|
1891
|
-
if (!called) {
|
|
1892
|
-
ret = fn();
|
|
1893
|
-
called = true;
|
|
1894
|
-
}
|
|
1895
|
-
return ret;
|
|
1896
|
-
};
|
|
1897
|
-
}
|
|
1898
|
-
|
|
1899
|
-
// src/function/debounce.ts
|
|
1900
|
-
function debounce(func, {
|
|
1901
|
-
maxWaitMs,
|
|
1902
|
-
timing = "trailing",
|
|
1903
|
-
waitMs
|
|
1904
|
-
}) {
|
|
1905
|
-
if (maxWaitMs !== void 0 && waitMs !== void 0 && maxWaitMs < waitMs) {
|
|
1906
|
-
throw new Error(
|
|
1907
|
-
`debounce: maxWaitMs (${maxWaitMs}) cannot be less than waitMs (${waitMs})`
|
|
1908
|
-
);
|
|
1909
|
-
}
|
|
1910
|
-
let coolDownTimeoutId;
|
|
1911
|
-
let maxWaitTimeoutId;
|
|
1912
|
-
let latestCallArgs;
|
|
1913
|
-
let result;
|
|
1914
|
-
function handleDebouncedCall(args) {
|
|
1915
|
-
latestCallArgs = args;
|
|
1916
|
-
if (maxWaitMs !== void 0 && maxWaitTimeoutId === void 0) {
|
|
1917
|
-
maxWaitTimeoutId = setTimeout(handleInvoke, maxWaitMs);
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
function handleInvoke() {
|
|
1921
|
-
if (latestCallArgs === void 0) {
|
|
1922
|
-
return;
|
|
1923
|
-
}
|
|
1924
|
-
if (maxWaitTimeoutId !== void 0) {
|
|
1925
|
-
const timeoutId = maxWaitTimeoutId;
|
|
1926
|
-
maxWaitTimeoutId = void 0;
|
|
1927
|
-
clearTimeout(timeoutId);
|
|
1928
|
-
}
|
|
1929
|
-
const args = latestCallArgs;
|
|
1930
|
-
latestCallArgs = void 0;
|
|
1931
|
-
result = func(...args);
|
|
1932
|
-
}
|
|
1933
|
-
function handleCoolDownEnd() {
|
|
1934
|
-
if (coolDownTimeoutId === void 0) {
|
|
1935
|
-
return;
|
|
1936
|
-
}
|
|
1937
|
-
const timeoutId = coolDownTimeoutId;
|
|
1938
|
-
coolDownTimeoutId = void 0;
|
|
1939
|
-
clearTimeout(timeoutId);
|
|
1940
|
-
if (latestCallArgs !== void 0) {
|
|
1941
|
-
handleInvoke();
|
|
1942
|
-
}
|
|
1943
|
-
}
|
|
1944
|
-
return {
|
|
1945
|
-
get cachedValue() {
|
|
1946
|
-
return result;
|
|
1947
|
-
},
|
|
1948
|
-
call: (...args) => {
|
|
1949
|
-
if (coolDownTimeoutId === void 0) {
|
|
1950
|
-
if (timing === "trailing") {
|
|
1951
|
-
handleDebouncedCall(args);
|
|
1952
|
-
} else {
|
|
1953
|
-
result = func(...args);
|
|
1954
|
-
}
|
|
1955
|
-
} else {
|
|
1956
|
-
if (timing !== "leading") {
|
|
1957
|
-
handleDebouncedCall(args);
|
|
1958
|
-
}
|
|
1959
|
-
const timeoutId = coolDownTimeoutId;
|
|
1960
|
-
coolDownTimeoutId = void 0;
|
|
1961
|
-
clearTimeout(timeoutId);
|
|
1962
|
-
}
|
|
1963
|
-
coolDownTimeoutId = setTimeout(
|
|
1964
|
-
handleCoolDownEnd,
|
|
1965
|
-
// If waitMs is not defined but maxWaitMs *is* it means the user is only
|
|
1966
|
-
// interested in the leaky-bucket nature of the debouncer which is
|
|
1967
|
-
// achieved by setting waitMs === maxWaitMs. If both are not defined we
|
|
1968
|
-
// default to 0 which would wait until the end of the execution frame.
|
|
1969
|
-
waitMs ?? maxWaitMs ?? 0
|
|
1970
|
-
);
|
|
1971
|
-
return result;
|
|
1972
|
-
},
|
|
1973
|
-
cancel: () => {
|
|
1974
|
-
if (coolDownTimeoutId !== void 0) {
|
|
1975
|
-
const timeoutId = coolDownTimeoutId;
|
|
1976
|
-
coolDownTimeoutId = void 0;
|
|
1977
|
-
clearTimeout(timeoutId);
|
|
1978
|
-
}
|
|
1979
|
-
if (maxWaitTimeoutId !== void 0) {
|
|
1980
|
-
const timeoutId = maxWaitTimeoutId;
|
|
1981
|
-
maxWaitTimeoutId = void 0;
|
|
1982
|
-
clearTimeout(timeoutId);
|
|
1983
|
-
}
|
|
1984
|
-
latestCallArgs = void 0;
|
|
1985
|
-
},
|
|
1986
|
-
flush: () => {
|
|
1987
|
-
handleCoolDownEnd();
|
|
1988
|
-
return result;
|
|
1989
|
-
},
|
|
1990
|
-
get isPending() {
|
|
1991
|
-
return coolDownTimeoutId !== void 0;
|
|
1992
|
-
}
|
|
1993
|
-
};
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
|
-
// src/function/sleep.ts
|
|
1997
|
-
function sleep(timeout) {
|
|
1998
|
-
return new Promise((resolve) => {
|
|
1999
|
-
setTimeout(resolve, timeout);
|
|
2000
|
-
});
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2003
|
-
// src/guard/is-array.ts
|
|
2004
|
-
function isArray(data) {
|
|
2005
|
-
return Array.isArray(data);
|
|
2006
|
-
}
|
|
2007
|
-
|
|
2008
|
-
// src/guard/is-boolean.ts
|
|
2009
|
-
function isBoolean(data) {
|
|
2010
|
-
return typeof data === "boolean";
|
|
2011
|
-
}
|
|
2012
|
-
|
|
2013
|
-
// src/guard/is-date.ts
|
|
2014
|
-
function isDate(data) {
|
|
2015
|
-
return data instanceof Date;
|
|
2016
|
-
}
|
|
2017
|
-
|
|
2018
|
-
// src/guard/is-defined.ts
|
|
2019
|
-
function isDefined(data) {
|
|
2020
|
-
return typeof data !== "undefined" && data !== null;
|
|
2021
|
-
}
|
|
2022
|
-
((isDefined2) => {
|
|
2023
|
-
function strict(data) {
|
|
2024
|
-
return data !== void 0;
|
|
2025
|
-
}
|
|
2026
|
-
isDefined2.strict = strict;
|
|
2027
|
-
})(isDefined || (isDefined = {}));
|
|
2028
|
-
|
|
2029
|
-
// src/guard/is-object.ts
|
|
2030
|
-
function isObject(data) {
|
|
2031
|
-
if (typeof data !== "object" || data === null) {
|
|
2032
|
-
return false;
|
|
2033
|
-
}
|
|
2034
|
-
const proto = Object.getPrototypeOf(data);
|
|
2035
|
-
return proto === null || proto === Object.prototype;
|
|
2036
|
-
}
|
|
2037
|
-
|
|
2038
|
-
// src/guard/is-string.ts
|
|
2039
|
-
function isString(data) {
|
|
2040
|
-
return typeof data === "string";
|
|
2041
|
-
}
|
|
2042
|
-
|
|
2043
|
-
// src/guard/is-empty.ts
|
|
2044
|
-
function isEmpty(data) {
|
|
2045
|
-
if (isArray(data) || isString(data)) {
|
|
2046
|
-
return data.length === 0;
|
|
2047
|
-
}
|
|
2048
|
-
if (isObject(data)) {
|
|
2049
|
-
for (const _ in data) {
|
|
2050
|
-
return false;
|
|
2051
|
-
}
|
|
2052
|
-
return !(data instanceof RegExp);
|
|
2053
|
-
}
|
|
2054
|
-
return false;
|
|
2055
|
-
}
|
|
2056
|
-
|
|
2057
|
-
// src/guard/is-error.ts
|
|
2058
|
-
function isError(data) {
|
|
2059
|
-
return data instanceof Error;
|
|
2060
|
-
}
|
|
2061
|
-
|
|
2062
|
-
// src/guard/is-function.ts
|
|
2063
|
-
function isFunction(data) {
|
|
2064
|
-
return typeof data === "function";
|
|
2065
|
-
}
|
|
2066
|
-
|
|
2067
|
-
// src/guard/is-nil.ts
|
|
2068
|
-
function isNil(data) {
|
|
2069
|
-
return data == null;
|
|
2070
|
-
}
|
|
2071
|
-
|
|
2072
|
-
// src/guard/is-non-null.ts
|
|
2073
|
-
function isNonNull(data) {
|
|
2074
|
-
return data !== null;
|
|
2075
|
-
}
|
|
2076
|
-
|
|
2077
|
-
// src/guard/is-not.ts
|
|
2078
|
-
function isNot(predicate) {
|
|
2079
|
-
return (data) => {
|
|
2080
|
-
return !predicate(data);
|
|
2081
|
-
};
|
|
2082
|
-
}
|
|
2083
|
-
|
|
2084
|
-
// src/guard/is-number.ts
|
|
2085
|
-
function isNumber(data) {
|
|
2086
|
-
return typeof data === "number" && !Number.isNaN(data);
|
|
2087
|
-
}
|
|
2088
|
-
|
|
2089
|
-
// src/guard/is-promise.ts
|
|
2090
|
-
function isPromise(data) {
|
|
2091
|
-
return data instanceof Promise;
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
|
-
// src/guard/is-symbol.ts
|
|
2095
|
-
function isSymbol(data) {
|
|
2096
|
-
return typeof data === "symbol";
|
|
2097
|
-
}
|
|
2098
|
-
|
|
2099
|
-
// src/number/add.ts
|
|
2100
|
-
function add(...args) {
|
|
2101
|
-
return purry(_add, args);
|
|
2102
|
-
}
|
|
2103
|
-
function _add(value, addend) {
|
|
2104
|
-
return value + addend;
|
|
2105
|
-
}
|
|
2106
|
-
|
|
2107
|
-
// src/utils/with-precision.ts
|
|
2108
|
-
var MAX_PRECISION = 15;
|
|
2109
|
-
function withPrecision(roundingFn) {
|
|
2110
|
-
return (value, precision) => {
|
|
2111
|
-
if (precision === 0) {
|
|
2112
|
-
return roundingFn(value);
|
|
2113
|
-
}
|
|
2114
|
-
if (!Number.isInteger(precision)) {
|
|
2115
|
-
throw new TypeError(`precision must be an integer: ${precision}`);
|
|
2116
|
-
}
|
|
2117
|
-
if (precision > MAX_PRECISION || precision < -MAX_PRECISION) {
|
|
2118
|
-
throw new RangeError(`precision must be between ${-MAX_PRECISION} and ${MAX_PRECISION}`);
|
|
2119
|
-
}
|
|
2120
|
-
if (Number.isNaN(value) || !Number.isFinite(value)) {
|
|
2121
|
-
return roundingFn(value);
|
|
2122
|
-
}
|
|
2123
|
-
const multiplier = 10 ** precision;
|
|
2124
|
-
return roundingFn(value * multiplier) / multiplier;
|
|
2125
|
-
};
|
|
2126
|
-
}
|
|
2127
|
-
|
|
2128
|
-
// src/number/ceil.ts
|
|
2129
|
-
function ceil(...args) {
|
|
2130
|
-
return purry(withPrecision(Math.ceil), args);
|
|
2131
|
-
}
|
|
2132
|
-
|
|
2133
|
-
// src/number/clamp.ts
|
|
2134
|
-
function clamp(...args) {
|
|
2135
|
-
return purry(_clamp, args);
|
|
2136
|
-
}
|
|
2137
|
-
function _clamp(value, limits) {
|
|
2138
|
-
if (limits.min != null && limits.min > value) {
|
|
2139
|
-
return limits.min;
|
|
2140
|
-
}
|
|
2141
|
-
if (limits.max != null && limits.max < value) {
|
|
2142
|
-
return limits.max;
|
|
2143
|
-
}
|
|
2144
|
-
return value;
|
|
2145
|
-
}
|
|
2146
|
-
|
|
2147
|
-
// src/number/divide.ts
|
|
2148
|
-
function divide(...args) {
|
|
2149
|
-
return purry(_divide, args);
|
|
2150
|
-
}
|
|
2151
|
-
function _divide(value, divisor) {
|
|
2152
|
-
return value / divisor;
|
|
2153
|
-
}
|
|
2154
|
-
|
|
2155
|
-
// src/number/floor.ts
|
|
2156
|
-
function floor(...args) {
|
|
2157
|
-
return purry(withPrecision(Math.floor), args);
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2160
|
-
// src/number/multiply.ts
|
|
2161
|
-
function multiply(...args) {
|
|
2162
|
-
return purry(_multiply, args);
|
|
2163
|
-
}
|
|
2164
|
-
function _multiply(value, multiplicand) {
|
|
2165
|
-
return value * multiplicand;
|
|
2166
|
-
}
|
|
2167
|
-
|
|
2168
|
-
// src/number/round.ts
|
|
2169
|
-
function round(...args) {
|
|
2170
|
-
return purry(withPrecision(Math.round), args);
|
|
2171
|
-
}
|
|
2172
|
-
|
|
2173
|
-
// src/number/subtract.ts
|
|
2174
|
-
function subtract(...args) {
|
|
2175
|
-
return purry(_subtract, args);
|
|
2176
|
-
}
|
|
2177
|
-
function _subtract(value, subtrahend) {
|
|
2178
|
-
return value - subtrahend;
|
|
2179
|
-
}
|
|
2180
|
-
|
|
2181
|
-
// src/object/add-prop.ts
|
|
2182
|
-
function addProp(...args) {
|
|
2183
|
-
return purry(_addProp, args);
|
|
2184
|
-
}
|
|
2185
|
-
function _addProp(obj, prop2, value) {
|
|
2186
|
-
return {
|
|
2187
|
-
...obj,
|
|
2188
|
-
[prop2]: value
|
|
2189
|
-
};
|
|
2190
|
-
}
|
|
2191
|
-
|
|
2192
|
-
// src/type/type.ts
|
|
2193
|
-
function type(val) {
|
|
2194
|
-
if (val === null) {
|
|
2195
|
-
return "Null";
|
|
2196
|
-
}
|
|
2197
|
-
if (val === void 0) {
|
|
2198
|
-
return "Undefined";
|
|
2199
|
-
}
|
|
2200
|
-
return Object.prototype.toString.call(val).slice(8, -1);
|
|
2201
|
-
}
|
|
2202
|
-
|
|
2203
|
-
// src/object/clone.ts
|
|
2204
|
-
function _cloneRegExp(pattern) {
|
|
2205
|
-
return new RegExp(
|
|
2206
|
-
pattern.source,
|
|
2207
|
-
(pattern.global ? "g" : "") + (pattern.ignoreCase ? "i" : "") + (pattern.multiline ? "m" : "") + (pattern.sticky ? "y" : "") + (pattern.unicode ? "u" : "")
|
|
2208
|
-
);
|
|
2209
|
-
}
|
|
2210
|
-
function _clone(value, refFrom, refTo, deep) {
|
|
2211
|
-
function copy(copiedValue) {
|
|
2212
|
-
const len = refFrom.length;
|
|
2213
|
-
let idx = 0;
|
|
2214
|
-
while (idx < len) {
|
|
2215
|
-
if (value === refFrom[idx]) {
|
|
2216
|
-
return refTo[idx];
|
|
2217
|
-
}
|
|
2218
|
-
idx += 1;
|
|
2219
|
-
}
|
|
2220
|
-
refFrom[idx + 1] = value;
|
|
2221
|
-
refTo[idx + 1] = copiedValue;
|
|
2222
|
-
for (const key in value) {
|
|
2223
|
-
copiedValue[key] = deep ? _clone(value[key], refFrom, refTo, true) : value[key];
|
|
2224
|
-
}
|
|
2225
|
-
return copiedValue;
|
|
2226
|
-
}
|
|
2227
|
-
switch (type(value)) {
|
|
2228
|
-
case "Object":
|
|
2229
|
-
return copy({});
|
|
2230
|
-
case "Array":
|
|
2231
|
-
return copy([]);
|
|
2232
|
-
case "Date":
|
|
2233
|
-
return new Date(value.valueOf());
|
|
2234
|
-
case "RegExp":
|
|
2235
|
-
return _cloneRegExp(value);
|
|
2236
|
-
default:
|
|
2237
|
-
return value;
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
function clone(value) {
|
|
2241
|
-
return value != null && typeof value.clone === "function" ? value.clone() : _clone(value, [], [], true);
|
|
2242
|
-
}
|
|
2243
|
-
|
|
2244
|
-
// src/object/equals.ts
|
|
2245
|
-
var isArray2 = Array.isArray;
|
|
2246
|
-
var keyList = Object.keys;
|
|
2247
|
-
function equals(...args) {
|
|
2248
|
-
return purry(_equals, args);
|
|
2249
|
-
}
|
|
2250
|
-
function _equals(a, b) {
|
|
2251
|
-
if (a === b) {
|
|
2252
|
-
return true;
|
|
2253
|
-
}
|
|
2254
|
-
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
2255
|
-
const arrA = isArray2(a);
|
|
2256
|
-
const arrB = isArray2(b);
|
|
2257
|
-
let i;
|
|
2258
|
-
let length2;
|
|
2259
|
-
let key;
|
|
2260
|
-
if (arrA && arrB) {
|
|
2261
|
-
length2 = a.length;
|
|
2262
|
-
if (length2 !== b.length) {
|
|
2263
|
-
return false;
|
|
2264
|
-
}
|
|
2265
|
-
for (i = length2; i-- !== 0; ) {
|
|
2266
|
-
if (!equals(a[i], b[i])) {
|
|
2267
|
-
return false;
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
return true;
|
|
2271
|
-
}
|
|
2272
|
-
if (arrA !== arrB) {
|
|
2273
|
-
return false;
|
|
2274
|
-
}
|
|
2275
|
-
const dateA = a instanceof Date;
|
|
2276
|
-
const dateB = b instanceof Date;
|
|
2277
|
-
if (dateA !== dateB) {
|
|
2278
|
-
return false;
|
|
2279
|
-
}
|
|
2280
|
-
if (dateA && dateB) {
|
|
2281
|
-
return a.getTime() === b.getTime();
|
|
2282
|
-
}
|
|
2283
|
-
const regexpA = a instanceof RegExp;
|
|
2284
|
-
const regexpB = b instanceof RegExp;
|
|
2285
|
-
if (regexpA !== regexpB) {
|
|
2286
|
-
return false;
|
|
2287
|
-
}
|
|
2288
|
-
if (regexpA && regexpB) {
|
|
2289
|
-
return a.toString() === b.toString();
|
|
2290
|
-
}
|
|
2291
|
-
const keys2 = keyList(a);
|
|
2292
|
-
length2 = keys2.length;
|
|
2293
|
-
if (length2 !== keyList(b).length) {
|
|
2294
|
-
return false;
|
|
2295
|
-
}
|
|
2296
|
-
for (i = length2; i-- !== 0; ) {
|
|
2297
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys2[i])) {
|
|
2298
|
-
return false;
|
|
2299
|
-
}
|
|
2300
|
-
}
|
|
2301
|
-
for (i = length2; i-- !== 0; ) {
|
|
2302
|
-
key = keys2[i];
|
|
2303
|
-
if (!equals(a[key], b[key])) {
|
|
2304
|
-
return false;
|
|
2305
|
-
}
|
|
2306
|
-
}
|
|
2307
|
-
return true;
|
|
2308
|
-
}
|
|
2309
|
-
return a !== a && b !== b;
|
|
2310
|
-
}
|
|
2311
|
-
|
|
2312
|
-
// src/object/for-each-obj.ts
|
|
2313
|
-
function forEachObj(...args) {
|
|
2314
|
-
return purry(_forEachObj(false), args);
|
|
2315
|
-
}
|
|
2316
|
-
function _forEachObj(indexed) {
|
|
2317
|
-
return (object, fn) => {
|
|
2318
|
-
for (const key in object) {
|
|
2319
|
-
if (Object.prototype.hasOwnProperty.call(object, key)) {
|
|
2320
|
-
const val = object[key];
|
|
2321
|
-
if (indexed) {
|
|
2322
|
-
fn(val, key, object);
|
|
2323
|
-
} else {
|
|
2324
|
-
fn(val);
|
|
2325
|
-
}
|
|
2326
|
-
}
|
|
2327
|
-
}
|
|
2328
|
-
return object;
|
|
2329
|
-
};
|
|
2330
|
-
}
|
|
2331
|
-
((forEachObj2) => {
|
|
2332
|
-
function indexed(...args) {
|
|
2333
|
-
return purry(_forEachObj(true), args);
|
|
2334
|
-
}
|
|
2335
|
-
forEachObj2.indexed = indexed;
|
|
2336
|
-
})(forEachObj || (forEachObj = {}));
|
|
2337
|
-
|
|
2338
|
-
// src/object/from-pairs.ts
|
|
2339
|
-
function fromPairs(entries) {
|
|
2340
|
-
const out = {};
|
|
2341
|
-
for (const [key, value] of entries) {
|
|
2342
|
-
out[key] = value;
|
|
2343
|
-
}
|
|
2344
|
-
return out;
|
|
2345
|
-
}
|
|
2346
|
-
((fromPairs2) => {
|
|
2347
|
-
fromPairs2.strict = fromPairs2;
|
|
2348
|
-
})(fromPairs || (fromPairs = {}));
|
|
2349
|
-
|
|
2350
|
-
// src/object/invert.ts
|
|
2351
|
-
function invert(...args) {
|
|
2352
|
-
return purry(_invert, args);
|
|
2353
|
-
}
|
|
2354
|
-
function _invert(object) {
|
|
2355
|
-
const result = {};
|
|
2356
|
-
for (const key in object) {
|
|
2357
|
-
result[object[key]] = key;
|
|
2358
|
-
}
|
|
2359
|
-
return result;
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
// src/object/keys.ts
|
|
2363
|
-
function keys(source) {
|
|
2364
|
-
return Object.keys(source);
|
|
2365
|
-
}
|
|
2366
|
-
((keys2) => {
|
|
2367
|
-
keys2.strict = keys2;
|
|
2368
|
-
})(keys || (keys = {}));
|
|
2369
|
-
|
|
2370
|
-
// src/object/to-pairs.ts
|
|
2371
|
-
function toPairs(...args) {
|
|
2372
|
-
return purry(Object.entries, args);
|
|
2373
|
-
}
|
|
2374
|
-
((toPairs2) => {
|
|
2375
|
-
toPairs2.strict = toPairs2;
|
|
2376
|
-
})(toPairs || (toPairs = {}));
|
|
2377
|
-
|
|
2378
|
-
// src/object/map-keys.ts
|
|
2379
|
-
function mapKeys(...args) {
|
|
2380
|
-
return purry(_mapKeys, args);
|
|
2381
|
-
}
|
|
2382
|
-
function _mapKeys(data, fn) {
|
|
2383
|
-
const out = {};
|
|
2384
|
-
for (const [key, value] of toPairs.strict(data)) {
|
|
2385
|
-
out[fn(key, value)] = value;
|
|
2386
|
-
}
|
|
2387
|
-
return out;
|
|
2388
|
-
}
|
|
2389
|
-
|
|
2390
|
-
// src/object/map-values.ts
|
|
2391
|
-
function mapValues(...args) {
|
|
2392
|
-
return purry(_mapValues, args);
|
|
2393
|
-
}
|
|
2394
|
-
function _mapValues(data, fn) {
|
|
2395
|
-
const out = {};
|
|
2396
|
-
for (const [key, value] of toPairs.strict(data)) {
|
|
2397
|
-
out[key] = fn(value, key);
|
|
2398
|
-
}
|
|
2399
|
-
return out;
|
|
2400
|
-
}
|
|
2401
|
-
|
|
2402
|
-
// src/object/merge.ts
|
|
2403
|
-
function merge(...args) {
|
|
2404
|
-
return purry(_merge, args);
|
|
2405
|
-
}
|
|
2406
|
-
function _merge(a, b) {
|
|
2407
|
-
return Object.assign({}, a, b);
|
|
2408
|
-
}
|
|
2409
|
-
|
|
2410
|
-
// src/object/merge-deep.ts
|
|
2411
|
-
function mergeDeep(...args) {
|
|
2412
|
-
return purry(mergeDeepImplementation, args);
|
|
2413
|
-
}
|
|
2414
|
-
function mergeDeepImplementation(destination, source) {
|
|
2415
|
-
const output = { ...destination, ...source };
|
|
2416
|
-
for (const key in source) {
|
|
2417
|
-
if (!(key in destination)) {
|
|
2418
|
-
continue;
|
|
2419
|
-
}
|
|
2420
|
-
const destinationValue = destination[key];
|
|
2421
|
-
if (!isRecord(destinationValue)) {
|
|
2422
|
-
continue;
|
|
2423
|
-
}
|
|
2424
|
-
const sourceValue = source[key];
|
|
2425
|
-
if (!isRecord(sourceValue)) {
|
|
2426
|
-
continue;
|
|
2427
|
-
}
|
|
2428
|
-
output[key] = mergeDeepImplementation(destinationValue, sourceValue);
|
|
2429
|
-
}
|
|
2430
|
-
return output;
|
|
2431
|
-
}
|
|
2432
|
-
function isRecord(object) {
|
|
2433
|
-
return typeof object === "object" && object !== null && Object.getPrototypeOf(object) === Object.prototype;
|
|
2434
|
-
}
|
|
2435
|
-
|
|
2436
|
-
// src/object/omit.ts
|
|
2437
|
-
function omit(...args) {
|
|
2438
|
-
return purry(_omit, args);
|
|
2439
|
-
}
|
|
2440
|
-
function _omit(data, propNames) {
|
|
2441
|
-
if (!hasAtLeast(propNames, 1)) {
|
|
2442
|
-
return { ...data };
|
|
2443
|
-
}
|
|
2444
|
-
if (!hasAtLeast(propNames, 2)) {
|
|
2445
|
-
const [propName] = propNames;
|
|
2446
|
-
const {
|
|
2447
|
-
[propName]: omitted,
|
|
2448
|
-
...remaining
|
|
2449
|
-
} = data;
|
|
2450
|
-
return remaining;
|
|
2451
|
-
}
|
|
2452
|
-
if (!propNames.some((propName) => propName in data)) {
|
|
2453
|
-
return { ...data };
|
|
2454
|
-
}
|
|
2455
|
-
const asSet = new Set(propNames);
|
|
2456
|
-
return fromPairs(
|
|
2457
|
-
Object.entries(data).filter(([key]) => !asSet.has(key))
|
|
2458
|
-
);
|
|
2459
|
-
}
|
|
2460
|
-
|
|
2461
|
-
// src/object/omit-by.ts
|
|
2462
|
-
function omitBy(...args) {
|
|
2463
|
-
return purry(_omitBy, args);
|
|
2464
|
-
}
|
|
2465
|
-
function _omitBy(object, fn) {
|
|
2466
|
-
if (object === void 0 || object === null) {
|
|
2467
|
-
return object;
|
|
2468
|
-
}
|
|
2469
|
-
return keys.strict(object).reduce((acc, key) => {
|
|
2470
|
-
if (!fn(object[key], key)) {
|
|
2471
|
-
acc[key] = object[key];
|
|
2472
|
-
}
|
|
2473
|
-
return acc;
|
|
2474
|
-
}, {});
|
|
2475
|
-
}
|
|
2476
|
-
|
|
2477
|
-
// src/object/path-or.ts
|
|
2478
|
-
function pathOr(...args) {
|
|
2479
|
-
return purry(_pathOr, args);
|
|
2480
|
-
}
|
|
2481
|
-
function _pathOr(object, path, defaultValue) {
|
|
2482
|
-
let current = object;
|
|
2483
|
-
for (const prop2 of path) {
|
|
2484
|
-
if (current == null || current[prop2] == null) {
|
|
2485
|
-
return defaultValue;
|
|
2486
|
-
}
|
|
2487
|
-
current = current[prop2];
|
|
2488
|
-
}
|
|
2489
|
-
return current;
|
|
2490
|
-
}
|
|
2491
|
-
|
|
2492
|
-
// src/object/pick.ts
|
|
2493
|
-
function pick(...args) {
|
|
2494
|
-
return purry(_pick, args);
|
|
2495
|
-
}
|
|
2496
|
-
function _pick(object, names) {
|
|
2497
|
-
if (object == null) {
|
|
2498
|
-
return {};
|
|
2499
|
-
}
|
|
2500
|
-
return names.reduce((acc, name) => {
|
|
2501
|
-
if (name in object) {
|
|
2502
|
-
acc[name] = object[name];
|
|
2503
|
-
}
|
|
2504
|
-
return acc;
|
|
2505
|
-
}, {});
|
|
2506
|
-
}
|
|
2507
|
-
|
|
2508
|
-
// src/object/pick-by.ts
|
|
2509
|
-
function pickBy(...args) {
|
|
2510
|
-
return purry(_pickBy, args);
|
|
2511
|
-
}
|
|
2512
|
-
function _pickBy(object, fn) {
|
|
2513
|
-
if (object == null) {
|
|
2514
|
-
return {};
|
|
2515
|
-
}
|
|
2516
|
-
return keys.strict(object).reduce((acc, key) => {
|
|
2517
|
-
if (fn(object[key], key)) {
|
|
2518
|
-
acc[key] = object[key];
|
|
2519
|
-
}
|
|
2520
|
-
return acc;
|
|
2521
|
-
}, {});
|
|
2522
|
-
}
|
|
2523
|
-
|
|
2524
|
-
// src/object/prop.ts
|
|
2525
|
-
function prop(propName) {
|
|
2526
|
-
return ({ [propName]: value }) => value;
|
|
2527
|
-
}
|
|
2528
|
-
|
|
2529
|
-
// src/object/set.ts
|
|
2530
|
-
function set(...args) {
|
|
2531
|
-
return purry(_set, args);
|
|
2532
|
-
}
|
|
2533
|
-
function _set(obj, prop2, value) {
|
|
2534
|
-
return {
|
|
2535
|
-
...obj,
|
|
2536
|
-
[prop2]: value
|
|
2537
|
-
};
|
|
2538
|
-
}
|
|
2539
|
-
|
|
2540
|
-
// src/object/set-path.ts
|
|
2541
|
-
function setPath(...args) {
|
|
2542
|
-
return purry(_setPath, args);
|
|
2543
|
-
}
|
|
2544
|
-
function _setPath(object, path, defaultValue) {
|
|
2545
|
-
if (path.length === 0) {
|
|
2546
|
-
return defaultValue;
|
|
2547
|
-
}
|
|
2548
|
-
if (Array.isArray(object)) {
|
|
2549
|
-
return object.map((item, index) => {
|
|
2550
|
-
if (index === path[0]) {
|
|
2551
|
-
return _setPath(item, path.slice(1), defaultValue);
|
|
2552
|
-
}
|
|
2553
|
-
return item;
|
|
2554
|
-
});
|
|
2555
|
-
}
|
|
2556
|
-
return {
|
|
2557
|
-
...object,
|
|
2558
|
-
[path[0]]: _setPath(object[path[0]], path.slice(1), defaultValue)
|
|
2559
|
-
};
|
|
2560
|
-
}
|
|
2561
|
-
|
|
2562
|
-
// src/object/swap-props.ts
|
|
2563
|
-
function swapProps(...args) {
|
|
2564
|
-
return purry(_swapProps, args);
|
|
2565
|
-
}
|
|
2566
|
-
function _swapProps(obj, key1, key2) {
|
|
2567
|
-
const { [key1]: value1, [key2]: value2 } = obj;
|
|
2568
|
-
return {
|
|
2569
|
-
...obj,
|
|
2570
|
-
[key1]: value2,
|
|
2571
|
-
[key2]: value1
|
|
2572
|
-
};
|
|
2573
|
-
}
|
|
2574
|
-
|
|
2575
|
-
// src/object/values.ts
|
|
2576
|
-
function values(source) {
|
|
2577
|
-
return Object.values(source);
|
|
2578
|
-
}
|
|
2579
|
-
|
|
2580
|
-
// src/string/cases.ts
|
|
2581
|
-
var RE_NUMBER_CHAR = /\d/;
|
|
2582
|
-
var STR_SPLITTERS = ["-", "_", "/", "."];
|
|
2583
|
-
function isUppercase(char = "") {
|
|
2584
|
-
if (RE_NUMBER_CHAR.test(char)) {
|
|
2585
|
-
return void 0;
|
|
2586
|
-
}
|
|
2587
|
-
return char !== char.toLowerCase();
|
|
2588
|
-
}
|
|
2589
|
-
function splitByCase(str, separators) {
|
|
2590
|
-
const splitters = separators ?? STR_SPLITTERS;
|
|
2591
|
-
const parts = [];
|
|
2592
|
-
if (!str || !isString(str)) {
|
|
2593
|
-
return parts;
|
|
2594
|
-
}
|
|
2595
|
-
let buff = "";
|
|
2596
|
-
let previousUpper;
|
|
2597
|
-
let previousSplitter;
|
|
2598
|
-
for (const char of str) {
|
|
2599
|
-
const isSplitter = splitters.includes(char);
|
|
2600
|
-
if (isSplitter === true) {
|
|
2601
|
-
parts.push(buff);
|
|
2602
|
-
buff = "";
|
|
2603
|
-
previousUpper = void 0;
|
|
2604
|
-
continue;
|
|
2605
|
-
}
|
|
2606
|
-
const isUpper = isUppercase(char);
|
|
2607
|
-
if (previousSplitter === false) {
|
|
2608
|
-
if (previousUpper === false && isUpper === true) {
|
|
2609
|
-
parts.push(buff);
|
|
2610
|
-
buff = char;
|
|
2611
|
-
previousUpper = isUpper;
|
|
2612
|
-
continue;
|
|
2613
|
-
}
|
|
2614
|
-
if (previousUpper === true && isUpper === false && buff.length > 1) {
|
|
2615
|
-
const lastChar = buff.at(-1);
|
|
2616
|
-
parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
|
|
2617
|
-
buff = lastChar + char;
|
|
2618
|
-
previousUpper = isUpper;
|
|
2619
|
-
continue;
|
|
2620
|
-
}
|
|
2621
|
-
}
|
|
2622
|
-
buff += char;
|
|
2623
|
-
previousUpper = isUpper;
|
|
2624
|
-
previousSplitter = isSplitter;
|
|
2625
|
-
}
|
|
2626
|
-
parts.push(buff);
|
|
2627
|
-
return parts;
|
|
2628
|
-
}
|
|
2629
|
-
function toUpperFirst(str) {
|
|
2630
|
-
return str ? str[0].toUpperCase() + str.slice(1) : "";
|
|
2631
|
-
}
|
|
2632
|
-
function toLowerFirst(str) {
|
|
2633
|
-
return str ? str[0].toLowerCase() + str.slice(1) : "";
|
|
2634
|
-
}
|
|
2635
|
-
function toPascalCase(str, opts) {
|
|
2636
|
-
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => toUpperFirst(opts?.normalize ? p.toLowerCase() : p)).join("") : "";
|
|
2637
|
-
}
|
|
2638
|
-
function toCamelCase(str, opts) {
|
|
2639
|
-
return toLowerFirst(toPascalCase(str || "", opts));
|
|
2640
|
-
}
|
|
2641
|
-
function toKebabCase(str, joiner) {
|
|
2642
|
-
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
|
|
2643
|
-
}
|
|
2644
|
-
function toSnakeCase(str) {
|
|
2645
|
-
return toKebabCase(str || "", "_");
|
|
2646
|
-
}
|
|
2647
|
-
function toFlatCase(str) {
|
|
2648
|
-
return toKebabCase(str || "", "");
|
|
2649
|
-
}
|
|
2650
|
-
function toTrainCase(str, opts) {
|
|
2651
|
-
return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map((p) => toUpperFirst(opts?.normalize ? p.toLowerCase() : p)).join("-");
|
|
2652
|
-
}
|
|
2653
|
-
var titleCaseExceptions = /^(a|an|and|as|at|but|by|for|if|in|is|nor|of|on|or|the|to|with)$/i;
|
|
2654
|
-
function titleCase(str, opts) {
|
|
2655
|
-
return (Array.isArray(str) ? str : splitByCase(str)).filter(Boolean).map((p) => titleCaseExceptions.test(p) ? p.toLowerCase() : toUpperFirst(opts?.normalize ? p.toLowerCase() : p)).join(" ");
|
|
2656
|
-
}
|
|
2657
|
-
|
|
2658
|
-
// src/string/human-readable-file-size.ts
|
|
2659
|
-
function humanReadableFileSize(bytes, base = 1e3) {
|
|
2660
|
-
if (bytes < base) {
|
|
2661
|
-
return `${bytes} B`;
|
|
2662
|
-
}
|
|
2663
|
-
const prefix = base === 1024 ? ["Ki", "Mi", "Gi"] : ["k", "M", "G"];
|
|
2664
|
-
let unit = -1;
|
|
2665
|
-
while (Math.abs(bytes) >= base && unit < prefix.length - 1) {
|
|
2666
|
-
bytes /= base;
|
|
2667
|
-
++unit;
|
|
2668
|
-
}
|
|
2669
|
-
return `${bytes.toFixed(1)} ${prefix[unit]}B`;
|
|
2670
|
-
}
|
|
2671
|
-
|
|
2672
|
-
// src/string/random-string.ts
|
|
2673
|
-
function randomString(length2) {
|
|
2674
|
-
const characterSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
2675
|
-
const randomChar = () => characterSet[Math.floor(Math.random() * characterSet.length)];
|
|
2676
|
-
return range(0, length2).reduce((text) => text + randomChar(), "");
|
|
2677
|
-
}
|
|
2678
|
-
|
|
2679
|
-
// src/string/slugify.ts
|
|
2680
|
-
function slugify(str) {
|
|
2681
|
-
return str.normalize("NFD").replace(/[\u0300-\u036F]/g, "").toLowerCase().replace(/[^a-z0-9]/g, " ").trim().replace(/\s+/g, "-");
|
|
2682
|
-
}
|
|
2683
|
-
|
|
2684
|
-
// src/string/string-to-path.ts
|
|
2685
|
-
function stringToPath(path) {
|
|
2686
|
-
return _stringToPath(path);
|
|
2687
|
-
}
|
|
2688
|
-
function _stringToPath(path) {
|
|
2689
|
-
if (path.length === 0) {
|
|
2690
|
-
return [];
|
|
2691
|
-
}
|
|
2692
|
-
const match = path.match(/^\[(.+?)\](.*)$/) ?? path.match(/^\.?([^.[\]]+)(.*)$/);
|
|
2693
|
-
if (match) {
|
|
2694
|
-
const [, key, rest] = match;
|
|
2695
|
-
return [key, ..._stringToPath(rest)];
|
|
2696
|
-
}
|
|
2697
|
-
return [path];
|
|
2698
|
-
}
|
|
2699
|
-
|
|
2700
|
-
// src/index.ts
|
|
2701
|
-
var isBrowser = typeof window !== "undefined";
|
|
2702
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
2703
|
-
0 && (module.exports = {
|
|
2704
|
-
KEY_CODES,
|
|
2705
|
-
_setPath,
|
|
2706
|
-
add,
|
|
2707
|
-
addProp,
|
|
2708
|
-
allPass,
|
|
2709
|
-
anyPass,
|
|
2710
|
-
ceil,
|
|
2711
|
-
chunk,
|
|
2712
|
-
clamp,
|
|
2713
|
-
clone,
|
|
2714
|
-
compact,
|
|
2715
|
-
concat,
|
|
2716
|
-
conditional,
|
|
2717
|
-
countBy,
|
|
2718
|
-
createPipe,
|
|
2719
|
-
debounce,
|
|
2720
|
-
difference,
|
|
2721
|
-
differenceWith,
|
|
2722
|
-
divide,
|
|
2723
|
-
drop,
|
|
2724
|
-
dropFirstBy,
|
|
2725
|
-
dropLast,
|
|
2726
|
-
dropLastWhile,
|
|
2727
|
-
dropWhile,
|
|
2728
|
-
equals,
|
|
2729
|
-
filter,
|
|
2730
|
-
find,
|
|
2731
|
-
findIndex,
|
|
2732
|
-
findLast,
|
|
2733
|
-
findLastIndex,
|
|
2734
|
-
first,
|
|
2735
|
-
firstBy,
|
|
2736
|
-
flatMap,
|
|
2737
|
-
flatMapToObj,
|
|
2738
|
-
flatten,
|
|
2739
|
-
flattenDeep,
|
|
2740
|
-
floor,
|
|
2741
|
-
forEach,
|
|
2742
|
-
forEachObj,
|
|
2743
|
-
fromPairs,
|
|
2744
|
-
groupBy,
|
|
2745
|
-
hasAtLeast,
|
|
2746
|
-
humanReadableFileSize,
|
|
2747
|
-
identity,
|
|
2748
|
-
indexBy,
|
|
2749
|
-
intersection,
|
|
2750
|
-
intersectionWith,
|
|
2751
|
-
invert,
|
|
2752
|
-
isArray,
|
|
2753
|
-
isBoolean,
|
|
2754
|
-
isBrowser,
|
|
2755
|
-
isDate,
|
|
2756
|
-
isDefined,
|
|
2757
|
-
isEmpty,
|
|
2758
|
-
isError,
|
|
2759
|
-
isFunction,
|
|
2760
|
-
isNil,
|
|
2761
|
-
isNonNull,
|
|
2762
|
-
isNot,
|
|
2763
|
-
isNumber,
|
|
2764
|
-
isObject,
|
|
2765
|
-
isPromise,
|
|
2766
|
-
isString,
|
|
2767
|
-
isSymbol,
|
|
2768
|
-
isTruthy,
|
|
2769
|
-
isUppercase,
|
|
2770
|
-
join,
|
|
2771
|
-
keys,
|
|
2772
|
-
last,
|
|
2773
|
-
length,
|
|
2774
|
-
map,
|
|
2775
|
-
mapKeys,
|
|
2776
|
-
mapToObj,
|
|
2777
|
-
mapValues,
|
|
2778
|
-
maxBy,
|
|
2779
|
-
meanBy,
|
|
2780
|
-
merge,
|
|
2781
|
-
mergeAll,
|
|
2782
|
-
mergeDeep,
|
|
2783
|
-
minBy,
|
|
2784
|
-
multiply,
|
|
2785
|
-
noop,
|
|
2786
|
-
nthBy,
|
|
2787
|
-
omit,
|
|
2788
|
-
omitBy,
|
|
2789
|
-
once,
|
|
2790
|
-
only,
|
|
2791
|
-
partition,
|
|
2792
|
-
pathOr,
|
|
2793
|
-
pick,
|
|
2794
|
-
pickBy,
|
|
2795
|
-
pipe,
|
|
2796
|
-
prop,
|
|
2797
|
-
purry,
|
|
2798
|
-
randomString,
|
|
2799
|
-
range,
|
|
2800
|
-
rankBy,
|
|
2801
|
-
reduce,
|
|
2802
|
-
reject,
|
|
2803
|
-
reverse,
|
|
2804
|
-
round,
|
|
2805
|
-
sample,
|
|
2806
|
-
set,
|
|
2807
|
-
setPath,
|
|
2808
|
-
shuffle,
|
|
2809
|
-
sleep,
|
|
2810
|
-
slugify,
|
|
2811
|
-
sort,
|
|
2812
|
-
sortBy,
|
|
2813
|
-
splice,
|
|
2814
|
-
splitAt,
|
|
2815
|
-
splitByCase,
|
|
2816
|
-
splitWhen,
|
|
2817
|
-
stringToPath,
|
|
2818
|
-
subtract,
|
|
2819
|
-
sumBy,
|
|
2820
|
-
swapIndices,
|
|
2821
|
-
swapProps,
|
|
2822
|
-
take,
|
|
2823
|
-
takeFirstBy,
|
|
2824
|
-
takeWhile,
|
|
2825
|
-
titleCase,
|
|
2826
|
-
toCamelCase,
|
|
2827
|
-
toFlatCase,
|
|
2828
|
-
toKebabCase,
|
|
2829
|
-
toLowerFirst,
|
|
2830
|
-
toPairs,
|
|
2831
|
-
toPascalCase,
|
|
2832
|
-
toSnakeCase,
|
|
2833
|
-
toTrainCase,
|
|
2834
|
-
toUpperFirst,
|
|
2835
|
-
type,
|
|
2836
|
-
uniq,
|
|
2837
|
-
uniqBy,
|
|
2838
|
-
uniqWith,
|
|
2839
|
-
values,
|
|
2840
|
-
zip,
|
|
2841
|
-
zipObj,
|
|
2842
|
-
zipWith
|
|
2843
|
-
});
|