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/src/storage.ts
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
export type StorageType = 'session' | 'local';
|
|
2
|
-
|
|
3
|
-
const storages: Record<StorageType, Storage> = {
|
|
4
|
-
session: sessionStorage,
|
|
5
|
-
local: localStorage,
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const createStorageKey = (
|
|
9
|
-
prefix: string,
|
|
10
|
-
key: string,
|
|
11
|
-
namespace?: string,
|
|
12
|
-
) => `${prefix}${namespace ? `/${namespace}` : ''}/${key}`;
|
|
13
|
-
|
|
14
|
-
const parseStorageValue = <V>(value: unknown): V | null => {
|
|
15
|
-
if (typeof value !== 'string') {
|
|
16
|
-
return value as V;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
const parsed = JSON.parse(value);
|
|
21
|
-
return parsed;
|
|
22
|
-
} catch {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const formatValueToStorage = (value: unknown): string => {
|
|
28
|
-
return JSON.stringify(value);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export interface SetToStorageConfig<V>
|
|
32
|
-
extends Omit<GetFromStorageConfig<V>, 'fallback'> {
|
|
33
|
-
value: V;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface GetFromStorageConfig<V> {
|
|
37
|
-
/**
|
|
38
|
-
* Ключ по которому можно получить значение из хранилища (имя ключа не полное, оно дополняется неймпспейсом проекта)
|
|
39
|
-
*/
|
|
40
|
-
key: string;
|
|
41
|
-
/**
|
|
42
|
-
* Тип хранилища
|
|
43
|
-
*/
|
|
44
|
-
type: StorageType;
|
|
45
|
-
/**
|
|
46
|
-
* дефолтное значение, которое будет использоваться если значения нет в хранилище
|
|
47
|
-
*/
|
|
48
|
-
fallback?: V;
|
|
49
|
-
/**
|
|
50
|
-
* Доп. делитель в ключ/utils/types'е
|
|
51
|
-
*/
|
|
52
|
-
namespace?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Доп. делитель
|
|
55
|
-
*/
|
|
56
|
-
prefix?: string;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export type SetToStorageWrappedConfig<
|
|
60
|
-
V,
|
|
61
|
-
BaseConfig extends StorageConfigBase,
|
|
62
|
-
> = Omit<
|
|
63
|
-
SetToStorageConfig<V>,
|
|
64
|
-
Extract<keyof SetToStorageConfig<V>, keyof BaseConfig>
|
|
65
|
-
> &
|
|
66
|
-
Partial<
|
|
67
|
-
Pick<
|
|
68
|
-
SetToStorageConfig<V>,
|
|
69
|
-
Extract<keyof SetToStorageConfig<V>, keyof BaseConfig>
|
|
70
|
-
>
|
|
71
|
-
> &
|
|
72
|
-
Pick<BaseConfig, Exclude<keyof BaseConfig, keyof SetToStorageConfig<V>>>;
|
|
73
|
-
|
|
74
|
-
export type GetFromStorageWrappedConfig<
|
|
75
|
-
V,
|
|
76
|
-
BaseConfig extends StorageConfigBase,
|
|
77
|
-
> = Omit<
|
|
78
|
-
GetFromStorageConfig<V>,
|
|
79
|
-
Extract<keyof GetFromStorageConfig<V>, keyof BaseConfig>
|
|
80
|
-
> &
|
|
81
|
-
Partial<
|
|
82
|
-
Pick<
|
|
83
|
-
GetFromStorageConfig<V>,
|
|
84
|
-
Extract<keyof GetFromStorageConfig<V>, keyof BaseConfig>
|
|
85
|
-
>
|
|
86
|
-
> &
|
|
87
|
-
Pick<BaseConfig, Exclude<keyof BaseConfig, keyof GetFromStorageConfig<V>>>;
|
|
88
|
-
|
|
89
|
-
export type StorageConfigBase = Partial<
|
|
90
|
-
Pick<GetFromStorageConfig<any>, 'prefix' | 'type'>
|
|
91
|
-
>;
|
|
92
|
-
|
|
93
|
-
export interface StorageApi<BaseConfig extends StorageConfigBase> {
|
|
94
|
-
set<Value>(config: SetToStorageWrappedConfig<Value, BaseConfig>): void;
|
|
95
|
-
get<Value>(
|
|
96
|
-
config: GetFromStorageWrappedConfig<Value, BaseConfig>,
|
|
97
|
-
): Value | null;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Создает интерфейс для работы с хранилищем (localStorage, sessionStorage)
|
|
102
|
-
*/
|
|
103
|
-
export function createStorage<BaseConfig extends StorageConfigBase>(
|
|
104
|
-
storageConfig: BaseConfig,
|
|
105
|
-
): StorageApi<BaseConfig> {
|
|
106
|
-
return {
|
|
107
|
-
set: <Value>(cfg: SetToStorageWrappedConfig<Value, BaseConfig>) => {
|
|
108
|
-
const config = cfg as unknown as SetToStorageConfig<Value>;
|
|
109
|
-
const storageType = (config.type ?? storageConfig.type!) as StorageType;
|
|
110
|
-
const storagePrefix = (config.prefix ?? storageConfig.prefix!) as string;
|
|
111
|
-
|
|
112
|
-
const storage = storages[storageType];
|
|
113
|
-
|
|
114
|
-
storage.setItem(
|
|
115
|
-
createStorageKey(storagePrefix, config.key, config.namespace),
|
|
116
|
-
formatValueToStorage(config.value),
|
|
117
|
-
);
|
|
118
|
-
},
|
|
119
|
-
get: <Value>(cfg: GetFromStorageWrappedConfig<Value, BaseConfig>) => {
|
|
120
|
-
const config = cfg as unknown as GetFromStorageConfig<Value>;
|
|
121
|
-
const storageType = (config.type ?? storageConfig.type!) as StorageType;
|
|
122
|
-
const storagePrefix = (config.prefix ?? storageConfig.prefix!) as string;
|
|
123
|
-
|
|
124
|
-
const storage = storages[storageType];
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
parseStorageValue<Value>(
|
|
128
|
-
storage.getItem(
|
|
129
|
-
createStorageKey(storagePrefix, config.key, config.namespace),
|
|
130
|
-
),
|
|
131
|
-
) ??
|
|
132
|
-
config.fallback ??
|
|
133
|
-
null
|
|
134
|
-
);
|
|
135
|
-
},
|
|
136
|
-
} as const;
|
|
137
|
-
}
|
package/src/text.test.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { splitTextByLines } from './text.js';
|
|
4
|
-
|
|
5
|
-
describe('text', () => {
|
|
6
|
-
describe('splitTextByLines', () => {
|
|
7
|
-
const testCases: {
|
|
8
|
-
input: Parameters<typeof splitTextByLines>;
|
|
9
|
-
expected: ReturnType<typeof splitTextByLines>;
|
|
10
|
-
}[] = [
|
|
11
|
-
{
|
|
12
|
-
input: [
|
|
13
|
-
'Lorem ipsum dolor sit amet consectetur adipisicing elit. Commodi pariatur magnam excepturi nesciunt tempora deserunt? Pariatur sit quam, ducimus molestias quia aut maxime eligendi repudiandae expedita repellat, harum dignissimos aliquam.',
|
|
14
|
-
60,
|
|
15
|
-
],
|
|
16
|
-
expected: [
|
|
17
|
-
'Lorem ipsum dolor sit amet consectetur adipisicing elit.',
|
|
18
|
-
'Commodi pariatur magnam excepturi nesciunt tempora deserunt?',
|
|
19
|
-
'Pariatur sit quam, ducimus molestias quia aut maxime',
|
|
20
|
-
'eligendi repudiandae expedita repellat, harum dignissimos',
|
|
21
|
-
'aliquam.',
|
|
22
|
-
],
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
input: ['', 60],
|
|
26
|
-
expected: [''],
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
input: [
|
|
30
|
-
'Supercalifragilisticexpialidocious is a long word that needs splitting',
|
|
31
|
-
20,
|
|
32
|
-
],
|
|
33
|
-
expected: [
|
|
34
|
-
'Supercalifragilistic',
|
|
35
|
-
'expialidocious',
|
|
36
|
-
'is a long word that',
|
|
37
|
-
'needs splitting',
|
|
38
|
-
],
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
input: [
|
|
42
|
-
' Multiple spaces and tabs\t\tbetween\twords ',
|
|
43
|
-
15,
|
|
44
|
-
],
|
|
45
|
-
expected: ['Multiple spaces', 'and tabs', 'between words'],
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
input: [
|
|
49
|
-
'Precise-length testing with exact match requirements for assessment',
|
|
50
|
-
20,
|
|
51
|
-
],
|
|
52
|
-
expected: [
|
|
53
|
-
'Precise-length',
|
|
54
|
-
'testing with exact',
|
|
55
|
-
'match requirements',
|
|
56
|
-
'for assessment',
|
|
57
|
-
],
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
input: [
|
|
61
|
-
`Special characters: @#$%^&*()_+={}[]|\\:";'<>?,./ and backticks \`code\` should work!`,
|
|
62
|
-
30,
|
|
63
|
-
],
|
|
64
|
-
expected: [
|
|
65
|
-
'Special characters:',
|
|
66
|
-
String.raw`@#$%^&*()_+={}[]|\:";'<>?,./`,
|
|
67
|
-
'and backticks `code` should',
|
|
68
|
-
'work!',
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
input: ['ThisIsACombinedWordThatExceedsLimit and normal words', 15],
|
|
73
|
-
expected: [
|
|
74
|
-
'ThisIsACombined',
|
|
75
|
-
'WordThatExceeds',
|
|
76
|
-
'Limit',
|
|
77
|
-
'and normal',
|
|
78
|
-
'words',
|
|
79
|
-
],
|
|
80
|
-
},
|
|
81
|
-
];
|
|
82
|
-
|
|
83
|
-
testCases.forEach((testCase, i) => {
|
|
84
|
-
test(`test case #${i + 1}`, () => {
|
|
85
|
-
expect(splitTextByLines(...testCase.input)).toStrictEqual(
|
|
86
|
-
testCase.expected,
|
|
87
|
-
);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
});
|
package/src/text.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Склонение слова в зависимости от количества
|
|
3
|
-
* @example
|
|
4
|
-
* declension(1, ['слово', 'слова', 'слов']) // 'слово'
|
|
5
|
-
* @example
|
|
6
|
-
* declension(2, ['слово', 'слова', 'слов']) // 'слова'
|
|
7
|
-
* @example
|
|
8
|
-
* declension(5, ['слово', 'слова', 'слов']) // 'слов'
|
|
9
|
-
*/
|
|
10
|
-
export const declension = (
|
|
11
|
-
count: number,
|
|
12
|
-
txt: readonly [one: string, two: string, five: string],
|
|
13
|
-
cases = [2, 0, 1, 1, 1, 2],
|
|
14
|
-
) =>
|
|
15
|
-
txt[count % 100 > 4 && count % 100 < 20 ? 2 : cases[Math.min(count % 10, 5)]];
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Разбиение текста на линии
|
|
19
|
-
*/
|
|
20
|
-
export const splitTextByLines = (
|
|
21
|
-
text: string,
|
|
22
|
-
lineLingth: number = 60,
|
|
23
|
-
): string[] => {
|
|
24
|
-
const words = text.split(/\s+/).filter((word) => word !== '');
|
|
25
|
-
const lines = [];
|
|
26
|
-
let currentLine = '';
|
|
27
|
-
|
|
28
|
-
for (const word of words) {
|
|
29
|
-
if (word.length > lineLingth) {
|
|
30
|
-
if (currentLine !== '') {
|
|
31
|
-
lines.push(currentLine);
|
|
32
|
-
currentLine = '';
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
let start = 0;
|
|
36
|
-
while (start < word.length) {
|
|
37
|
-
const chunk = word.slice(start, start + lineLingth);
|
|
38
|
-
lines.push(chunk);
|
|
39
|
-
start += lineLingth;
|
|
40
|
-
}
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Проверка возможности добавления слова в текущую строку
|
|
45
|
-
if (currentLine === '') {
|
|
46
|
-
currentLine = word;
|
|
47
|
-
} else if (currentLine.length + 1 + word.length <= lineLingth) {
|
|
48
|
-
currentLine += ` ${word}`;
|
|
49
|
-
} else {
|
|
50
|
-
lines.push(currentLine);
|
|
51
|
-
currentLine = word;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (currentLine !== '' || lines.length === 0) {
|
|
56
|
-
lines.push(currentLine);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return lines;
|
|
60
|
-
};
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import type { AnyFunction, AnyObject } from '../utils/types.js';
|
|
2
|
-
|
|
3
|
-
enum Type {
|
|
4
|
-
Null = 'null',
|
|
5
|
-
Undefined = 'undefined',
|
|
6
|
-
NaN = 'nan',
|
|
7
|
-
Object = '[object Object]',
|
|
8
|
-
Array = '[object Array]',
|
|
9
|
-
String = '[object String]',
|
|
10
|
-
Number = '[object Number]',
|
|
11
|
-
Boolean = '[object Boolean]',
|
|
12
|
-
Function = '[object Function]',
|
|
13
|
-
RegExp = '[object RegExp]',
|
|
14
|
-
Symbol = '[object Symbol]',
|
|
15
|
-
Infinite = 'infinite',
|
|
16
|
-
Element = 'element',
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function getType(value: unknown): Type {
|
|
20
|
-
if (value === undefined) {
|
|
21
|
-
return Type.Undefined;
|
|
22
|
-
}
|
|
23
|
-
if (value === null) {
|
|
24
|
-
return Type.Null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// handle DOM elements
|
|
28
|
-
// @ts-expect-error
|
|
29
|
-
if (value && (value.nodeType === 1 || value.nodeType === 9)) {
|
|
30
|
-
return Type.Element;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const stringifiedValue = Object.prototype.toString.call(value);
|
|
34
|
-
|
|
35
|
-
// handle NaN and Infinity
|
|
36
|
-
if (stringifiedValue === Type.Number) {
|
|
37
|
-
if (Number.isNaN(value as number)) {
|
|
38
|
-
return Type.NaN;
|
|
39
|
-
}
|
|
40
|
-
if (!Number.isFinite(value as number)) {
|
|
41
|
-
return Type.Infinite;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return stringifiedValue as Type;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const createTypeGuard =
|
|
49
|
-
<T>(type: Type) =>
|
|
50
|
-
(value: unknown): value is T =>
|
|
51
|
-
getType(value) === type;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Check if a value is not null or undefined
|
|
55
|
-
* @param value the value to check
|
|
56
|
-
* @returns boolean
|
|
57
|
-
*/
|
|
58
|
-
export const isDefined = <T>(value: T | undefined | null): value is T =>
|
|
59
|
-
value != null;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Check if a value is null
|
|
63
|
-
* @param value the value to check
|
|
64
|
-
* @returns boolean
|
|
65
|
-
*/
|
|
66
|
-
export const isNull = createTypeGuard<null>(Type.Null);
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Check if a value is undefined
|
|
70
|
-
* @param value the value to check
|
|
71
|
-
* @returns boolean
|
|
72
|
-
*/
|
|
73
|
-
export const isUndefined = createTypeGuard<undefined>(Type.Undefined);
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Check if a value is an object
|
|
77
|
-
* @param value the value to check
|
|
78
|
-
* @returns boolean
|
|
79
|
-
*/
|
|
80
|
-
export const isObject = createTypeGuard<AnyObject>(Type.Object);
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Check if a value is an array
|
|
84
|
-
* @param value the value to check
|
|
85
|
-
* @returns boolean
|
|
86
|
-
*/
|
|
87
|
-
export const isArray = createTypeGuard<unknown[]>(Type.Array);
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Check if a value is a string
|
|
91
|
-
* @param value the value to check
|
|
92
|
-
* @returns boolean
|
|
93
|
-
*/
|
|
94
|
-
export const isString = createTypeGuard<string>(Type.String);
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Check if a value is a number
|
|
98
|
-
* @param value the value to check
|
|
99
|
-
* @returns boolean
|
|
100
|
-
*/
|
|
101
|
-
export const isNumber = createTypeGuard<number>(Type.Number);
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Check if a value is a boolean
|
|
105
|
-
* @param value the value to check
|
|
106
|
-
* @returns boolean
|
|
107
|
-
*/
|
|
108
|
-
export const isBoolean = createTypeGuard<boolean>(Type.Boolean);
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Check if a value is a function
|
|
112
|
-
* @param value the value to check
|
|
113
|
-
* @returns boolean
|
|
114
|
-
*/
|
|
115
|
-
export const isFunction = createTypeGuard<AnyFunction>(Type.Function);
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Check if a value is a regular expression
|
|
119
|
-
* @param value the value to check
|
|
120
|
-
* @returns boolean
|
|
121
|
-
*/
|
|
122
|
-
export const isRegExp = createTypeGuard<RegExp>(Type.RegExp);
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Check if a value is a DOM element
|
|
126
|
-
* @param value the value to check
|
|
127
|
-
* @returns boolean
|
|
128
|
-
*/
|
|
129
|
-
export const isElement = createTypeGuard<HTMLElement>(Type.Element);
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Check if a value is NaN
|
|
133
|
-
* @param value the value to check
|
|
134
|
-
* @returns boolean
|
|
135
|
-
*/
|
|
136
|
-
export const isNaN = createTypeGuard<number>(Type.NaN) as (
|
|
137
|
-
value: unknown,
|
|
138
|
-
) => boolean;
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Check if a value is infinity
|
|
142
|
-
* @param value the value to check
|
|
143
|
-
* @returns boolean
|
|
144
|
-
*/
|
|
145
|
-
export const isInfinite = createTypeGuard<number>(Type.Infinite) as (
|
|
146
|
-
value: unknown,
|
|
147
|
-
) => boolean;
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Check if a value is a symbol
|
|
151
|
-
* @param value the value to check
|
|
152
|
-
* @returns boolean
|
|
153
|
-
*/
|
|
154
|
-
export const isSymbol = createTypeGuard<symbol>(Type.Symbol);
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import { typeGuard } from './index.js';
|
|
4
|
-
|
|
5
|
-
describe('typeGuard', () => {
|
|
6
|
-
test('isNumber', () => {
|
|
7
|
-
expect(typeGuard.isNumber(1)).toBe(true);
|
|
8
|
-
expect(typeGuard.isNumber(1.1)).toBe(true);
|
|
9
|
-
expect(typeGuard.isNumber(NaN)).toBe(false);
|
|
10
|
-
expect(typeGuard.isNumber(null)).toBe(false);
|
|
11
|
-
expect(typeGuard.isNumber(undefined)).toBe(false);
|
|
12
|
-
expect(typeGuard.isNumber([])).toBe(false);
|
|
13
|
-
expect(typeGuard.isNumber('abb')).toBe(false);
|
|
14
|
-
expect(typeGuard.isNumber(true)).toBe(false);
|
|
15
|
-
expect(typeGuard.isNumber(Number.MAX_SAFE_INTEGER)).toBe(true);
|
|
16
|
-
expect(typeGuard.isNumber(Number.MIN_SAFE_INTEGER)).toBe(true);
|
|
17
|
-
expect(typeGuard.isNumber(Infinity)).toBe(false);
|
|
18
|
-
expect(typeGuard.isNumber(-Infinity)).toBe(false);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('isString', () => {
|
|
22
|
-
expect(typeGuard.isString('sadf')).toBe(true);
|
|
23
|
-
expect(typeGuard.isString('')).toBe(true);
|
|
24
|
-
expect(typeGuard.isString(null)).toBe(false);
|
|
25
|
-
expect(typeGuard.isString(undefined)).toBe(false);
|
|
26
|
-
expect(typeGuard.isString([])).toBe(false);
|
|
27
|
-
expect(typeGuard.isString(1)).toBe(false);
|
|
28
|
-
expect(typeGuard.isString(true)).toBe(false);
|
|
29
|
-
expect(typeGuard.isString(Symbol())).toBe(false);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test('isBoolean', () => {
|
|
33
|
-
expect(typeGuard.isBoolean(true)).toBe(true);
|
|
34
|
-
expect(typeGuard.isBoolean(false)).toBe(true);
|
|
35
|
-
expect(typeGuard.isBoolean(NaN)).toBe(false);
|
|
36
|
-
expect(typeGuard.isBoolean(null)).toBe(false);
|
|
37
|
-
expect(typeGuard.isBoolean(undefined)).toBe(false);
|
|
38
|
-
expect(typeGuard.isBoolean([])).toBe(false);
|
|
39
|
-
expect(typeGuard.isBoolean('tet')).toBe(false);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('isFunction', () => {
|
|
43
|
-
expect(typeGuard.isFunction(new Function())).toBe(true);
|
|
44
|
-
expect(typeGuard.isFunction(() => {})).toBe(true);
|
|
45
|
-
expect(typeGuard.isFunction(null)).toBe(false);
|
|
46
|
-
expect(typeGuard.isFunction(undefined)).toBe(false);
|
|
47
|
-
expect(typeGuard.isFunction([])).toBe(false);
|
|
48
|
-
expect(typeGuard.isFunction('sdfds')).toBe(false);
|
|
49
|
-
expect(typeGuard.isFunction({})).toBe(false);
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
test('isRegExp', () => {
|
|
53
|
-
expect(typeGuard.isRegExp(/kekpek/)).toBe(true);
|
|
54
|
-
expect(typeGuard.isRegExp(null)).toBe(false);
|
|
55
|
-
expect(typeGuard.isRegExp(undefined)).toBe(false);
|
|
56
|
-
expect(typeGuard.isRegExp([])).toBe(false);
|
|
57
|
-
expect(typeGuard.isRegExp('bbaa')).toBe(false);
|
|
58
|
-
expect(typeGuard.isRegExp('/bbaa/')).toBe(false);
|
|
59
|
-
expect(typeGuard.isRegExp({})).toBe(false);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
test('isObject', () => {
|
|
63
|
-
expect(typeGuard.isObject({})).toBe(true);
|
|
64
|
-
expect(typeGuard.isObject(null)).toBe(false);
|
|
65
|
-
expect(typeGuard.isObject(undefined)).toBe(false);
|
|
66
|
-
expect(typeGuard.isObject([])).toBe(false);
|
|
67
|
-
expect(typeGuard.isObject(1)).toBe(false);
|
|
68
|
-
expect(typeGuard.isObject('barbvaz')).toBe(false);
|
|
69
|
-
expect(typeGuard.isObject(true)).toBe(false);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
test('isElement', () => {
|
|
73
|
-
expect(typeGuard.isElement(document.createElement('div'))).toBe(true);
|
|
74
|
-
expect(typeGuard.isElement(null)).toBe(false);
|
|
75
|
-
expect(typeGuard.isElement(undefined)).toBe(false);
|
|
76
|
-
expect(typeGuard.isElement([])).toBe(false);
|
|
77
|
-
expect(typeGuard.isElement('asdfadsf')).toBe(false);
|
|
78
|
-
expect(typeGuard.isElement({})).toBe(false);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
test('isNaN', () => {
|
|
82
|
-
expect(typeGuard.isNaN(NaN)).toBe(true);
|
|
83
|
-
expect(typeGuard.isNaN(0)).toBe(false);
|
|
84
|
-
expect(typeGuard.isNaN(1)).toBe(false);
|
|
85
|
-
expect(typeGuard.isNaN(Number.MAX_SAFE_INTEGER)).toBe(false);
|
|
86
|
-
expect(typeGuard.isNaN(Number.MIN_SAFE_INTEGER)).toBe(false);
|
|
87
|
-
expect(typeGuard.isNaN(Infinity)).toBe(false);
|
|
88
|
-
expect(typeGuard.isNaN(-Infinity)).toBe(false);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test('isInfinite', () => {
|
|
92
|
-
expect(typeGuard.isInfinite(Infinity)).toBe(true);
|
|
93
|
-
expect(typeGuard.isInfinite(-Infinity)).toBe(true);
|
|
94
|
-
expect(typeGuard.isInfinite(0)).toBe(false);
|
|
95
|
-
expect(typeGuard.isInfinite(1)).toBe(false);
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
test('isSymbol', () => {
|
|
99
|
-
expect(typeGuard.isSymbol(Symbol())).toBe(true);
|
|
100
|
-
expect(typeGuard.isSymbol(null)).toBe(false);
|
|
101
|
-
expect(typeGuard.isSymbol(undefined)).toBe(false);
|
|
102
|
-
expect(typeGuard.isSymbol([])).toBe(false);
|
|
103
|
-
expect(typeGuard.isSymbol('retret')).toBe(false);
|
|
104
|
-
expect(typeGuard.isSymbol({})).toBe(false);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
test('isDefined', () => {
|
|
108
|
-
expect(typeGuard.isDefined(null)).toBe(false);
|
|
109
|
-
expect(typeGuard.isDefined(undefined)).toBe(false);
|
|
110
|
-
expect(typeGuard.isDefined(1)).toBe(true);
|
|
111
|
-
expect(typeGuard.isDefined('ewrwr')).toBe(true);
|
|
112
|
-
expect(typeGuard.isDefined({})).toBe(true);
|
|
113
|
-
expect(typeGuard.isDefined([])).toBe(true);
|
|
114
|
-
expect(typeGuard.isDefined(new Date())).toBe(true);
|
|
115
|
-
expect(typeGuard.isDefined(Symbol())).toBe(true);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
test('isArray', () => {
|
|
119
|
-
expect(typeGuard.isArray([1, 2, 3])).toBe(true);
|
|
120
|
-
expect(typeGuard.isArray({})).toBe(false);
|
|
121
|
-
expect(typeGuard.isArray(1)).toBe(false);
|
|
122
|
-
expect(typeGuard.isArray('asdfvasd')).toBe(false);
|
|
123
|
-
expect(typeGuard.isArray(true)).toBe(false);
|
|
124
|
-
expect(typeGuard.isArray(undefined)).toBe(false);
|
|
125
|
-
expect(typeGuard.isArray(null)).toBe(false);
|
|
126
|
-
});
|
|
127
|
-
});
|
package/src/vibrate.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"types": [],
|
|
4
|
-
"target": "ESNext",
|
|
5
|
-
"outDir": "dist",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"useDefineForClassFields": true,
|
|
9
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
10
|
-
"allowJs": false,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"esModuleInterop": false,
|
|
13
|
-
"allowSyntheticDefaultImports": true,
|
|
14
|
-
"strict": true,
|
|
15
|
-
"forceConsistentCasingInFileNames": true,
|
|
16
|
-
"module": "NodeNext",
|
|
17
|
-
"moduleResolution": "nodenext",
|
|
18
|
-
"resolveJsonModule": true,
|
|
19
|
-
"isolatedModules": true,
|
|
20
|
-
"typeRoots": ["./node_modules/@types/", "./types", "./node_modules"],
|
|
21
|
-
"noEmit": false,
|
|
22
|
-
"jsx": "react-jsx"
|
|
23
|
-
},
|
|
24
|
-
"include": ["src"],
|
|
25
|
-
"exclude": ["src/**/*.test.ts"]
|
|
26
|
-
}
|
package/tsconfig.test.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"types": ["vitest"],
|
|
4
|
-
"target": "ESNext",
|
|
5
|
-
"outDir": "dist",
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"useDefineForClassFields": true,
|
|
9
|
-
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
10
|
-
"allowJs": false,
|
|
11
|
-
"skipLibCheck": true,
|
|
12
|
-
"esModuleInterop": false,
|
|
13
|
-
"allowSyntheticDefaultImports": true,
|
|
14
|
-
"strict": true,
|
|
15
|
-
"forceConsistentCasingInFileNames": true,
|
|
16
|
-
"module": "NodeNext",
|
|
17
|
-
"moduleResolution": "nodenext",
|
|
18
|
-
"resolveJsonModule": true,
|
|
19
|
-
"isolatedModules": true,
|
|
20
|
-
"experimentalDecorators": true,
|
|
21
|
-
"typeRoots": ["./node_modules/@types/", "./types", "./node_modules"],
|
|
22
|
-
"noEmit": false,
|
|
23
|
-
"jsx": "react-jsx"
|
|
24
|
-
},
|
|
25
|
-
"include": [
|
|
26
|
-
"src/**/*.test.ts",
|
|
27
|
-
"tests",
|
|
28
|
-
"src/lib",
|
|
29
|
-
"src/**/*.test.tsx",
|
|
30
|
-
"node_modules"
|
|
31
|
-
],
|
|
32
|
-
"exclude": []
|
|
33
|
-
}
|
package/vitest.config.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import react from "@vitejs/plugin-react-swc";
|
|
2
|
-
import { defineConfig } from "vitest/config";
|
|
3
|
-
|
|
4
|
-
export default defineConfig({
|
|
5
|
-
plugins: [
|
|
6
|
-
react({
|
|
7
|
-
tsDecorators: true,
|
|
8
|
-
}),
|
|
9
|
-
],
|
|
10
|
-
test: {
|
|
11
|
-
globals: true,
|
|
12
|
-
environment: "jsdom",
|
|
13
|
-
coverage: {
|
|
14
|
-
provider: "istanbul", // or 'v8'
|
|
15
|
-
include: ["src"],
|
|
16
|
-
reporter: ["text", "text-summary", "html"],
|
|
17
|
-
reportsDirectory: "./coverage",
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
});
|