yummies 5.4.6 → 5.4.8
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/async.cjs +70 -0
- package/async.d.cts +28 -0
- package/async.d.cts.map +1 -0
- package/async.d.ts +28 -0
- package/async.d.ts.map +1 -0
- package/async.js +62 -0
- package/common.cjs +18 -0
- package/common.d.cts +15 -0
- package/common.d.cts.map +1 -0
- package/common.d.ts +15 -0
- package/common.d.ts.map +1 -0
- package/common.js +14 -0
- package/complex/counter.cjs +21 -0
- package/complex/counter.d.cts +15 -0
- package/complex/counter.d.cts.map +1 -0
- package/complex/counter.d.ts +15 -0
- package/complex/counter.d.ts.map +1 -0
- package/complex/counter.js +17 -0
- package/complex/global-config.cjs +46 -0
- package/complex/global-config.d.cts +11 -0
- package/complex/global-config.d.cts.map +1 -0
- package/complex/global-config.d.ts +11 -0
- package/complex/global-config.d.ts.map +1 -0
- package/complex/global-config.js +41 -0
- package/complex/index.cjs +19 -0
- package/complex/index.d.cts +4 -0
- package/complex/index.d.cts.map +1 -0
- package/complex/index.d.ts +4 -0
- package/complex/index.d.ts.map +1 -0
- package/complex/index.js +3 -0
- package/complex/modules-factory.cjs +50 -0
- package/complex/modules-factory.d.cts +49 -0
- package/complex/modules-factory.d.cts.map +1 -0
- package/complex/modules-factory.d.ts +49 -0
- package/complex/modules-factory.d.ts.map +1 -0
- package/complex/modules-factory.js +46 -0
- package/cookie.cjs +13 -0
- package/cookie.d.cts +3 -0
- package/cookie.d.cts.map +1 -0
- package/cookie.d.ts +3 -0
- package/cookie.d.ts.map +1 -0
- package/cookie.js +9 -0
- package/css.cjs +28 -0
- package/css.d.cts +36 -0
- package/css.d.cts.map +1 -0
- package/css.d.ts +36 -0
- package/css.d.ts.map +1 -0
- package/css.js +20 -0
- package/data.cjs +58 -0
- package/data.d.cts +4 -0
- package/data.d.cts.map +1 -0
- package/data.d.ts +4 -0
- package/data.d.ts.map +1 -0
- package/data.js +52 -0
- package/date-time.cjs +171 -0
- package/date-time.d.cts +28 -0
- package/date-time.d.cts.map +1 -0
- package/date-time.d.ts +28 -0
- package/date-time.d.ts.map +1 -0
- package/date-time.js +160 -0
- package/device.cjs +28 -0
- package/device.d.cts +8 -0
- package/device.d.cts.map +1 -0
- package/device.d.ts +8 -0
- package/device.d.ts.map +1 -0
- package/device.js +21 -0
- package/encodings.cjs +270 -0
- package/encodings.d.cts +2 -0
- package/encodings.d.cts.map +1 -0
- package/encodings.d.ts +2 -0
- package/encodings.d.ts.map +1 -0
- package/encodings.js +267 -0
- package/errors.cjs +34 -0
- package/errors.d.cts +19 -0
- package/errors.d.cts.map +1 -0
- package/errors.d.ts +19 -0
- package/errors.d.ts.map +1 -0
- package/errors.js +30 -0
- package/file.cjs +29 -0
- package/file.d.cts +3 -0
- package/file.d.cts.map +1 -0
- package/file.d.ts +3 -0
- package/file.d.ts.map +1 -0
- package/file.js +24 -0
- package/format/_exports.cjs +20 -0
- package/format/_exports.d.cts +5 -0
- package/format/_exports.d.cts.map +1 -0
- package/format/_exports.d.ts +5 -0
- package/format/_exports.d.ts.map +1 -0
- package/format/_exports.js +4 -0
- package/format/constants.cjs +6 -0
- package/format/constants.d.cts +4 -0
- package/format/constants.d.cts.map +1 -0
- package/format/constants.d.ts +4 -0
- package/format/constants.d.ts.map +1 -0
- package/{src/format/constants.ts → format/constants.js} +0 -2
- package/format/index.cjs +40 -0
- package/format/index.d.cts +3 -0
- package/format/index.d.cts.map +1 -0
- package/format/index.d.ts +3 -0
- package/format/index.d.ts.map +1 -0
- package/{src/format/index.ts → format/index.js} +1 -2
- package/format/number.cjs +48 -0
- package/format/number.d.cts +36 -0
- package/format/number.d.cts.map +1 -0
- package/format/number.d.ts +36 -0
- package/format/number.d.ts.map +1 -0
- package/format/number.js +44 -0
- package/format/percent.cjs +27 -0
- package/format/percent.d.cts +15 -0
- package/format/percent.d.cts.map +1 -0
- package/format/percent.d.ts +15 -0
- package/format/percent.d.ts.map +1 -0
- package/format/percent.js +23 -0
- package/format/skip-spaces.cjs +8 -0
- package/format/skip-spaces.d.cts +5 -0
- package/format/skip-spaces.d.cts.map +1 -0
- package/format/skip-spaces.d.ts +5 -0
- package/format/skip-spaces.d.ts.map +1 -0
- package/format/skip-spaces.js +4 -0
- package/html.cjs +202 -0
- package/html.d.cts +44 -0
- package/html.d.cts.map +1 -0
- package/html.d.ts +44 -0
- package/html.d.ts.map +1 -0
- package/html.js +182 -0
- package/id.cjs +76 -0
- package/id.d.cts +63 -0
- package/id.d.cts.map +1 -0
- package/id.d.ts +63 -0
- package/id.d.ts.map +1 -0
- package/{src/id.ts → id.js} +6 -16
- package/imports.cjs +45 -0
- package/imports.d.cts +15 -0
- package/imports.d.cts.map +1 -0
- package/imports.d.ts +15 -0
- package/imports.d.ts.map +1 -0
- package/imports.js +40 -0
- package/math.cjs +23 -0
- package/math.d.cts +13 -0
- package/math.d.cts.map +1 -0
- package/math.d.ts +13 -0
- package/math.d.ts.map +1 -0
- package/math.js +17 -0
- package/media.cjs +115 -0
- package/media.d.cts +20 -0
- package/media.d.cts.map +1 -0
- package/media.d.ts +20 -0
- package/media.d.ts.map +1 -0
- package/media.js +103 -0
- package/mobx/apply-observable.cjs +16 -0
- package/mobx/apply-observable.d.cts +4 -0
- package/mobx/apply-observable.d.cts.map +1 -0
- package/mobx/apply-observable.d.ts +4 -0
- package/mobx/apply-observable.d.ts.map +1 -0
- package/mobx/apply-observable.js +12 -0
- package/mobx/create-enhanced-atom.cjs +16 -0
- package/mobx/create-enhanced-atom.d.cts +11 -0
- package/mobx/create-enhanced-atom.d.cts.map +1 -0
- package/mobx/create-enhanced-atom.d.ts +11 -0
- package/mobx/create-enhanced-atom.d.ts.map +1 -0
- package/mobx/create-enhanced-atom.js +12 -0
- package/mobx/deep-observable-struct.cjs +61 -0
- package/mobx/deep-observable-struct.d.cts +7 -0
- package/mobx/deep-observable-struct.d.cts.map +1 -0
- package/mobx/deep-observable-struct.d.ts +7 -0
- package/mobx/deep-observable-struct.d.ts.map +1 -0
- package/mobx/deep-observable-struct.js +57 -0
- package/mobx/get-mobx-administration.cjs +6 -0
- package/mobx/get-mobx-administration.d.cts +6 -0
- package/mobx/get-mobx-administration.d.cts.map +1 -0
- package/mobx/get-mobx-administration.d.ts +6 -0
- package/mobx/get-mobx-administration.d.ts.map +1 -0
- package/mobx/get-mobx-administration.js +2 -0
- package/mobx/index.cjs +21 -0
- package/mobx/index.d.cts +6 -0
- package/mobx/index.d.cts.map +1 -0
- package/mobx/index.d.ts +6 -0
- package/mobx/index.d.ts.map +1 -0
- package/mobx/index.js +5 -0
- package/mobx/lazy-observe.cjs +47 -0
- package/mobx/lazy-observe.d.cts +8 -0
- package/mobx/lazy-observe.d.cts.map +1 -0
- package/mobx/lazy-observe.d.ts +8 -0
- package/mobx/lazy-observe.d.ts.map +1 -0
- package/mobx/lazy-observe.js +43 -0
- package/ms.cjs +22 -0
- package/ms.d.cts +19 -0
- package/ms.d.cts.map +1 -0
- package/ms.d.ts +19 -0
- package/ms.d.ts.map +1 -0
- package/ms.js +18 -0
- package/number.cjs +16 -0
- package/number.d.cts +8 -0
- package/number.d.cts.map +1 -0
- package/number.d.ts +8 -0
- package/number.d.ts.map +1 -0
- package/number.js +13 -0
- package/package.json +163 -5
- package/parser/_exports.cjs +19 -0
- package/parser/_exports.d.cts +4 -0
- package/parser/_exports.d.cts.map +1 -0
- package/parser/_exports.d.ts +4 -0
- package/parser/_exports.d.ts.map +1 -0
- package/parser/_exports.js +3 -0
- package/parser/index.cjs +40 -0
- package/parser/index.d.cts +3 -0
- package/parser/index.d.cts.map +1 -0
- package/parser/index.d.ts +3 -0
- package/parser/index.d.ts.map +1 -0
- package/{src/parser/index.ts → parser/index.js} +1 -2
- package/parser/number.cjs +48 -0
- package/parser/number.d.cts +21 -0
- package/parser/number.d.cts.map +1 -0
- package/parser/number.d.ts +21 -0
- package/parser/number.d.ts.map +1 -0
- package/parser/number.js +44 -0
- package/parser/percent.cjs +8 -0
- package/parser/percent.d.cts +4 -0
- package/parser/percent.d.cts.map +1 -0
- package/parser/percent.d.ts +4 -0
- package/parser/percent.d.ts.map +1 -0
- package/parser/percent.js +4 -0
- package/parser/string.cjs +18 -0
- package/parser/string.d.cts +7 -0
- package/parser/string.d.cts.map +1 -0
- package/parser/string.d.ts +7 -0
- package/parser/string.d.ts.map +1 -0
- package/parser/string.js +14 -0
- package/price.cjs +21 -0
- package/price.d.cts +6 -0
- package/price.d.cts.map +1 -0
- package/price.d.ts +6 -0
- package/price.d.ts.map +1 -0
- package/price.js +17 -0
- package/random.cjs +25 -0
- package/random.d.cts +9 -0
- package/random.d.cts.map +1 -0
- package/random.d.ts +9 -0
- package/random.d.ts.map +1 -0
- package/random.js +14 -0
- package/react/hooks/index.cjs +37 -0
- package/react/hooks/index.d.cts +22 -0
- package/react/hooks/index.d.cts.map +1 -0
- package/react/hooks/index.d.ts +22 -0
- package/react/hooks/index.d.ts.map +1 -0
- package/react/hooks/index.js +21 -0
- package/react/hooks/use-abort-controller.cjs +15 -0
- package/react/hooks/use-abort-controller.d.cts +2 -0
- package/react/hooks/use-abort-controller.d.cts.map +1 -0
- package/react/hooks/use-abort-controller.d.ts +2 -0
- package/react/hooks/use-abort-controller.d.ts.map +1 -0
- package/react/hooks/use-abort-controller.js +11 -0
- package/react/hooks/use-abort-signal.cjs +8 -0
- package/react/hooks/use-abort-signal.d.cts +2 -0
- package/react/hooks/use-abort-signal.d.cts.map +1 -0
- package/react/hooks/use-abort-signal.d.ts +2 -0
- package/react/hooks/use-abort-signal.d.ts.map +1 -0
- package/react/hooks/use-abort-signal.js +4 -0
- package/react/hooks/use-click-outside.cjs +17 -0
- package/react/hooks/use-click-outside.d.cts +9 -0
- package/react/hooks/use-click-outside.d.cts.map +1 -0
- package/react/hooks/use-click-outside.d.ts +9 -0
- package/react/hooks/use-click-outside.d.ts.map +1 -0
- package/react/hooks/use-click-outside.js +13 -0
- package/react/hooks/use-constant.cjs +19 -0
- package/react/hooks/use-constant.d.cts +9 -0
- package/react/hooks/use-constant.d.cts.map +1 -0
- package/react/hooks/use-constant.d.ts +9 -0
- package/react/hooks/use-constant.d.ts.map +1 -0
- package/{src/react/hooks/use-constant.ts → react/hooks/use-constant.js} +6 -9
- package/react/hooks/use-define-ref.cjs +19 -0
- package/react/hooks/use-define-ref.d.cts +10 -0
- package/react/hooks/use-define-ref.d.cts.map +1 -0
- package/react/hooks/use-define-ref.d.ts +10 -0
- package/react/hooks/use-define-ref.d.ts.map +1 -0
- package/{src/react/hooks/use-define-ref.ts → react/hooks/use-define-ref.js} +7 -10
- package/react/hooks/use-element-ref.cjs +12 -0
- package/react/hooks/use-element-ref.d.cts +2 -0
- package/react/hooks/use-element-ref.d.cts.map +1 -0
- package/react/hooks/use-element-ref.d.ts +2 -0
- package/react/hooks/use-element-ref.d.ts.map +1 -0
- package/react/hooks/use-element-ref.js +8 -0
- package/react/hooks/use-event-listener.cjs +17 -0
- package/react/hooks/use-event-listener.d.cts +8 -0
- package/react/hooks/use-event-listener.d.cts.map +1 -0
- package/react/hooks/use-event-listener.d.ts +8 -0
- package/react/hooks/use-event-listener.d.ts.map +1 -0
- package/react/hooks/use-event-listener.js +13 -0
- package/react/hooks/use-event.cjs +23 -0
- package/react/hooks/use-event.d.cts +3 -0
- package/react/hooks/use-event.d.cts.map +1 -0
- package/react/hooks/use-event.d.ts +3 -0
- package/react/hooks/use-event.d.ts.map +1 -0
- package/react/hooks/use-event.js +19 -0
- package/react/hooks/use-flag.cjs +19 -0
- package/react/hooks/use-flag.d.cts +8 -0
- package/react/hooks/use-flag.d.cts.map +1 -0
- package/react/hooks/use-flag.d.ts +8 -0
- package/react/hooks/use-flag.d.ts.map +1 -0
- package/react/hooks/use-flag.js +15 -0
- package/react/hooks/use-force-update.cjs +11 -0
- package/react/hooks/use-force-update.d.cts +2 -0
- package/react/hooks/use-force-update.d.cts.map +1 -0
- package/react/hooks/use-force-update.d.ts +2 -0
- package/react/hooks/use-force-update.d.ts.map +1 -0
- package/react/hooks/use-force-update.js +7 -0
- package/react/hooks/use-initial-height.cjs +15 -0
- package/react/hooks/use-initial-height.d.cts +5 -0
- package/react/hooks/use-initial-height.d.cts.map +1 -0
- package/react/hooks/use-initial-height.d.ts +5 -0
- package/react/hooks/use-initial-height.d.ts.map +1 -0
- package/react/hooks/use-initial-height.js +11 -0
- package/react/hooks/use-instance.cjs +31 -0
- package/react/hooks/use-instance.d.cts +27 -0
- package/react/hooks/use-instance.d.cts.map +1 -0
- package/react/hooks/use-instance.d.ts +27 -0
- package/react/hooks/use-instance.d.ts.map +1 -0
- package/{src/react/hooks/use-instance.ts → react/hooks/use-instance.js} +9 -31
- package/react/hooks/use-intersection-observer.cjs +14 -0
- package/react/hooks/use-intersection-observer.d.cts +2 -0
- package/react/hooks/use-intersection-observer.d.cts.map +1 -0
- package/react/hooks/use-intersection-observer.d.ts +2 -0
- package/react/hooks/use-intersection-observer.d.ts.map +1 -0
- package/react/hooks/use-intersection-observer.js +10 -0
- package/react/hooks/use-last-defined-value.cjs +12 -0
- package/react/hooks/use-last-defined-value.d.cts +2 -0
- package/react/hooks/use-last-defined-value.d.cts.map +1 -0
- package/react/hooks/use-last-defined-value.d.ts +2 -0
- package/react/hooks/use-last-defined-value.d.ts.map +1 -0
- package/react/hooks/use-last-defined-value.js +8 -0
- package/react/hooks/use-last-value-ref.cjs +12 -0
- package/react/hooks/use-last-value-ref.d.cts +2 -0
- package/react/hooks/use-last-value-ref.d.cts.map +1 -0
- package/react/hooks/use-last-value-ref.d.ts +2 -0
- package/react/hooks/use-last-value-ref.d.ts.map +1 -0
- package/react/hooks/use-last-value-ref.js +8 -0
- package/react/hooks/use-life-cycle.cjs +14 -0
- package/react/hooks/use-life-cycle.d.cts +5 -0
- package/react/hooks/use-life-cycle.d.cts.map +1 -0
- package/react/hooks/use-life-cycle.d.ts +5 -0
- package/react/hooks/use-life-cycle.d.ts.map +1 -0
- package/react/hooks/use-life-cycle.js +10 -0
- package/react/hooks/use-resize-observer.cjs +15 -0
- package/react/hooks/use-resize-observer.d.cts +2 -0
- package/react/hooks/use-resize-observer.d.cts.map +1 -0
- package/react/hooks/use-resize-observer.d.ts +2 -0
- package/react/hooks/use-resize-observer.d.ts.map +1 -0
- package/react/hooks/use-resize-observer.js +11 -0
- package/react/hooks/use-sync-ref.cjs +10 -0
- package/react/hooks/use-sync-ref.d.cts +2 -0
- package/react/hooks/use-sync-ref.d.cts.map +1 -0
- package/react/hooks/use-sync-ref.d.ts +2 -0
- package/react/hooks/use-sync-ref.d.ts.map +1 -0
- package/react/hooks/use-sync-ref.js +6 -0
- package/react/hooks/use-toggle.cjs +10 -0
- package/react/hooks/use-toggle.d.cts +2 -0
- package/react/hooks/use-toggle.d.cts.map +1 -0
- package/react/hooks/use-toggle.d.ts +2 -0
- package/react/hooks/use-toggle.d.ts.map +1 -0
- package/react/hooks/use-toggle.js +6 -0
- package/react/hooks/use-value.cjs +12 -0
- package/react/hooks/use-value.d.cts +5 -0
- package/react/hooks/use-value.d.cts.map +1 -0
- package/react/hooks/use-value.d.ts +5 -0
- package/react/hooks/use-value.d.ts.map +1 -0
- package/react/hooks/use-value.js +8 -0
- package/react/hooks/use-visibility-state.cjs +18 -0
- package/react/hooks/use-visibility-state.d.cts +2 -0
- package/react/hooks/use-visibility-state.d.cts.map +1 -0
- package/react/hooks/use-visibility-state.d.ts +2 -0
- package/react/hooks/use-visibility-state.d.ts.map +1 -0
- package/react/hooks/use-visibility-state.js +14 -0
- package/react/index.cjs +17 -0
- package/react/index.d.cts +2 -0
- package/react/index.d.cts.map +1 -0
- package/react/index.d.ts +2 -0
- package/react/index.d.ts.map +1 -0
- package/react/index.js +1 -0
- package/sound.cjs +16 -0
- package/sound.d.cts +7 -0
- package/sound.d.cts.map +1 -0
- package/sound.d.ts +7 -0
- package/sound.d.ts.map +1 -0
- package/sound.js +12 -0
- package/storage.cjs +48 -0
- package/storage.d.cts +39 -0
- package/storage.d.cts.map +1 -0
- package/storage.d.ts +39 -0
- package/storage.d.ts.map +1 -0
- package/storage.js +43 -0
- package/text.cjs +53 -0
- package/text.d.cts +15 -0
- package/text.d.cts.map +1 -0
- package/text.d.ts +15 -0
- package/text.d.ts.map +1 -0
- package/text.js +48 -0
- package/type-guard/_exports.cjs +129 -0
- package/type-guard/_exports.d.cts +86 -0
- package/type-guard/_exports.d.cts.map +1 -0
- package/type-guard/_exports.d.ts +86 -0
- package/type-guard/_exports.d.ts.map +1 -0
- package/type-guard/_exports.js +125 -0
- package/type-guard/index.cjs +40 -0
- package/type-guard/index.d.cts +3 -0
- package/type-guard/index.d.cts.map +1 -0
- package/type-guard/index.d.ts +3 -0
- package/type-guard/index.d.ts.map +1 -0
- package/{src/type-guard/index.ts → type-guard/index.js} +1 -2
- package/utility-types.d.ts +396 -0
- package/utils/types.cjs +2 -0
- package/utils/types.d.cts +395 -0
- package/utils/types.d.cts.map +1 -0
- package/utils/types.d.ts +395 -0
- package/utils/types.d.ts.map +1 -0
- package/utils/types.js +1 -0
- package/vibrate.cjs +12 -0
- package/vibrate.d.cts +5 -0
- package/vibrate.d.cts.map +1 -0
- package/vibrate.d.ts +5 -0
- package/vibrate.d.ts.map +1 -0
- package/vibrate.js +8 -0
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.github/FUNDING.yml +0 -1
- package/.github/workflows/main.yml +0 -34
- package/.github/workflows/version-or-publish.yml +0 -45
- package/.nvmrc +0 -1
- package/.vscode/settings.json +0 -19
- package/CHANGELOG.md +0 -215
- package/CONTRIBUTING.md +0 -8
- package/Makefile +0 -7
- package/biome.json +0 -3
- package/commitfmt.toml +0 -18
- package/lefthook.yml +0 -14
- package/scripts/post-build.ts +0 -71
- package/src/async.ts +0 -86
- package/src/common.ts +0 -26
- package/src/complex/counter.test.ts +0 -41
- package/src/complex/counter.ts +0 -40
- package/src/complex/global-config.ts +0 -55
- package/src/complex/index.ts +0 -3
- package/src/complex/modules-factory.ts +0 -65
- package/src/cookie.ts +0 -11
- package/src/css.ts +0 -60
- package/src/data.test.ts +0 -99
- package/src/data.ts +0 -65
- package/src/date-time.test.ts +0 -119
- package/src/date-time.ts +0 -236
- package/src/device.ts +0 -42
- package/src/encodings.ts +0 -270
- package/src/errors.ts +0 -40
- package/src/file.ts +0 -25
- package/src/format/_exports.ts +0 -4
- package/src/format/number.test.ts +0 -16
- package/src/format/number.ts +0 -96
- package/src/format/percent.ts +0 -40
- package/src/format/skip-spaces.ts +0 -4
- package/src/html.ts +0 -238
- package/src/imports.ts +0 -52
- package/src/math.ts +0 -20
- package/src/media.ts +0 -134
- package/src/mobx/apply-observable.ts +0 -20
- package/src/mobx/create-enhanced-atom.ts +0 -28
- package/src/mobx/deep-observable-struct.test.ts +0 -69
- package/src/mobx/deep-observable-struct.ts +0 -69
- package/src/mobx/get-mobx-administration.ts +0 -10
- package/src/mobx/index.ts +0 -5
- package/src/mobx/lazy-observe.ts +0 -59
- package/src/ms.ts +0 -20
- package/src/number.ts +0 -14
- package/src/parser/_exports.ts +0 -3
- package/src/parser/number.test.ts +0 -38
- package/src/parser/number.ts +0 -73
- package/src/parser/percent.ts +0 -11
- package/src/parser/string.ts +0 -29
- package/src/price.ts +0 -33
- package/src/random.ts +0 -27
- package/src/react/hooks/index.ts +0 -21
- package/src/react/hooks/use-abort-controller.ts +0 -15
- package/src/react/hooks/use-abort-signal.ts +0 -5
- package/src/react/hooks/use-click-outside.ts +0 -27
- package/src/react/hooks/use-element-ref.ts +0 -11
- package/src/react/hooks/use-event-listener.ts +0 -29
- package/src/react/hooks/use-event.ts +0 -23
- package/src/react/hooks/use-flag.ts +0 -27
- package/src/react/hooks/use-force-update.ts +0 -9
- package/src/react/hooks/use-initial-height.ts +0 -16
- package/src/react/hooks/use-intersection-observer.ts +0 -18
- package/src/react/hooks/use-last-defined-value.ts +0 -9
- package/src/react/hooks/use-last-value-ref.ts +0 -11
- package/src/react/hooks/use-life-cycle.ts +0 -17
- package/src/react/hooks/use-resize-observer.ts +0 -14
- package/src/react/hooks/use-sync-ref.ts +0 -7
- package/src/react/hooks/use-toggle.ts +0 -9
- package/src/react/hooks/use-value.ts +0 -10
- package/src/react/hooks/use-visibility-state.ts +0 -19
- package/src/react/index.ts +0 -1
- package/src/sound.ts +0 -15
- package/src/storage.ts +0 -137
- package/src/text.test.ts +0 -91
- package/src/text.ts +0 -60
- package/src/type-guard/_exports.ts +0 -154
- package/src/type-guard/index.test.ts +0 -127
- package/src/vibrate.ts +0 -8
- package/tsconfig.json +0 -26
- package/tsconfig.test.json +0 -33
- package/vitest.config.ts +0 -20
package/encodings.js
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
const DMap = {
|
|
2
|
+
0: 0,
|
|
3
|
+
1: 1,
|
|
4
|
+
2: 2,
|
|
5
|
+
3: 3,
|
|
6
|
+
4: 4,
|
|
7
|
+
5: 5,
|
|
8
|
+
6: 6,
|
|
9
|
+
7: 7,
|
|
10
|
+
8: 8,
|
|
11
|
+
9: 9,
|
|
12
|
+
10: 10,
|
|
13
|
+
11: 11,
|
|
14
|
+
12: 12,
|
|
15
|
+
13: 13,
|
|
16
|
+
14: 14,
|
|
17
|
+
15: 15,
|
|
18
|
+
16: 16,
|
|
19
|
+
17: 17,
|
|
20
|
+
18: 18,
|
|
21
|
+
19: 19,
|
|
22
|
+
20: 20,
|
|
23
|
+
21: 21,
|
|
24
|
+
22: 22,
|
|
25
|
+
23: 23,
|
|
26
|
+
24: 24,
|
|
27
|
+
25: 25,
|
|
28
|
+
26: 26,
|
|
29
|
+
27: 27,
|
|
30
|
+
28: 28,
|
|
31
|
+
29: 29,
|
|
32
|
+
30: 30,
|
|
33
|
+
31: 31,
|
|
34
|
+
32: 32,
|
|
35
|
+
33: 33,
|
|
36
|
+
34: 34,
|
|
37
|
+
35: 35,
|
|
38
|
+
36: 36,
|
|
39
|
+
37: 37,
|
|
40
|
+
38: 38,
|
|
41
|
+
39: 39,
|
|
42
|
+
40: 40,
|
|
43
|
+
41: 41,
|
|
44
|
+
42: 42,
|
|
45
|
+
43: 43,
|
|
46
|
+
44: 44,
|
|
47
|
+
45: 45,
|
|
48
|
+
46: 46,
|
|
49
|
+
47: 47,
|
|
50
|
+
48: 48,
|
|
51
|
+
49: 49,
|
|
52
|
+
50: 50,
|
|
53
|
+
51: 51,
|
|
54
|
+
52: 52,
|
|
55
|
+
53: 53,
|
|
56
|
+
54: 54,
|
|
57
|
+
55: 55,
|
|
58
|
+
56: 56,
|
|
59
|
+
57: 57,
|
|
60
|
+
58: 58,
|
|
61
|
+
59: 59,
|
|
62
|
+
60: 60,
|
|
63
|
+
61: 61,
|
|
64
|
+
62: 62,
|
|
65
|
+
63: 63,
|
|
66
|
+
64: 64,
|
|
67
|
+
65: 65,
|
|
68
|
+
66: 66,
|
|
69
|
+
67: 67,
|
|
70
|
+
68: 68,
|
|
71
|
+
69: 69,
|
|
72
|
+
70: 70,
|
|
73
|
+
71: 71,
|
|
74
|
+
72: 72,
|
|
75
|
+
73: 73,
|
|
76
|
+
74: 74,
|
|
77
|
+
75: 75,
|
|
78
|
+
76: 76,
|
|
79
|
+
77: 77,
|
|
80
|
+
78: 78,
|
|
81
|
+
79: 79,
|
|
82
|
+
80: 80,
|
|
83
|
+
81: 81,
|
|
84
|
+
82: 82,
|
|
85
|
+
83: 83,
|
|
86
|
+
84: 84,
|
|
87
|
+
85: 85,
|
|
88
|
+
86: 86,
|
|
89
|
+
87: 87,
|
|
90
|
+
88: 88,
|
|
91
|
+
89: 89,
|
|
92
|
+
90: 90,
|
|
93
|
+
91: 91,
|
|
94
|
+
92: 92,
|
|
95
|
+
93: 93,
|
|
96
|
+
94: 94,
|
|
97
|
+
95: 95,
|
|
98
|
+
96: 96,
|
|
99
|
+
97: 97,
|
|
100
|
+
98: 98,
|
|
101
|
+
99: 99,
|
|
102
|
+
100: 100,
|
|
103
|
+
101: 101,
|
|
104
|
+
102: 102,
|
|
105
|
+
103: 103,
|
|
106
|
+
104: 104,
|
|
107
|
+
105: 105,
|
|
108
|
+
106: 106,
|
|
109
|
+
107: 107,
|
|
110
|
+
108: 108,
|
|
111
|
+
109: 109,
|
|
112
|
+
110: 110,
|
|
113
|
+
111: 111,
|
|
114
|
+
112: 112,
|
|
115
|
+
113: 113,
|
|
116
|
+
114: 114,
|
|
117
|
+
115: 115,
|
|
118
|
+
116: 116,
|
|
119
|
+
117: 117,
|
|
120
|
+
118: 118,
|
|
121
|
+
119: 119,
|
|
122
|
+
120: 120,
|
|
123
|
+
121: 121,
|
|
124
|
+
122: 122,
|
|
125
|
+
123: 123,
|
|
126
|
+
124: 124,
|
|
127
|
+
125: 125,
|
|
128
|
+
126: 126,
|
|
129
|
+
127: 127,
|
|
130
|
+
1027: 129,
|
|
131
|
+
8225: 135,
|
|
132
|
+
1046: 198,
|
|
133
|
+
8222: 132,
|
|
134
|
+
1047: 199,
|
|
135
|
+
1168: 165,
|
|
136
|
+
1048: 200,
|
|
137
|
+
1113: 154,
|
|
138
|
+
1049: 201,
|
|
139
|
+
1045: 197,
|
|
140
|
+
1050: 202,
|
|
141
|
+
1028: 170,
|
|
142
|
+
160: 160,
|
|
143
|
+
1040: 192,
|
|
144
|
+
1051: 203,
|
|
145
|
+
164: 164,
|
|
146
|
+
166: 166,
|
|
147
|
+
167: 167,
|
|
148
|
+
169: 169,
|
|
149
|
+
171: 171,
|
|
150
|
+
172: 172,
|
|
151
|
+
173: 173,
|
|
152
|
+
174: 174,
|
|
153
|
+
1053: 205,
|
|
154
|
+
176: 176,
|
|
155
|
+
177: 177,
|
|
156
|
+
1114: 156,
|
|
157
|
+
181: 181,
|
|
158
|
+
182: 182,
|
|
159
|
+
183: 183,
|
|
160
|
+
8221: 148,
|
|
161
|
+
187: 187,
|
|
162
|
+
1029: 189,
|
|
163
|
+
1056: 208,
|
|
164
|
+
1057: 209,
|
|
165
|
+
1058: 210,
|
|
166
|
+
8364: 136,
|
|
167
|
+
1112: 188,
|
|
168
|
+
1115: 158,
|
|
169
|
+
1059: 211,
|
|
170
|
+
1060: 212,
|
|
171
|
+
1030: 178,
|
|
172
|
+
1061: 213,
|
|
173
|
+
1062: 214,
|
|
174
|
+
1063: 215,
|
|
175
|
+
1116: 157,
|
|
176
|
+
1064: 216,
|
|
177
|
+
1065: 217,
|
|
178
|
+
1031: 175,
|
|
179
|
+
1066: 218,
|
|
180
|
+
1067: 219,
|
|
181
|
+
1068: 220,
|
|
182
|
+
1069: 221,
|
|
183
|
+
1070: 222,
|
|
184
|
+
1032: 163,
|
|
185
|
+
8226: 149,
|
|
186
|
+
1071: 223,
|
|
187
|
+
1072: 224,
|
|
188
|
+
8482: 153,
|
|
189
|
+
1073: 225,
|
|
190
|
+
8240: 137,
|
|
191
|
+
1118: 162,
|
|
192
|
+
1074: 226,
|
|
193
|
+
1110: 179,
|
|
194
|
+
8230: 133,
|
|
195
|
+
1075: 227,
|
|
196
|
+
1033: 138,
|
|
197
|
+
1076: 228,
|
|
198
|
+
1077: 229,
|
|
199
|
+
8211: 150,
|
|
200
|
+
1078: 230,
|
|
201
|
+
1119: 159,
|
|
202
|
+
1079: 231,
|
|
203
|
+
1042: 194,
|
|
204
|
+
1080: 232,
|
|
205
|
+
1034: 140,
|
|
206
|
+
1025: 168,
|
|
207
|
+
1081: 233,
|
|
208
|
+
1082: 234,
|
|
209
|
+
8212: 151,
|
|
210
|
+
1083: 235,
|
|
211
|
+
1169: 180,
|
|
212
|
+
1084: 236,
|
|
213
|
+
1052: 204,
|
|
214
|
+
1085: 237,
|
|
215
|
+
1035: 142,
|
|
216
|
+
1086: 238,
|
|
217
|
+
1087: 239,
|
|
218
|
+
1088: 240,
|
|
219
|
+
1089: 241,
|
|
220
|
+
1090: 242,
|
|
221
|
+
1036: 141,
|
|
222
|
+
1041: 193,
|
|
223
|
+
1091: 243,
|
|
224
|
+
1092: 244,
|
|
225
|
+
8224: 134,
|
|
226
|
+
1093: 245,
|
|
227
|
+
8470: 185,
|
|
228
|
+
1094: 246,
|
|
229
|
+
1054: 206,
|
|
230
|
+
1095: 247,
|
|
231
|
+
1096: 248,
|
|
232
|
+
8249: 139,
|
|
233
|
+
1097: 249,
|
|
234
|
+
1098: 250,
|
|
235
|
+
1044: 196,
|
|
236
|
+
1099: 251,
|
|
237
|
+
1111: 191,
|
|
238
|
+
1055: 207,
|
|
239
|
+
1100: 252,
|
|
240
|
+
1038: 161,
|
|
241
|
+
8220: 147,
|
|
242
|
+
1101: 253,
|
|
243
|
+
8250: 155,
|
|
244
|
+
1102: 254,
|
|
245
|
+
8216: 145,
|
|
246
|
+
1103: 255,
|
|
247
|
+
1043: 195,
|
|
248
|
+
1105: 184,
|
|
249
|
+
1039: 143,
|
|
250
|
+
1026: 128,
|
|
251
|
+
1106: 144,
|
|
252
|
+
8218: 130,
|
|
253
|
+
1107: 131,
|
|
254
|
+
8217: 146,
|
|
255
|
+
1108: 186,
|
|
256
|
+
1109: 190,
|
|
257
|
+
};
|
|
258
|
+
export function unicodeToWin1251(s) {
|
|
259
|
+
const L = [];
|
|
260
|
+
for (let i = 0; i < s.length; i++) {
|
|
261
|
+
const ord = s.charCodeAt(i);
|
|
262
|
+
if (!(ord in DMap))
|
|
263
|
+
throw new Error(`Character ${s.charAt(i)} isn't supported by win1251!`);
|
|
264
|
+
L.push(String.fromCharCode(DMap[ord]));
|
|
265
|
+
}
|
|
266
|
+
return L.join('');
|
|
267
|
+
}
|
package/errors.cjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getErrorText = void 0;
|
|
4
|
+
const index_js_1 = require("./type-guard/index.cjs");
|
|
5
|
+
/**
|
|
6
|
+
* Universal function for transforming any errors into readable error text
|
|
7
|
+
*
|
|
8
|
+
* This function can be enhanced with custom handlers using:
|
|
9
|
+
* - `getErrorText.unknownErrorText`
|
|
10
|
+
* - `getErrorText.formatError`
|
|
11
|
+
* - `getErrorText.enhance`
|
|
12
|
+
*/
|
|
13
|
+
const getErrorText = (error) => {
|
|
14
|
+
if (!error) {
|
|
15
|
+
return exports.getErrorText.unknownErrorText;
|
|
16
|
+
}
|
|
17
|
+
if (index_js_1.typeGuard.isString(error)) {
|
|
18
|
+
return error || exports.getErrorText.unknownErrorText;
|
|
19
|
+
}
|
|
20
|
+
if (error instanceof Error) {
|
|
21
|
+
return ((exports.getErrorText.formatError?.(error) ?? error.message) ||
|
|
22
|
+
exports.getErrorText.unknownErrorText);
|
|
23
|
+
}
|
|
24
|
+
if (exports.getErrorText.enhance) {
|
|
25
|
+
return exports.getErrorText.enhance(error) ?? exports.getErrorText.unknownErrorText;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return exports.getErrorText.unknownErrorText;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.getErrorText = getErrorText;
|
|
32
|
+
exports.getErrorText.unknownErrorText = '';
|
|
33
|
+
exports.getErrorText.formatError = null;
|
|
34
|
+
exports.getErrorText.enhance = null;
|
package/errors.d.cts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Maybe } from "./utils/types.cjs";
|
|
2
|
+
type GetErrorTextEnhancer = (error: any) => string;
|
|
3
|
+
type GetErrorTextFormatErrorFn = (error: Error) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Universal function for transforming any errors into readable error text
|
|
6
|
+
*
|
|
7
|
+
* This function can be enhanced with custom handlers using:
|
|
8
|
+
* - `getErrorText.unknownErrorText`
|
|
9
|
+
* - `getErrorText.formatError`
|
|
10
|
+
* - `getErrorText.enhance`
|
|
11
|
+
*/
|
|
12
|
+
export declare const getErrorText: {
|
|
13
|
+
(error: unknown): string;
|
|
14
|
+
unknownErrorText: string;
|
|
15
|
+
formatError: Maybe<GetErrorTextFormatErrorFn>;
|
|
16
|
+
enhance: Maybe<GetErrorTextEnhancer>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=errors.d.ts.map
|
package/errors.d.cts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,0BAAyB;AAE9C,KAAK,oBAAoB,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAC;AACnD,KAAK,yBAAyB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;YAAW,OAAO;;;;CAqB1C,CAAC"}
|
package/errors.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Maybe } from "./utils/types.js";
|
|
2
|
+
type GetErrorTextEnhancer = (error: any) => string;
|
|
3
|
+
type GetErrorTextFormatErrorFn = (error: Error) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Universal function for transforming any errors into readable error text
|
|
6
|
+
*
|
|
7
|
+
* This function can be enhanced with custom handlers using:
|
|
8
|
+
* - `getErrorText.unknownErrorText`
|
|
9
|
+
* - `getErrorText.formatError`
|
|
10
|
+
* - `getErrorText.enhance`
|
|
11
|
+
*/
|
|
12
|
+
export declare const getErrorText: {
|
|
13
|
+
(error: unknown): string;
|
|
14
|
+
unknownErrorText: string;
|
|
15
|
+
formatError: Maybe<GetErrorTextFormatErrorFn>;
|
|
16
|
+
enhance: Maybe<GetErrorTextEnhancer>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=errors.d.ts.map
|
package/errors.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,yBAAyB;AAE9C,KAAK,oBAAoB,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,CAAC;AACnD,KAAK,yBAAyB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAAC;AAE1D;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY;YAAW,OAAO;;;;CAqB1C,CAAC"}
|
package/errors.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { typeGuard } from "./type-guard/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Universal function for transforming any errors into readable error text
|
|
4
|
+
*
|
|
5
|
+
* This function can be enhanced with custom handlers using:
|
|
6
|
+
* - `getErrorText.unknownErrorText`
|
|
7
|
+
* - `getErrorText.formatError`
|
|
8
|
+
* - `getErrorText.enhance`
|
|
9
|
+
*/
|
|
10
|
+
export const getErrorText = (error) => {
|
|
11
|
+
if (!error) {
|
|
12
|
+
return getErrorText.unknownErrorText;
|
|
13
|
+
}
|
|
14
|
+
if (typeGuard.isString(error)) {
|
|
15
|
+
return error || getErrorText.unknownErrorText;
|
|
16
|
+
}
|
|
17
|
+
if (error instanceof Error) {
|
|
18
|
+
return ((getErrorText.formatError?.(error) ?? error.message) ||
|
|
19
|
+
getErrorText.unknownErrorText);
|
|
20
|
+
}
|
|
21
|
+
if (getErrorText.enhance) {
|
|
22
|
+
return getErrorText.enhance(error) ?? getErrorText.unknownErrorText;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return getErrorText.unknownErrorText;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
getErrorText.unknownErrorText = '';
|
|
29
|
+
getErrorText.formatError = null;
|
|
30
|
+
getErrorText.enhance = null;
|
package/file.cjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTextFromFile = exports.getBase64FromFile = void 0;
|
|
4
|
+
const getBase64FromFile = (file) => {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
const reader = new FileReader();
|
|
7
|
+
reader.readAsDataURL(file);
|
|
8
|
+
reader.onload = () => {
|
|
9
|
+
resolve(reader.result.toString());
|
|
10
|
+
};
|
|
11
|
+
reader.onerror = (error) => {
|
|
12
|
+
reject(error);
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
exports.getBase64FromFile = getBase64FromFile;
|
|
17
|
+
const getTextFromFile = (file, encoding) => {
|
|
18
|
+
return new Promise((resolve, reject) => {
|
|
19
|
+
const reader = new FileReader();
|
|
20
|
+
reader.readAsText(file, encoding);
|
|
21
|
+
reader.onload = () => {
|
|
22
|
+
resolve(reader.result.toString());
|
|
23
|
+
};
|
|
24
|
+
reader.onerror = (error) => {
|
|
25
|
+
reject(error);
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
exports.getTextFromFile = getTextFromFile;
|
package/file.d.cts
ADDED
package/file.d.cts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,GAAI,MAAM,IAAI,oBAW3C,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,IAAI,EAAE,WAAW,MAAM,oBAW5D,CAAC"}
|
package/file.d.ts
ADDED
package/file.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../src/file.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,GAAI,MAAM,IAAI,oBAW3C,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,IAAI,EAAE,WAAW,MAAM,oBAW5D,CAAC"}
|
package/file.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const getBase64FromFile = (file) => {
|
|
2
|
+
return new Promise((resolve, reject) => {
|
|
3
|
+
const reader = new FileReader();
|
|
4
|
+
reader.readAsDataURL(file);
|
|
5
|
+
reader.onload = () => {
|
|
6
|
+
resolve(reader.result.toString());
|
|
7
|
+
};
|
|
8
|
+
reader.onerror = (error) => {
|
|
9
|
+
reject(error);
|
|
10
|
+
};
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export const getTextFromFile = (file, encoding) => {
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
const reader = new FileReader();
|
|
16
|
+
reader.readAsText(file, encoding);
|
|
17
|
+
reader.onload = () => {
|
|
18
|
+
resolve(reader.result.toString());
|
|
19
|
+
};
|
|
20
|
+
reader.onerror = (error) => {
|
|
21
|
+
reject(error);
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants.cjs"), exports);
|
|
18
|
+
__exportStar(require("./number.cjs"), exports);
|
|
19
|
+
__exportStar(require("./percent.cjs"), exports);
|
|
20
|
+
__exportStar(require("./skip-spaces.cjs"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_exports.d.ts","sourceRoot":"","sources":["../../src/format/_exports.ts"],"names":[],"mappings":"AAAA,gCAA+B;AAC/B,6BAA4B;AAC5B,8BAA6B;AAC7B,kCAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_exports.d.ts","sourceRoot":"","sources":["../../src/format/_exports.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,4BAA4B;AAC5B,6BAA6B;AAC7B,iCAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/format/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,WAAM,CAAC;AAE5B,eAAO,MAAM,MAAM,MAAM,CAAC;AAE1B,eAAO,MAAM,QAAQ,WAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/format/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,WAAM,CAAC;AAE5B,eAAO,MAAM,MAAM,MAAM,CAAC;AAE1B,eAAO,MAAM,QAAQ,WAAM,CAAC"}
|
package/format/index.cjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.format = void 0;
|
|
37
|
+
// This way is more treeshakable than collecting
|
|
38
|
+
// it into one exportable object export const format
|
|
39
|
+
const format = __importStar(require("./_exports.cjs"));
|
|
40
|
+
exports.format = format;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,uBAAsB;AAExC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/format/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,sBAAsB;AAExC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.number = void 0;
|
|
4
|
+
const number_js_1 = require("../parser/number.cjs");
|
|
5
|
+
const index_js_1 = require("../type-guard/index.cjs");
|
|
6
|
+
const constants_js_1 = require("./constants.cjs");
|
|
7
|
+
const number = (rawValue, userSettings) => {
|
|
8
|
+
const settings = {
|
|
9
|
+
...exports.number.defaultSettings,
|
|
10
|
+
...userSettings,
|
|
11
|
+
};
|
|
12
|
+
const digits = settings.digits ?? 0;
|
|
13
|
+
const cutZeros = settings?.cutZeros ?? false;
|
|
14
|
+
const delimiter = settings.delimiter ?? ' ';
|
|
15
|
+
const postfix = settings.postfix ?? '';
|
|
16
|
+
const emptyText = settings.emptyText ?? constants_js_1.NO_VALUE;
|
|
17
|
+
const digitsOnlyForFloat = settings.digitsOnlyForFloat ?? true;
|
|
18
|
+
let value;
|
|
19
|
+
if (index_js_1.typeGuard.isString(rawValue)) {
|
|
20
|
+
value = (0, number_js_1.number)(value, { fallback: undefined });
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
value = rawValue;
|
|
24
|
+
}
|
|
25
|
+
if (index_js_1.typeGuard.isNumber(value)) {
|
|
26
|
+
let raw = `${value}`;
|
|
27
|
+
if (digits !== false) {
|
|
28
|
+
raw = value.toFixed(digits);
|
|
29
|
+
}
|
|
30
|
+
if (cutZeros) {
|
|
31
|
+
raw = `${+raw}`;
|
|
32
|
+
}
|
|
33
|
+
const [integerPart, decimalPart] = raw.split('.', 2);
|
|
34
|
+
let formattedIntegerPart = integerPart;
|
|
35
|
+
let formattedDecimalPart = '';
|
|
36
|
+
if (decimalPart && (!digitsOnlyForFloat || !/^0+$/.test(decimalPart))) {
|
|
37
|
+
formattedDecimalPart = `.${decimalPart}`;
|
|
38
|
+
}
|
|
39
|
+
const rgx = /(\d+)(\d{3})/;
|
|
40
|
+
while (rgx.test(formattedIntegerPart) && delimiter) {
|
|
41
|
+
formattedIntegerPart = formattedIntegerPart.replace(rgx, `$1${delimiter}$2`);
|
|
42
|
+
}
|
|
43
|
+
return formattedIntegerPart + formattedDecimalPart + postfix;
|
|
44
|
+
}
|
|
45
|
+
return emptyText;
|
|
46
|
+
};
|
|
47
|
+
exports.number = number;
|
|
48
|
+
exports.number.defaultSettings = {};
|