yummies 5.7.1 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/async.cjs +2 -70
- package/async.cjs.map +1 -0
- package/async.js +26 -59
- package/async.js.map +1 -0
- package/common.cjs +2 -18
- package/common.cjs.map +1 -0
- package/common.d.ts +1 -1
- package/common.d.ts.map +1 -1
- package/common.js +5 -13
- package/common.js.map +1 -0
- package/complex/global-config.d.ts +1 -1
- package/complex/global-config.d.ts.map +1 -1
- package/complex/index.d.ts +3 -3
- package/complex/index.d.ts.map +1 -1
- package/complex/modules-factory.d.ts +1 -1
- package/complex/modules-factory.d.ts.map +1 -1
- package/complex.cjs +2 -0
- package/complex.cjs.map +1 -0
- package/complex.js +66 -0
- package/complex.js.map +1 -0
- package/cookie.cjs +2 -13
- package/cookie.cjs.map +1 -0
- package/cookie.d.ts +1 -1
- package/cookie.d.ts.map +1 -1
- package/cookie.js +4 -8
- package/cookie.js.map +1 -0
- package/css.cjs +2 -64
- package/css.cjs.map +1 -0
- package/css.d.ts +1 -1
- package/css.js +24 -54
- package/css.js.map +1 -0
- package/data.cjs +2 -58
- package/data.cjs.map +1 -0
- package/data.js +32 -50
- package/data.js.map +1 -0
- package/date-time.cjs +2 -171
- package/date-time.cjs.map +1 -0
- package/date-time.d.ts +2 -3
- package/date-time.d.ts.map +1 -1
- package/date-time.js +311 -156
- package/date-time.js.map +1 -0
- package/device.cjs +2 -28
- package/device.cjs.map +1 -0
- package/device.js +23 -20
- package/device.js.map +1 -0
- package/encodings.cjs +2 -270
- package/encodings.cjs.map +1 -0
- package/encodings.js +269 -265
- package/encodings.js.map +1 -0
- package/errors.cjs +2 -34
- package/errors.cjs.map +1 -0
- package/errors.d.ts +1 -1
- package/errors.d.ts.map +1 -1
- package/errors.js +8 -29
- package/errors.js.map +1 -0
- package/file.cjs +2 -29
- package/file.cjs.map +1 -0
- package/file.js +19 -23
- package/file.js.map +1 -0
- package/format/_exports.d.ts +4 -4
- package/format/_exports.d.ts.map +1 -1
- package/format/index.d.ts +1 -1
- package/format/index.d.ts.map +1 -1
- package/format/number.d.ts +1 -1
- package/format/number.d.ts.map +1 -1
- package/format/percent.d.ts +2 -2
- package/format/percent.d.ts.map +1 -1
- package/format.cjs +2 -0
- package/format.cjs.map +1 -0
- package/format.js +27 -0
- package/format.js.map +1 -0
- package/html.cjs +2 -202
- package/html.cjs.map +1 -0
- package/html.d.ts +2 -2
- package/html.d.ts.map +1 -1
- package/html.js +120 -177
- package/html.js.map +1 -0
- package/id.cjs +3 -76
- package/id.cjs.map +1 -0
- package/id.js +15 -70
- package/id.js.map +1 -0
- package/imports.cjs +2 -45
- package/imports.cjs.map +1 -0
- package/imports.js +22 -37
- package/imports.js.map +1 -0
- package/math.cjs +2 -23
- package/math.cjs.map +1 -0
- package/math.d.ts +1 -1
- package/math.d.ts.map +1 -1
- package/math.js +10 -14
- package/math.js.map +1 -0
- package/media.cjs +2 -115
- package/media.cjs.map +1 -0
- package/media.js +54 -96
- package/media.js.map +1 -0
- package/mobx/apply-observable.d.ts +1 -1
- package/mobx/apply-observable.d.ts.map +1 -1
- package/mobx/create-enhanced-atom.d.ts +2 -2
- package/mobx/create-enhanced-atom.d.ts.map +1 -1
- package/mobx/deep-observable-struct.d.ts +1 -1
- package/mobx/deep-observable-struct.d.ts.map +1 -1
- package/mobx/get-mobx-administration.d.ts +2 -2
- package/mobx/get-mobx-administration.d.ts.map +1 -1
- package/mobx/index.d.ts +5 -5
- package/mobx/index.d.ts.map +1 -1
- package/mobx.cjs +2 -0
- package/mobx.cjs.map +1 -0
- package/mobx.js +89 -0
- package/mobx.js.map +1 -0
- package/ms.cjs +2 -22
- package/ms.cjs.map +1 -0
- package/ms.js +12 -17
- package/ms.js.map +1 -0
- package/number.cjs +2 -16
- package/number.cjs.map +1 -0
- package/number.js +9 -12
- package/number.js.map +1 -0
- package/package.json +101 -70
- package/parser/_exports.d.ts +3 -3
- package/parser/_exports.d.ts.map +1 -1
- package/parser/index.d.ts +1 -1
- package/parser/index.d.ts.map +1 -1
- package/parser/number.d.ts +1 -1
- package/parser/number.d.ts.map +1 -1
- package/parser/percent.d.ts +2 -2
- package/parser/percent.d.ts.map +1 -1
- package/parser/string.d.ts +1 -1
- package/parser/string.d.ts.map +1 -1
- package/parser.cjs +2 -0
- package/parser.cjs.map +1 -0
- package/parser.js +15 -0
- package/parser.js.map +1 -0
- package/price.cjs +2 -21
- package/price.cjs.map +1 -0
- package/price.js +13 -16
- package/price.js.map +1 -0
- package/random.cjs +2 -25
- package/random.cjs.map +1 -0
- package/random.js +11 -13
- package/random.js.map +1 -0
- package/react/hooks/index.d.ts +21 -21
- package/react/hooks/index.d.ts.map +1 -1
- package/react/hooks/use-click-outside.d.ts +1 -1
- package/react/hooks/use-define-ref.d.ts +1 -1
- package/react/hooks/use-element-ref.d.ts +1 -1
- package/react/hooks/use-event.d.ts +1 -1
- package/react/hooks/use-event.d.ts.map +1 -1
- package/react/hooks/use-initial-height.d.ts +1 -1
- package/react/hooks/use-last-value-ref.d.ts +1 -1
- package/react/hooks/use-resize-observer.d.ts +1 -1
- package/react/hooks/use-sync-ref.d.ts +1 -1
- package/react/hooks/use-toggle.d.ts +1 -1
- package/react/hooks/use-value.d.ts +1 -1
- package/react/index.d.ts +1 -1
- package/react/index.d.ts.map +1 -1
- package/react.cjs +2 -0
- package/react.cjs.map +1 -0
- package/react.js +152 -0
- package/react.js.map +1 -0
- package/sound.cjs +2 -16
- package/sound.cjs.map +1 -0
- package/sound.js +7 -11
- package/sound.js.map +1 -0
- package/text.cjs +2 -53
- package/text.cjs.map +1 -0
- package/text.js +20 -46
- package/text.js.map +1 -0
- package/type-guard/_exports.d.ts +1 -1
- package/type-guard/_exports.d.ts.map +1 -1
- package/type-guard/index.d.ts +1 -1
- package/type-guard/index.d.ts.map +1 -1
- package/type-guard.cjs +2 -0
- package/type-guard.cjs.map +1 -0
- package/type-guard.js +5 -0
- package/type-guard.js.map +1 -0
- package/utility-types.cjs +2 -0
- package/utility-types.cjs.map +1 -0
- package/utility-types.d.ts.map +1 -0
- package/utility-types.js +2 -0
- package/utility-types.js.map +1 -0
- package/utils/types.cjs +1 -1
- package/utils/types.cjs.map +1 -0
- package/utils/types.js +2 -1
- package/utils/types.js.map +1 -0
- package/vibrate.cjs +2 -12
- package/vibrate.cjs.map +1 -0
- package/vibrate.js +6 -7
- package/vibrate.js.map +1 -0
- package/~index-C3wKHvHr.js +80 -0
- package/~index-C3wKHvHr.js.map +1 -0
- package/~index-PKNbSTT-.js +2 -0
- package/~index-PKNbSTT-.js.map +1 -0
- package/~number-B1MpW9GU.js +2 -0
- package/~number-B1MpW9GU.js.map +1 -0
- package/~number-DX076ykA.js +2 -0
- package/~number-DX076ykA.js.map +1 -0
- package/~number-EWff2XI6.js +25 -0
- package/~number-EWff2XI6.js.map +1 -0
- package/~number-baxVnzrJ.js +32 -0
- package/~number-baxVnzrJ.js.map +1 -0
- package/async.d.cts +0 -28
- package/async.d.cts.map +0 -1
- package/common.d.cts +0 -15
- package/common.d.cts.map +0 -1
- package/complex/counter.cjs +0 -21
- package/complex/counter.d.cts +0 -15
- package/complex/counter.d.cts.map +0 -1
- package/complex/counter.js +0 -17
- package/complex/global-config.cjs +0 -46
- package/complex/global-config.d.cts +0 -11
- package/complex/global-config.d.cts.map +0 -1
- package/complex/global-config.js +0 -41
- package/complex/index.cjs +0 -19
- package/complex/index.d.cts +0 -4
- package/complex/index.d.cts.map +0 -1
- package/complex/index.js +0 -3
- package/complex/modules-factory.cjs +0 -50
- package/complex/modules-factory.d.cts +0 -49
- package/complex/modules-factory.d.cts.map +0 -1
- package/complex/modules-factory.js +0 -46
- package/cookie.d.cts +0 -3
- package/cookie.d.cts.map +0 -1
- package/css.d.cts +0 -42
- package/css.d.cts.map +0 -1
- package/data.d.cts +0 -4
- package/data.d.cts.map +0 -1
- package/date-time.d.cts +0 -28
- package/date-time.d.cts.map +0 -1
- package/device.d.cts +0 -8
- package/device.d.cts.map +0 -1
- package/encodings.d.cts +0 -2
- package/encodings.d.cts.map +0 -1
- package/errors.d.cts +0 -19
- package/errors.d.cts.map +0 -1
- package/file.d.cts +0 -3
- package/file.d.cts.map +0 -1
- package/format/_exports.cjs +0 -20
- package/format/_exports.d.cts +0 -5
- package/format/_exports.d.cts.map +0 -1
- package/format/_exports.js +0 -4
- package/format/constants.cjs +0 -6
- package/format/constants.d.cts +0 -4
- package/format/constants.d.cts.map +0 -1
- package/format/constants.js +0 -3
- package/format/index.cjs +0 -40
- package/format/index.d.cts +0 -3
- package/format/index.d.cts.map +0 -1
- package/format/index.js +0 -4
- package/format/number.cjs +0 -48
- package/format/number.d.cts +0 -36
- package/format/number.d.cts.map +0 -1
- package/format/number.js +0 -44
- package/format/percent.cjs +0 -27
- package/format/percent.d.cts +0 -15
- package/format/percent.d.cts.map +0 -1
- package/format/percent.js +0 -23
- package/format/skip-spaces.cjs +0 -8
- package/format/skip-spaces.d.cts +0 -5
- package/format/skip-spaces.d.cts.map +0 -1
- package/format/skip-spaces.js +0 -4
- package/html.d.cts +0 -44
- package/html.d.cts.map +0 -1
- package/id.d.cts +0 -63
- package/id.d.cts.map +0 -1
- package/imports.d.cts +0 -15
- package/imports.d.cts.map +0 -1
- package/math.d.cts +0 -13
- package/math.d.cts.map +0 -1
- package/media.d.cts +0 -20
- package/media.d.cts.map +0 -1
- package/mobx/apply-observable.cjs +0 -16
- package/mobx/apply-observable.d.cts +0 -4
- package/mobx/apply-observable.d.cts.map +0 -1
- package/mobx/apply-observable.js +0 -12
- package/mobx/create-enhanced-atom.cjs +0 -16
- package/mobx/create-enhanced-atom.d.cts +0 -11
- package/mobx/create-enhanced-atom.d.cts.map +0 -1
- package/mobx/create-enhanced-atom.js +0 -12
- package/mobx/deep-observable-struct.cjs +0 -61
- package/mobx/deep-observable-struct.d.cts +0 -7
- package/mobx/deep-observable-struct.d.cts.map +0 -1
- package/mobx/deep-observable-struct.js +0 -57
- package/mobx/get-mobx-administration.cjs +0 -6
- package/mobx/get-mobx-administration.d.cts +0 -6
- package/mobx/get-mobx-administration.d.cts.map +0 -1
- package/mobx/get-mobx-administration.js +0 -2
- package/mobx/index.cjs +0 -21
- package/mobx/index.d.cts +0 -6
- package/mobx/index.d.cts.map +0 -1
- package/mobx/index.js +0 -5
- package/mobx/lazy-observe.cjs +0 -66
- package/mobx/lazy-observe.d.cts +0 -14
- package/mobx/lazy-observe.d.cts.map +0 -1
- package/mobx/lazy-observe.js +0 -62
- package/ms.d.cts +0 -19
- package/ms.d.cts.map +0 -1
- package/number.d.cts +0 -8
- package/number.d.cts.map +0 -1
- package/parser/_exports.cjs +0 -19
- package/parser/_exports.d.cts +0 -4
- package/parser/_exports.d.cts.map +0 -1
- package/parser/_exports.js +0 -3
- package/parser/index.cjs +0 -40
- package/parser/index.d.cts +0 -3
- package/parser/index.d.cts.map +0 -1
- package/parser/index.js +0 -4
- package/parser/number.cjs +0 -48
- package/parser/number.d.cts +0 -21
- package/parser/number.d.cts.map +0 -1
- package/parser/number.js +0 -44
- package/parser/percent.cjs +0 -8
- package/parser/percent.d.cts +0 -4
- package/parser/percent.d.cts.map +0 -1
- package/parser/percent.js +0 -4
- package/parser/string.cjs +0 -18
- package/parser/string.d.cts +0 -7
- package/parser/string.d.cts.map +0 -1
- package/parser/string.js +0 -14
- package/price.d.cts +0 -6
- package/price.d.cts.map +0 -1
- package/random.d.cts +0 -9
- package/random.d.cts.map +0 -1
- package/react/hooks/index.cjs +0 -37
- package/react/hooks/index.d.cts +0 -22
- package/react/hooks/index.d.cts.map +0 -1
- package/react/hooks/index.js +0 -21
- package/react/hooks/use-abort-controller.cjs +0 -15
- package/react/hooks/use-abort-controller.d.cts +0 -2
- package/react/hooks/use-abort-controller.d.cts.map +0 -1
- package/react/hooks/use-abort-controller.js +0 -11
- package/react/hooks/use-abort-signal.cjs +0 -8
- package/react/hooks/use-abort-signal.d.cts +0 -2
- package/react/hooks/use-abort-signal.d.cts.map +0 -1
- package/react/hooks/use-abort-signal.js +0 -4
- package/react/hooks/use-click-outside.cjs +0 -17
- package/react/hooks/use-click-outside.d.cts +0 -9
- package/react/hooks/use-click-outside.d.cts.map +0 -1
- package/react/hooks/use-click-outside.js +0 -13
- package/react/hooks/use-constant.cjs +0 -19
- package/react/hooks/use-constant.d.cts +0 -9
- package/react/hooks/use-constant.d.cts.map +0 -1
- package/react/hooks/use-constant.js +0 -15
- package/react/hooks/use-define-ref.cjs +0 -19
- package/react/hooks/use-define-ref.d.cts +0 -10
- package/react/hooks/use-define-ref.d.cts.map +0 -1
- package/react/hooks/use-define-ref.js +0 -15
- package/react/hooks/use-element-ref.cjs +0 -12
- package/react/hooks/use-element-ref.d.cts +0 -2
- package/react/hooks/use-element-ref.d.cts.map +0 -1
- package/react/hooks/use-element-ref.js +0 -8
- package/react/hooks/use-event-listener.cjs +0 -17
- package/react/hooks/use-event-listener.d.cts +0 -8
- package/react/hooks/use-event-listener.d.cts.map +0 -1
- package/react/hooks/use-event-listener.js +0 -13
- package/react/hooks/use-event.cjs +0 -23
- package/react/hooks/use-event.d.cts +0 -3
- package/react/hooks/use-event.d.cts.map +0 -1
- package/react/hooks/use-event.js +0 -19
- package/react/hooks/use-flag.cjs +0 -19
- package/react/hooks/use-flag.d.cts +0 -8
- package/react/hooks/use-flag.d.cts.map +0 -1
- package/react/hooks/use-flag.js +0 -15
- package/react/hooks/use-force-update.cjs +0 -11
- package/react/hooks/use-force-update.d.cts +0 -2
- package/react/hooks/use-force-update.d.cts.map +0 -1
- package/react/hooks/use-force-update.js +0 -7
- package/react/hooks/use-initial-height.cjs +0 -15
- package/react/hooks/use-initial-height.d.cts +0 -5
- package/react/hooks/use-initial-height.d.cts.map +0 -1
- package/react/hooks/use-initial-height.js +0 -11
- package/react/hooks/use-instance.cjs +0 -31
- package/react/hooks/use-instance.d.cts +0 -27
- package/react/hooks/use-instance.d.cts.map +0 -1
- package/react/hooks/use-instance.js +0 -27
- package/react/hooks/use-intersection-observer.cjs +0 -14
- package/react/hooks/use-intersection-observer.d.cts +0 -2
- package/react/hooks/use-intersection-observer.d.cts.map +0 -1
- package/react/hooks/use-intersection-observer.js +0 -10
- package/react/hooks/use-last-defined-value.cjs +0 -12
- package/react/hooks/use-last-defined-value.d.cts +0 -2
- package/react/hooks/use-last-defined-value.d.cts.map +0 -1
- package/react/hooks/use-last-defined-value.js +0 -8
- package/react/hooks/use-last-value-ref.cjs +0 -12
- package/react/hooks/use-last-value-ref.d.cts +0 -2
- package/react/hooks/use-last-value-ref.d.cts.map +0 -1
- package/react/hooks/use-last-value-ref.js +0 -8
- package/react/hooks/use-life-cycle.cjs +0 -14
- package/react/hooks/use-life-cycle.d.cts +0 -5
- package/react/hooks/use-life-cycle.d.cts.map +0 -1
- package/react/hooks/use-life-cycle.js +0 -10
- package/react/hooks/use-resize-observer.cjs +0 -15
- package/react/hooks/use-resize-observer.d.cts +0 -2
- package/react/hooks/use-resize-observer.d.cts.map +0 -1
- package/react/hooks/use-resize-observer.js +0 -11
- package/react/hooks/use-sync-ref.cjs +0 -10
- package/react/hooks/use-sync-ref.d.cts +0 -2
- package/react/hooks/use-sync-ref.d.cts.map +0 -1
- package/react/hooks/use-sync-ref.js +0 -6
- package/react/hooks/use-toggle.cjs +0 -10
- package/react/hooks/use-toggle.d.cts +0 -2
- package/react/hooks/use-toggle.d.cts.map +0 -1
- package/react/hooks/use-toggle.js +0 -6
- package/react/hooks/use-value.cjs +0 -12
- package/react/hooks/use-value.d.cts +0 -5
- package/react/hooks/use-value.d.cts.map +0 -1
- package/react/hooks/use-value.js +0 -8
- package/react/hooks/use-visibility-state.cjs +0 -18
- package/react/hooks/use-visibility-state.d.cts +0 -2
- package/react/hooks/use-visibility-state.d.cts.map +0 -1
- package/react/hooks/use-visibility-state.js +0 -14
- package/react/index.cjs +0 -17
- package/react/index.d.cts +0 -2
- package/react/index.d.cts.map +0 -1
- package/react/index.js +0 -1
- package/sound.d.cts +0 -7
- package/sound.d.cts.map +0 -1
- package/storage.cjs +0 -48
- package/storage.d.cts +0 -39
- package/storage.d.cts.map +0 -1
- package/storage.js +0 -43
- package/text.d.cts +0 -15
- package/text.d.cts.map +0 -1
- package/type-guard/_exports.cjs +0 -129
- package/type-guard/_exports.d.cts +0 -86
- package/type-guard/_exports.d.cts.map +0 -1
- package/type-guard/_exports.js +0 -125
- package/type-guard/index.cjs +0 -40
- package/type-guard/index.d.cts +0 -3
- package/type-guard/index.d.cts.map +0 -1
- package/type-guard/index.js +0 -4
- package/utils/types.d.cts +0 -395
- package/utils/types.d.cts.map +0 -1
- package/vibrate.d.cts +0 -5
- package/vibrate.d.cts.map +0 -1
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useVisibilityState = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
const useVisibilityState = () => {
|
|
6
|
-
const [state, setState] = (0, react_1.useState)();
|
|
7
|
-
(0, react_1.useEffect)(() => {
|
|
8
|
-
const handleVisibilityChange = () => {
|
|
9
|
-
setState(document.visibilityState);
|
|
10
|
-
};
|
|
11
|
-
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
12
|
-
return () => {
|
|
13
|
-
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
14
|
-
};
|
|
15
|
-
}, []);
|
|
16
|
-
return state;
|
|
17
|
-
};
|
|
18
|
-
exports.useVisibilityState = useVisibilityState;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-visibility-state.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-visibility-state.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,2CAgB9B,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
export const useVisibilityState = () => {
|
|
3
|
-
const [state, setState] = useState();
|
|
4
|
-
useEffect(() => {
|
|
5
|
-
const handleVisibilityChange = () => {
|
|
6
|
-
setState(document.visibilityState);
|
|
7
|
-
};
|
|
8
|
-
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
9
|
-
return () => {
|
|
10
|
-
document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
11
|
-
};
|
|
12
|
-
}, []);
|
|
13
|
-
return state;
|
|
14
|
-
};
|
package/react/index.cjs
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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("./hooks/index.cjs"), exports);
|
package/react/index.d.cts
DELETED
package/react/index.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,kCAAiC"}
|
package/react/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./hooks/index.js";
|
package/sound.d.cts
DELETED
package/sound.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sound.d.ts","sourceRoot":"","sources":["../src/sound.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,SAAS,GACpB,MAAM,MAAM,EACZ,aAAgB;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,kBASzC,CAAC"}
|
package/storage.cjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createStorageKey = void 0;
|
|
4
|
-
exports.createStorage = createStorage;
|
|
5
|
-
const storages = {
|
|
6
|
-
session: sessionStorage,
|
|
7
|
-
local: localStorage,
|
|
8
|
-
};
|
|
9
|
-
const createStorageKey = (prefix, key, namespace) => `${prefix}${namespace ? `/${namespace}` : ''}/${key}`;
|
|
10
|
-
exports.createStorageKey = createStorageKey;
|
|
11
|
-
const parseStorageValue = (value) => {
|
|
12
|
-
if (typeof value !== 'string') {
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
const parsed = JSON.parse(value);
|
|
17
|
-
return parsed;
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const formatValueToStorage = (value) => {
|
|
24
|
-
return JSON.stringify(value);
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Создает интерфейс для работы с хранилищем (localStorage, sessionStorage)
|
|
28
|
-
*/
|
|
29
|
-
function createStorage(storageConfig) {
|
|
30
|
-
return {
|
|
31
|
-
set: (cfg) => {
|
|
32
|
-
const config = cfg;
|
|
33
|
-
const storageType = (config.type ?? storageConfig.type);
|
|
34
|
-
const storagePrefix = (config.prefix ?? storageConfig.prefix);
|
|
35
|
-
const storage = storages[storageType];
|
|
36
|
-
storage.setItem((0, exports.createStorageKey)(storagePrefix, config.key, config.namespace), formatValueToStorage(config.value));
|
|
37
|
-
},
|
|
38
|
-
get: (cfg) => {
|
|
39
|
-
const config = cfg;
|
|
40
|
-
const storageType = (config.type ?? storageConfig.type);
|
|
41
|
-
const storagePrefix = (config.prefix ?? storageConfig.prefix);
|
|
42
|
-
const storage = storages[storageType];
|
|
43
|
-
return (parseStorageValue(storage.getItem((0, exports.createStorageKey)(storagePrefix, config.key, config.namespace))) ??
|
|
44
|
-
config.fallback ??
|
|
45
|
-
null);
|
|
46
|
-
},
|
|
47
|
-
};
|
|
48
|
-
}
|
package/storage.d.cts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
export type StorageType = 'session' | 'local';
|
|
2
|
-
export declare const createStorageKey: (prefix: string, key: string, namespace?: string) => string;
|
|
3
|
-
export interface SetToStorageConfig<V> extends Omit<GetFromStorageConfig<V>, 'fallback'> {
|
|
4
|
-
value: V;
|
|
5
|
-
}
|
|
6
|
-
export interface GetFromStorageConfig<V> {
|
|
7
|
-
/**
|
|
8
|
-
* Ключ по которому можно получить значение из хранилища (имя ключа не полное, оно дополняется неймпспейсом проекта)
|
|
9
|
-
*/
|
|
10
|
-
key: string;
|
|
11
|
-
/**
|
|
12
|
-
* Тип хранилища
|
|
13
|
-
*/
|
|
14
|
-
type: StorageType;
|
|
15
|
-
/**
|
|
16
|
-
* дефолтное значение, которое будет использоваться если значения нет в хранилище
|
|
17
|
-
*/
|
|
18
|
-
fallback?: V;
|
|
19
|
-
/**
|
|
20
|
-
* Доп. делитель в ключ/utils/types'е
|
|
21
|
-
*/
|
|
22
|
-
namespace?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Доп. делитель
|
|
25
|
-
*/
|
|
26
|
-
prefix?: string;
|
|
27
|
-
}
|
|
28
|
-
export type SetToStorageWrappedConfig<V, BaseConfig extends StorageConfigBase> = Omit<SetToStorageConfig<V>, Extract<keyof SetToStorageConfig<V>, keyof BaseConfig>> & Partial<Pick<SetToStorageConfig<V>, Extract<keyof SetToStorageConfig<V>, keyof BaseConfig>>> & Pick<BaseConfig, Exclude<keyof BaseConfig, keyof SetToStorageConfig<V>>>;
|
|
29
|
-
export type GetFromStorageWrappedConfig<V, BaseConfig extends StorageConfigBase> = Omit<GetFromStorageConfig<V>, Extract<keyof GetFromStorageConfig<V>, keyof BaseConfig>> & Partial<Pick<GetFromStorageConfig<V>, Extract<keyof GetFromStorageConfig<V>, keyof BaseConfig>>> & Pick<BaseConfig, Exclude<keyof BaseConfig, keyof GetFromStorageConfig<V>>>;
|
|
30
|
-
export type StorageConfigBase = Partial<Pick<GetFromStorageConfig<any>, 'prefix' | 'type'>>;
|
|
31
|
-
export interface StorageApi<BaseConfig extends StorageConfigBase> {
|
|
32
|
-
set<Value>(config: SetToStorageWrappedConfig<Value, BaseConfig>): void;
|
|
33
|
-
get<Value>(config: GetFromStorageWrappedConfig<Value, BaseConfig>): Value | null;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Создает интерфейс для работы с хранилищем (localStorage, sessionStorage)
|
|
37
|
-
*/
|
|
38
|
-
export declare function createStorage<BaseConfig extends StorageConfigBase>(storageConfig: BaseConfig): StorageApi<BaseConfig>;
|
|
39
|
-
//# sourceMappingURL=storage.d.ts.map
|
package/storage.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;AAO9C,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,MAAM,EACd,KAAK,MAAM,EACX,YAAY,MAAM,WACsC,CAAC;AAmB3D,MAAM,WAAW,kBAAkB,CAAC,CAAC,CACnC,SAAQ,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC;CACV;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,yBAAyB,CACnC,CAAC,EACD,UAAU,SAAS,iBAAiB,IAClC,IAAI,CACN,kBAAkB,CAAC,CAAC,CAAC,EACrB,OAAO,CAAC,MAAM,kBAAkB,CAAC,CAAC,CAAC,EAAE,MAAM,UAAU,CAAC,CACvD,GACC,OAAO,CACL,IAAI,CACF,kBAAkB,CAAC,CAAC,CAAC,EACrB,OAAO,CAAC,MAAM,kBAAkB,CAAC,CAAC,CAAC,EAAE,MAAM,UAAU,CAAC,CACvD,CACF,GACD,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,MAAM,UAAU,EAAE,MAAM,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3E,MAAM,MAAM,2BAA2B,CACrC,CAAC,EACD,UAAU,SAAS,iBAAiB,IAClC,IAAI,CACN,oBAAoB,CAAC,CAAC,CAAC,EACvB,OAAO,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,EAAE,MAAM,UAAU,CAAC,CACzD,GACC,OAAO,CACL,IAAI,CACF,oBAAoB,CAAC,CAAC,CAAC,EACvB,OAAO,CAAC,MAAM,oBAAoB,CAAC,CAAC,CAAC,EAAE,MAAM,UAAU,CAAC,CACzD,CACF,GACD,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,MAAM,UAAU,EAAE,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7E,MAAM,MAAM,iBAAiB,GAAG,OAAO,CACrC,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC,CACnD,CAAC;AAEF,MAAM,WAAW,UAAU,CAAC,UAAU,SAAS,iBAAiB;IAC9D,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,yBAAyB,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;IACvE,GAAG,CAAC,KAAK,EACP,MAAM,EAAE,2BAA2B,CAAC,KAAK,EAAE,UAAU,CAAC,GACrD,KAAK,GAAG,IAAI,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,UAAU,SAAS,iBAAiB,EAChE,aAAa,EAAE,UAAU,GACxB,UAAU,CAAC,UAAU,CAAC,CAgCxB"}
|
package/storage.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const storages = {
|
|
2
|
-
session: sessionStorage,
|
|
3
|
-
local: localStorage,
|
|
4
|
-
};
|
|
5
|
-
export const createStorageKey = (prefix, key, namespace) => `${prefix}${namespace ? `/${namespace}` : ''}/${key}`;
|
|
6
|
-
const parseStorageValue = (value) => {
|
|
7
|
-
if (typeof value !== 'string') {
|
|
8
|
-
return value;
|
|
9
|
-
}
|
|
10
|
-
try {
|
|
11
|
-
const parsed = JSON.parse(value);
|
|
12
|
-
return parsed;
|
|
13
|
-
}
|
|
14
|
-
catch {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const formatValueToStorage = (value) => {
|
|
19
|
-
return JSON.stringify(value);
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Создает интерфейс для работы с хранилищем (localStorage, sessionStorage)
|
|
23
|
-
*/
|
|
24
|
-
export function createStorage(storageConfig) {
|
|
25
|
-
return {
|
|
26
|
-
set: (cfg) => {
|
|
27
|
-
const config = cfg;
|
|
28
|
-
const storageType = (config.type ?? storageConfig.type);
|
|
29
|
-
const storagePrefix = (config.prefix ?? storageConfig.prefix);
|
|
30
|
-
const storage = storages[storageType];
|
|
31
|
-
storage.setItem(createStorageKey(storagePrefix, config.key, config.namespace), formatValueToStorage(config.value));
|
|
32
|
-
},
|
|
33
|
-
get: (cfg) => {
|
|
34
|
-
const config = cfg;
|
|
35
|
-
const storageType = (config.type ?? storageConfig.type);
|
|
36
|
-
const storagePrefix = (config.prefix ?? storageConfig.prefix);
|
|
37
|
-
const storage = storages[storageType];
|
|
38
|
-
return (parseStorageValue(storage.getItem(createStorageKey(storagePrefix, config.key, config.namespace))) ??
|
|
39
|
-
config.fallback ??
|
|
40
|
-
null);
|
|
41
|
-
},
|
|
42
|
-
};
|
|
43
|
-
}
|
package/text.d.cts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Склонение слова в зависимости от количества
|
|
3
|
-
* @example
|
|
4
|
-
* declension(1, ['слово', 'слова', 'слов']) // 'слово'
|
|
5
|
-
* @example
|
|
6
|
-
* declension(2, ['слово', 'слова', 'слов']) // 'слова'
|
|
7
|
-
* @example
|
|
8
|
-
* declension(5, ['слово', 'слова', 'слов']) // 'слов'
|
|
9
|
-
*/
|
|
10
|
-
export declare const declension: (count: number, txt: readonly [one: string, two: string, five: string], cases?: number[]) => string;
|
|
11
|
-
/**
|
|
12
|
-
* Разбиение текста на линии
|
|
13
|
-
*/
|
|
14
|
-
export declare const splitTextByLines: (text: string, lineLingth?: number) => string[];
|
|
15
|
-
//# sourceMappingURL=text.d.ts.map
|
package/text.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../src/text.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,MAAM,EACb,KAAK,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,EACtD,gBAA0B,WAEmD,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,MAAM,MAAM,EACZ,aAAY,MAAW,KACtB,MAAM,EAqCR,CAAC"}
|
package/type-guard/_exports.cjs
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSymbol = exports.isInfinite = exports.isNaN = exports.isElement = exports.isRegExp = exports.isFunction = exports.isBoolean = exports.isNumber = exports.isString = exports.isArray = exports.isObject = exports.isUndefined = exports.isNull = exports.isDefined = void 0;
|
|
4
|
-
var Type;
|
|
5
|
-
(function (Type) {
|
|
6
|
-
Type["Null"] = "null";
|
|
7
|
-
Type["Undefined"] = "undefined";
|
|
8
|
-
Type["NaN"] = "nan";
|
|
9
|
-
Type["Object"] = "[object Object]";
|
|
10
|
-
Type["Array"] = "[object Array]";
|
|
11
|
-
Type["String"] = "[object String]";
|
|
12
|
-
Type["Number"] = "[object Number]";
|
|
13
|
-
Type["Boolean"] = "[object Boolean]";
|
|
14
|
-
Type["Function"] = "[object Function]";
|
|
15
|
-
Type["RegExp"] = "[object RegExp]";
|
|
16
|
-
Type["Symbol"] = "[object Symbol]";
|
|
17
|
-
Type["Infinite"] = "infinite";
|
|
18
|
-
Type["Element"] = "element";
|
|
19
|
-
})(Type || (Type = {}));
|
|
20
|
-
function getType(value) {
|
|
21
|
-
if (value === undefined) {
|
|
22
|
-
return Type.Undefined;
|
|
23
|
-
}
|
|
24
|
-
if (value === null) {
|
|
25
|
-
return Type.Null;
|
|
26
|
-
}
|
|
27
|
-
// handle DOM elements
|
|
28
|
-
// @ts-expect-error
|
|
29
|
-
if (value && (value.nodeType === 1 || value.nodeType === 9)) {
|
|
30
|
-
return Type.Element;
|
|
31
|
-
}
|
|
32
|
-
const stringifiedValue = Object.prototype.toString.call(value);
|
|
33
|
-
// handle NaN and Infinity
|
|
34
|
-
if (stringifiedValue === Type.Number) {
|
|
35
|
-
if (Number.isNaN(value)) {
|
|
36
|
-
return Type.NaN;
|
|
37
|
-
}
|
|
38
|
-
if (!Number.isFinite(value)) {
|
|
39
|
-
return Type.Infinite;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return stringifiedValue;
|
|
43
|
-
}
|
|
44
|
-
const createTypeGuard = (type) => (value) => getType(value) === type;
|
|
45
|
-
/**
|
|
46
|
-
* Check if a value is not null or undefined
|
|
47
|
-
* @param value the value to check
|
|
48
|
-
* @returns boolean
|
|
49
|
-
*/
|
|
50
|
-
const isDefined = (value) => value != null;
|
|
51
|
-
exports.isDefined = isDefined;
|
|
52
|
-
/**
|
|
53
|
-
* Check if a value is null
|
|
54
|
-
* @param value the value to check
|
|
55
|
-
* @returns boolean
|
|
56
|
-
*/
|
|
57
|
-
exports.isNull = createTypeGuard(Type.Null);
|
|
58
|
-
/**
|
|
59
|
-
* Check if a value is undefined
|
|
60
|
-
* @param value the value to check
|
|
61
|
-
* @returns boolean
|
|
62
|
-
*/
|
|
63
|
-
exports.isUndefined = createTypeGuard(Type.Undefined);
|
|
64
|
-
/**
|
|
65
|
-
* Check if a value is an object
|
|
66
|
-
* @param value the value to check
|
|
67
|
-
* @returns boolean
|
|
68
|
-
*/
|
|
69
|
-
exports.isObject = createTypeGuard(Type.Object);
|
|
70
|
-
/**
|
|
71
|
-
* Check if a value is an array
|
|
72
|
-
* @param value the value to check
|
|
73
|
-
* @returns boolean
|
|
74
|
-
*/
|
|
75
|
-
exports.isArray = createTypeGuard(Type.Array);
|
|
76
|
-
/**
|
|
77
|
-
* Check if a value is a string
|
|
78
|
-
* @param value the value to check
|
|
79
|
-
* @returns boolean
|
|
80
|
-
*/
|
|
81
|
-
exports.isString = createTypeGuard(Type.String);
|
|
82
|
-
/**
|
|
83
|
-
* Check if a value is a number
|
|
84
|
-
* @param value the value to check
|
|
85
|
-
* @returns boolean
|
|
86
|
-
*/
|
|
87
|
-
exports.isNumber = createTypeGuard(Type.Number);
|
|
88
|
-
/**
|
|
89
|
-
* Check if a value is a boolean
|
|
90
|
-
* @param value the value to check
|
|
91
|
-
* @returns boolean
|
|
92
|
-
*/
|
|
93
|
-
exports.isBoolean = createTypeGuard(Type.Boolean);
|
|
94
|
-
/**
|
|
95
|
-
* Check if a value is a function
|
|
96
|
-
* @param value the value to check
|
|
97
|
-
* @returns boolean
|
|
98
|
-
*/
|
|
99
|
-
exports.isFunction = createTypeGuard(Type.Function);
|
|
100
|
-
/**
|
|
101
|
-
* Check if a value is a regular expression
|
|
102
|
-
* @param value the value to check
|
|
103
|
-
* @returns boolean
|
|
104
|
-
*/
|
|
105
|
-
exports.isRegExp = createTypeGuard(Type.RegExp);
|
|
106
|
-
/**
|
|
107
|
-
* Check if a value is a DOM element
|
|
108
|
-
* @param value the value to check
|
|
109
|
-
* @returns boolean
|
|
110
|
-
*/
|
|
111
|
-
exports.isElement = createTypeGuard(Type.Element);
|
|
112
|
-
/**
|
|
113
|
-
* Check if a value is NaN
|
|
114
|
-
* @param value the value to check
|
|
115
|
-
* @returns boolean
|
|
116
|
-
*/
|
|
117
|
-
exports.isNaN = createTypeGuard(Type.NaN);
|
|
118
|
-
/**
|
|
119
|
-
* Check if a value is infinity
|
|
120
|
-
* @param value the value to check
|
|
121
|
-
* @returns boolean
|
|
122
|
-
*/
|
|
123
|
-
exports.isInfinite = createTypeGuard(Type.Infinite);
|
|
124
|
-
/**
|
|
125
|
-
* Check if a value is a symbol
|
|
126
|
-
* @param value the value to check
|
|
127
|
-
* @returns boolean
|
|
128
|
-
*/
|
|
129
|
-
exports.isSymbol = createTypeGuard(Type.Symbol);
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { AnyFunction, AnyObject } from "../utils/types.cjs";
|
|
2
|
-
/**
|
|
3
|
-
* Check if a value is not null or undefined
|
|
4
|
-
* @param value the value to check
|
|
5
|
-
* @returns boolean
|
|
6
|
-
*/
|
|
7
|
-
export declare const isDefined: <T>(value: T | undefined | null) => value is T;
|
|
8
|
-
/**
|
|
9
|
-
* Check if a value is null
|
|
10
|
-
* @param value the value to check
|
|
11
|
-
* @returns boolean
|
|
12
|
-
*/
|
|
13
|
-
export declare const isNull: (value: unknown) => value is null;
|
|
14
|
-
/**
|
|
15
|
-
* Check if a value is undefined
|
|
16
|
-
* @param value the value to check
|
|
17
|
-
* @returns boolean
|
|
18
|
-
*/
|
|
19
|
-
export declare const isUndefined: (value: unknown) => value is undefined;
|
|
20
|
-
/**
|
|
21
|
-
* Check if a value is an object
|
|
22
|
-
* @param value the value to check
|
|
23
|
-
* @returns boolean
|
|
24
|
-
*/
|
|
25
|
-
export declare const isObject: (value: unknown) => value is AnyObject;
|
|
26
|
-
/**
|
|
27
|
-
* Check if a value is an array
|
|
28
|
-
* @param value the value to check
|
|
29
|
-
* @returns boolean
|
|
30
|
-
*/
|
|
31
|
-
export declare const isArray: (value: unknown) => value is unknown[];
|
|
32
|
-
/**
|
|
33
|
-
* Check if a value is a string
|
|
34
|
-
* @param value the value to check
|
|
35
|
-
* @returns boolean
|
|
36
|
-
*/
|
|
37
|
-
export declare const isString: (value: unknown) => value is string;
|
|
38
|
-
/**
|
|
39
|
-
* Check if a value is a number
|
|
40
|
-
* @param value the value to check
|
|
41
|
-
* @returns boolean
|
|
42
|
-
*/
|
|
43
|
-
export declare const isNumber: (value: unknown) => value is number;
|
|
44
|
-
/**
|
|
45
|
-
* Check if a value is a boolean
|
|
46
|
-
* @param value the value to check
|
|
47
|
-
* @returns boolean
|
|
48
|
-
*/
|
|
49
|
-
export declare const isBoolean: (value: unknown) => value is boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Check if a value is a function
|
|
52
|
-
* @param value the value to check
|
|
53
|
-
* @returns boolean
|
|
54
|
-
*/
|
|
55
|
-
export declare const isFunction: (value: unknown) => value is AnyFunction;
|
|
56
|
-
/**
|
|
57
|
-
* Check if a value is a regular expression
|
|
58
|
-
* @param value the value to check
|
|
59
|
-
* @returns boolean
|
|
60
|
-
*/
|
|
61
|
-
export declare const isRegExp: (value: unknown) => value is RegExp;
|
|
62
|
-
/**
|
|
63
|
-
* Check if a value is a DOM element
|
|
64
|
-
* @param value the value to check
|
|
65
|
-
* @returns boolean
|
|
66
|
-
*/
|
|
67
|
-
export declare const isElement: (value: unknown) => value is HTMLElement;
|
|
68
|
-
/**
|
|
69
|
-
* Check if a value is NaN
|
|
70
|
-
* @param value the value to check
|
|
71
|
-
* @returns boolean
|
|
72
|
-
*/
|
|
73
|
-
export declare const isNaN: (value: unknown) => boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Check if a value is infinity
|
|
76
|
-
* @param value the value to check
|
|
77
|
-
* @returns boolean
|
|
78
|
-
*/
|
|
79
|
-
export declare const isInfinite: (value: unknown) => boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Check if a value is a symbol
|
|
82
|
-
* @param value the value to check
|
|
83
|
-
* @returns boolean
|
|
84
|
-
*/
|
|
85
|
-
export declare const isSymbol: (value: unknown) => value is symbol;
|
|
86
|
-
//# sourceMappingURL=_exports.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_exports.d.ts","sourceRoot":"","sources":["../../src/type-guard/_exports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,2BAA0B;AAoDhE;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,KAAG,KAAK,IAAI,CACrD,CAAC;AAEhB;;;;GAIG;AACH,eAAO,MAAM,MAAM,UAhBT,OAAO,KAAG,KAAK,QAgB6B,CAAC;AAEvD;;;;GAIG;AACH,eAAO,MAAM,WAAW,UAvBd,OAAO,KAAG,KAAK,aAuB4C,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,QAAQ,UA9BX,OAAO,KAAG,KAAK,aA8BsC,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,OAAO,UArCV,OAAO,KAAG,KAAK,aAqCoC,CAAC;AAE9D;;;;GAIG;AACH,eAAO,MAAM,QAAQ,UA5CX,OAAO,KAAG,KAAK,UA4CmC,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,QAAQ,UAnDX,OAAO,KAAG,KAAK,UAmDmC,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,SAAS,UA1DZ,OAAO,KAAG,KAAK,WA0DsC,CAAC;AAEhE;;;;GAIG;AACH,eAAO,MAAM,UAAU,UAjEb,OAAO,KAAG,KAAK,eAiE4C,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,QAAQ,UAxEX,OAAO,KAAG,KAAK,UAwEmC,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,SAAS,UA/EZ,OAAO,KAAG,KAAK,eA+E0C,CAAC;AAEpE;;;;GAIG;AACH,eAAO,MAAM,KAAK,EAAwC,CACxD,KAAK,EAAE,OAAO,KACX,OAAO,CAAC;AAEb;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAA6C,CAClE,KAAK,EAAE,OAAO,KACX,OAAO,CAAC;AAEb;;;;GAIG;AACH,eAAO,MAAM,QAAQ,UAxGX,OAAO,KAAG,KAAK,UAwGmC,CAAC"}
|
package/type-guard/_exports.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
var Type;
|
|
2
|
-
(function (Type) {
|
|
3
|
-
Type["Null"] = "null";
|
|
4
|
-
Type["Undefined"] = "undefined";
|
|
5
|
-
Type["NaN"] = "nan";
|
|
6
|
-
Type["Object"] = "[object Object]";
|
|
7
|
-
Type["Array"] = "[object Array]";
|
|
8
|
-
Type["String"] = "[object String]";
|
|
9
|
-
Type["Number"] = "[object Number]";
|
|
10
|
-
Type["Boolean"] = "[object Boolean]";
|
|
11
|
-
Type["Function"] = "[object Function]";
|
|
12
|
-
Type["RegExp"] = "[object RegExp]";
|
|
13
|
-
Type["Symbol"] = "[object Symbol]";
|
|
14
|
-
Type["Infinite"] = "infinite";
|
|
15
|
-
Type["Element"] = "element";
|
|
16
|
-
})(Type || (Type = {}));
|
|
17
|
-
function getType(value) {
|
|
18
|
-
if (value === undefined) {
|
|
19
|
-
return Type.Undefined;
|
|
20
|
-
}
|
|
21
|
-
if (value === null) {
|
|
22
|
-
return Type.Null;
|
|
23
|
-
}
|
|
24
|
-
// handle DOM elements
|
|
25
|
-
// @ts-expect-error
|
|
26
|
-
if (value && (value.nodeType === 1 || value.nodeType === 9)) {
|
|
27
|
-
return Type.Element;
|
|
28
|
-
}
|
|
29
|
-
const stringifiedValue = Object.prototype.toString.call(value);
|
|
30
|
-
// handle NaN and Infinity
|
|
31
|
-
if (stringifiedValue === Type.Number) {
|
|
32
|
-
if (Number.isNaN(value)) {
|
|
33
|
-
return Type.NaN;
|
|
34
|
-
}
|
|
35
|
-
if (!Number.isFinite(value)) {
|
|
36
|
-
return Type.Infinite;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return stringifiedValue;
|
|
40
|
-
}
|
|
41
|
-
const createTypeGuard = (type) => (value) => getType(value) === type;
|
|
42
|
-
/**
|
|
43
|
-
* Check if a value is not null or undefined
|
|
44
|
-
* @param value the value to check
|
|
45
|
-
* @returns boolean
|
|
46
|
-
*/
|
|
47
|
-
export const isDefined = (value) => value != null;
|
|
48
|
-
/**
|
|
49
|
-
* Check if a value is null
|
|
50
|
-
* @param value the value to check
|
|
51
|
-
* @returns boolean
|
|
52
|
-
*/
|
|
53
|
-
export const isNull = createTypeGuard(Type.Null);
|
|
54
|
-
/**
|
|
55
|
-
* Check if a value is undefined
|
|
56
|
-
* @param value the value to check
|
|
57
|
-
* @returns boolean
|
|
58
|
-
*/
|
|
59
|
-
export const isUndefined = createTypeGuard(Type.Undefined);
|
|
60
|
-
/**
|
|
61
|
-
* Check if a value is an object
|
|
62
|
-
* @param value the value to check
|
|
63
|
-
* @returns boolean
|
|
64
|
-
*/
|
|
65
|
-
export const isObject = createTypeGuard(Type.Object);
|
|
66
|
-
/**
|
|
67
|
-
* Check if a value is an array
|
|
68
|
-
* @param value the value to check
|
|
69
|
-
* @returns boolean
|
|
70
|
-
*/
|
|
71
|
-
export const isArray = createTypeGuard(Type.Array);
|
|
72
|
-
/**
|
|
73
|
-
* Check if a value is a string
|
|
74
|
-
* @param value the value to check
|
|
75
|
-
* @returns boolean
|
|
76
|
-
*/
|
|
77
|
-
export const isString = createTypeGuard(Type.String);
|
|
78
|
-
/**
|
|
79
|
-
* Check if a value is a number
|
|
80
|
-
* @param value the value to check
|
|
81
|
-
* @returns boolean
|
|
82
|
-
*/
|
|
83
|
-
export const isNumber = createTypeGuard(Type.Number);
|
|
84
|
-
/**
|
|
85
|
-
* Check if a value is a boolean
|
|
86
|
-
* @param value the value to check
|
|
87
|
-
* @returns boolean
|
|
88
|
-
*/
|
|
89
|
-
export const isBoolean = createTypeGuard(Type.Boolean);
|
|
90
|
-
/**
|
|
91
|
-
* Check if a value is a function
|
|
92
|
-
* @param value the value to check
|
|
93
|
-
* @returns boolean
|
|
94
|
-
*/
|
|
95
|
-
export const isFunction = createTypeGuard(Type.Function);
|
|
96
|
-
/**
|
|
97
|
-
* Check if a value is a regular expression
|
|
98
|
-
* @param value the value to check
|
|
99
|
-
* @returns boolean
|
|
100
|
-
*/
|
|
101
|
-
export const isRegExp = createTypeGuard(Type.RegExp);
|
|
102
|
-
/**
|
|
103
|
-
* Check if a value is a DOM element
|
|
104
|
-
* @param value the value to check
|
|
105
|
-
* @returns boolean
|
|
106
|
-
*/
|
|
107
|
-
export const isElement = createTypeGuard(Type.Element);
|
|
108
|
-
/**
|
|
109
|
-
* Check if a value is NaN
|
|
110
|
-
* @param value the value to check
|
|
111
|
-
* @returns boolean
|
|
112
|
-
*/
|
|
113
|
-
export const isNaN = createTypeGuard(Type.NaN);
|
|
114
|
-
/**
|
|
115
|
-
* Check if a value is infinity
|
|
116
|
-
* @param value the value to check
|
|
117
|
-
* @returns boolean
|
|
118
|
-
*/
|
|
119
|
-
export const isInfinite = createTypeGuard(Type.Infinite);
|
|
120
|
-
/**
|
|
121
|
-
* Check if a value is a symbol
|
|
122
|
-
* @param value the value to check
|
|
123
|
-
* @returns boolean
|
|
124
|
-
*/
|
|
125
|
-
export const isSymbol = createTypeGuard(Type.Symbol);
|
package/type-guard/index.cjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
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.typeGuard = void 0;
|
|
37
|
-
// This way is more treeshakable than collecting
|
|
38
|
-
// it into one exportable object export const typeGuard
|
|
39
|
-
const typeGuard = __importStar(require("./_exports.cjs"));
|
|
40
|
-
exports.typeGuard = typeGuard;
|
package/type-guard/index.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/type-guard/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,uBAAsB;AAE3C,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/type-guard/index.js
DELETED