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
package/type-guard/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/type-guard/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/type-guard/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,SAAS,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/type-guard.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-guard.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/type-guard.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-guard.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utility-types.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utility-types.d.ts","sourceRoot":"","sources":["../src/utility-types.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,EAAE,CAAC"}
|
package/utility-types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utility-types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/utils/types.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/utils/types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/vibrate.cjs
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.vibrate = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Вибрации по шаблону
|
|
6
|
-
*/
|
|
7
|
-
const vibrate = (pattern) => {
|
|
8
|
-
if ('vibrate' in navigator) {
|
|
9
|
-
navigator.vibrate(pattern);
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
exports.vibrate = vibrate;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=t=>{"vibrate"in navigator&&navigator.vibrate(t)};exports.vibrate=e;
|
|
2
|
+
//# sourceMappingURL=vibrate.cjs.map
|
package/vibrate.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vibrate.cjs","sources":["../src/vibrate.ts"],"sourcesContent":["/**\n * Вибрации по шаблону\n */\nexport const vibrate = (pattern: number | number[]) => {\n if ('vibrate' in navigator) {\n navigator.vibrate(pattern);\n }\n};\n"],"names":["vibrate","pattern"],"mappings":"gFAGO,MAAMA,EAAWC,GAA+B,CACjD,YAAa,WACf,UAAU,QAAQA,CAAO,CAE7B"}
|
package/vibrate.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
export const vibrate = (pattern) => {
|
|
5
|
-
if ('vibrate' in navigator) {
|
|
6
|
-
navigator.vibrate(pattern);
|
|
7
|
-
}
|
|
1
|
+
const i = (a) => {
|
|
2
|
+
"vibrate" in navigator && navigator.vibrate(a);
|
|
8
3
|
};
|
|
4
|
+
export {
|
|
5
|
+
i as vibrate
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=vibrate.js.map
|
package/vibrate.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vibrate.js","sources":["../src/vibrate.ts"],"sourcesContent":["/**\n * Вибрации по шаблону\n */\nexport const vibrate = (pattern: number | number[]) => {\n if ('vibrate' in navigator) {\n navigator.vibrate(pattern);\n }\n};\n"],"names":["vibrate","pattern"],"mappings":"AAGO,MAAMA,IAAU,CAACC,MAA+B;AACrD,EAAI,aAAa,aACf,UAAU,QAAQA,CAAO;AAE7B;"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
function i(e) {
|
|
2
|
+
if (e === void 0)
|
|
3
|
+
return "undefined";
|
|
4
|
+
if (e === null)
|
|
5
|
+
return "null";
|
|
6
|
+
if (e && (e.nodeType === 1 || e.nodeType === 9))
|
|
7
|
+
return "element";
|
|
8
|
+
const t = Object.prototype.toString.call(e);
|
|
9
|
+
if (t === "[object Number]") {
|
|
10
|
+
if (Number.isNaN(e))
|
|
11
|
+
return "nan";
|
|
12
|
+
if (!Number.isFinite(e))
|
|
13
|
+
return "infinite";
|
|
14
|
+
}
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
const n = (e) => (t) => i(t) === e, o = (e) => e != null, s = n(
|
|
18
|
+
"null"
|
|
19
|
+
/* Null */
|
|
20
|
+
), c = n(
|
|
21
|
+
"undefined"
|
|
22
|
+
/* Undefined */
|
|
23
|
+
), r = n(
|
|
24
|
+
"[object Object]"
|
|
25
|
+
/* Object */
|
|
26
|
+
), b = n(
|
|
27
|
+
"[object Array]"
|
|
28
|
+
/* Array */
|
|
29
|
+
), u = n(
|
|
30
|
+
"[object String]"
|
|
31
|
+
/* String */
|
|
32
|
+
), l = n(
|
|
33
|
+
"[object Number]"
|
|
34
|
+
/* Number */
|
|
35
|
+
), f = n(
|
|
36
|
+
"[object Boolean]"
|
|
37
|
+
/* Boolean */
|
|
38
|
+
), d = n(
|
|
39
|
+
"[object Function]"
|
|
40
|
+
/* Function */
|
|
41
|
+
), j = n(
|
|
42
|
+
"[object RegExp]"
|
|
43
|
+
/* RegExp */
|
|
44
|
+
), a = n(
|
|
45
|
+
"element"
|
|
46
|
+
/* Element */
|
|
47
|
+
), p = n(
|
|
48
|
+
"nan"
|
|
49
|
+
/* NaN */
|
|
50
|
+
), m = n(
|
|
51
|
+
"infinite"
|
|
52
|
+
/* Infinite */
|
|
53
|
+
), y = n(
|
|
54
|
+
"[object Symbol]"
|
|
55
|
+
/* Symbol */
|
|
56
|
+
), N = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
57
|
+
__proto__: null,
|
|
58
|
+
isArray: b,
|
|
59
|
+
isBoolean: f,
|
|
60
|
+
isDefined: o,
|
|
61
|
+
isElement: a,
|
|
62
|
+
isFunction: d,
|
|
63
|
+
isInfinite: m,
|
|
64
|
+
isNaN: p,
|
|
65
|
+
isNull: s,
|
|
66
|
+
isNumber: l,
|
|
67
|
+
isObject: r,
|
|
68
|
+
isRegExp: j,
|
|
69
|
+
isString: u,
|
|
70
|
+
isSymbol: y,
|
|
71
|
+
isUndefined: c
|
|
72
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
73
|
+
export {
|
|
74
|
+
N as _,
|
|
75
|
+
l as a,
|
|
76
|
+
r as b,
|
|
77
|
+
c,
|
|
78
|
+
u as i
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=~index-C3wKHvHr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"~index-C3wKHvHr.js","sources":["../src/type-guard/_exports.ts"],"sourcesContent":["import type { AnyFunction, AnyObject } from 'yummies/utils/types';\n\nenum Type {\n Null = 'null',\n Undefined = 'undefined',\n NaN = 'nan',\n Object = '[object Object]',\n Array = '[object Array]',\n String = '[object String]',\n Number = '[object Number]',\n Boolean = '[object Boolean]',\n Function = '[object Function]',\n RegExp = '[object RegExp]',\n Symbol = '[object Symbol]',\n Infinite = 'infinite',\n Element = 'element',\n}\n\nfunction getType(value: unknown): Type {\n if (value === undefined) {\n return Type.Undefined;\n }\n if (value === null) {\n return Type.Null;\n }\n\n // handle DOM elements\n // @ts-expect-error\n if (value && (value.nodeType === 1 || value.nodeType === 9)) {\n return Type.Element;\n }\n\n const stringifiedValue = Object.prototype.toString.call(value);\n\n // handle NaN and Infinity\n if (stringifiedValue === Type.Number) {\n if (Number.isNaN(value as number)) {\n return Type.NaN;\n }\n if (!Number.isFinite(value as number)) {\n return Type.Infinite;\n }\n }\n\n return stringifiedValue as Type;\n}\n\nconst createTypeGuard =\n <T>(type: Type) =>\n (value: unknown): value is T =>\n getType(value) === type;\n\n/**\n * Check if a value is not null or undefined\n * @param value the value to check\n * @returns boolean\n */\nexport const isDefined = <T>(value: T | undefined | null): value is T =>\n value != null;\n\n/**\n * Check if a value is null\n * @param value the value to check\n * @returns boolean\n */\nexport const isNull = createTypeGuard<null>(Type.Null);\n\n/**\n * Check if a value is undefined\n * @param value the value to check\n * @returns boolean\n */\nexport const isUndefined = createTypeGuard<undefined>(Type.Undefined);\n\n/**\n * Check if a value is an object\n * @param value the value to check\n * @returns boolean\n */\nexport const isObject = createTypeGuard<AnyObject>(Type.Object);\n\n/**\n * Check if a value is an array\n * @param value the value to check\n * @returns boolean\n */\nexport const isArray = createTypeGuard<unknown[]>(Type.Array);\n\n/**\n * Check if a value is a string\n * @param value the value to check\n * @returns boolean\n */\nexport const isString = createTypeGuard<string>(Type.String);\n\n/**\n * Check if a value is a number\n * @param value the value to check\n * @returns boolean\n */\nexport const isNumber = createTypeGuard<number>(Type.Number);\n\n/**\n * Check if a value is a boolean\n * @param value the value to check\n * @returns boolean\n */\nexport const isBoolean = createTypeGuard<boolean>(Type.Boolean);\n\n/**\n * Check if a value is a function\n * @param value the value to check\n * @returns boolean\n */\nexport const isFunction = createTypeGuard<AnyFunction>(Type.Function);\n\n/**\n * Check if a value is a regular expression\n * @param value the value to check\n * @returns boolean\n */\nexport const isRegExp = createTypeGuard<RegExp>(Type.RegExp);\n\n/**\n * Check if a value is a DOM element\n * @param value the value to check\n * @returns boolean\n */\nexport const isElement = createTypeGuard<HTMLElement>(Type.Element);\n\n/**\n * Check if a value is NaN\n * @param value the value to check\n * @returns boolean\n */\nexport const isNaN = createTypeGuard<number>(Type.NaN) as (\n value: unknown,\n) => boolean;\n\n/**\n * Check if a value is infinity\n * @param value the value to check\n * @returns boolean\n */\nexport const isInfinite = createTypeGuard<number>(Type.Infinite) as (\n value: unknown,\n) => boolean;\n\n/**\n * Check if a value is a symbol\n * @param value the value to check\n * @returns boolean\n */\nexport const isSymbol = createTypeGuard<symbol>(Type.Symbol);\n"],"names":["getType","value","stringifiedValue","createTypeGuard","type","isDefined","isNull","isUndefined","isObject","isArray","isString","isNumber","isBoolean","isFunction","isRegExp","isElement","isNaN","isInfinite","isSymbol"],"mappings":"AAkBA,SAASA,EAAQC,GAAsB;AACrC,MAAIA,MAAU;AACZ,WAAO;AAET,MAAIA,MAAU;AACZ,WAAO;AAKT,MAAIA,MAAUA,EAAM,aAAa,KAAKA,EAAM,aAAa;AACvD,WAAO;AAGT,QAAMC,IAAmB,OAAO,UAAU,SAAS,KAAKD,CAAK;AAG7D,MAAIC,MAAqB,mBAAa;AACpC,QAAI,OAAO,MAAMD,CAAe;AAC9B,aAAO;AAET,QAAI,CAAC,OAAO,SAASA,CAAe;AAClC,aAAO;AAAA,EAEX;AAEA,SAAOC;AACT;AAEA,MAAMC,IACJ,CAAIC,MACJ,CAACH,MACCD,EAAQC,CAAK,MAAMG,GAOVC,IAAY,CAAIJ,MAC3BA,KAAS,MAOEK,IAASH;AAAA,EAAsB;AAAA;AAAA,GAO/BI,IAAcJ;AAAA,EAA2B;AAAA;AAAA,GAOzCK,IAAWL;AAAA,EAA2B;AAAA;AAAA,GAOtCM,IAAUN;AAAA,EAA2B;AAAA;AAAA,GAOrCO,IAAWP;AAAA,EAAwB;AAAA;AAAA,GAOnCQ,IAAWR;AAAA,EAAwB;AAAA;AAAA,GAOnCS,IAAYT;AAAA,EAAyB;AAAA;AAAA,GAOrCU,IAAaV;AAAA,EAA6B;AAAA;AAAA,GAO1CW,IAAWX;AAAA,EAAwB;AAAA;AAAA,GAOnCY,IAAYZ;AAAA,EAA6B;AAAA;AAAA,GAOzCa,IAAQb;AAAA,EAAwB;AAAA;AAAA,GAShCc,IAAad;AAAA,EAAwB;AAAA;AAAA,GASrCe,IAAWf;AAAA,EAAwB;AAAA;AAAA;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";function r(n){if(n===void 0)return"undefined";if(n===null)return"null";if(n&&(n.nodeType===1||n.nodeType===9))return"element";const t=Object.prototype.toString.call(n);if(t==="[object Number]"){if(Number.isNaN(n))return"nan";if(!Number.isFinite(n))return"infinite"}return t}const e=n=>t=>r(t)===n,b=n=>n!=null,u=e("null"),i=e("undefined"),o=e("[object Object]"),f=e("[object Array]"),s=e("[object String]"),c=e("[object Number]"),l=e("[object Boolean]"),d=e("[object Function]"),j=e("[object RegExp]"),m=e("element"),p=e("nan"),y=e("infinite"),N=e("[object Symbol]"),g=Object.freeze(Object.defineProperty({__proto__:null,isArray:f,isBoolean:l,isDefined:b,isElement:m,isFunction:d,isInfinite:y,isNaN:p,isNull:u,isNumber:c,isObject:o,isRegExp:j,isString:s,isSymbol:N,isUndefined:i},Symbol.toStringTag,{value:"Module"}));exports._exports=g;exports.isNumber=c;exports.isObject=o;exports.isString=s;exports.isUndefined=i;
|
|
2
|
+
//# sourceMappingURL=~index-PKNbSTT-.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"~index-PKNbSTT-.js","sources":["../src/type-guard/_exports.ts"],"sourcesContent":["import type { AnyFunction, AnyObject } from 'yummies/utils/types';\n\nenum Type {\n Null = 'null',\n Undefined = 'undefined',\n NaN = 'nan',\n Object = '[object Object]',\n Array = '[object Array]',\n String = '[object String]',\n Number = '[object Number]',\n Boolean = '[object Boolean]',\n Function = '[object Function]',\n RegExp = '[object RegExp]',\n Symbol = '[object Symbol]',\n Infinite = 'infinite',\n Element = 'element',\n}\n\nfunction getType(value: unknown): Type {\n if (value === undefined) {\n return Type.Undefined;\n }\n if (value === null) {\n return Type.Null;\n }\n\n // handle DOM elements\n // @ts-expect-error\n if (value && (value.nodeType === 1 || value.nodeType === 9)) {\n return Type.Element;\n }\n\n const stringifiedValue = Object.prototype.toString.call(value);\n\n // handle NaN and Infinity\n if (stringifiedValue === Type.Number) {\n if (Number.isNaN(value as number)) {\n return Type.NaN;\n }\n if (!Number.isFinite(value as number)) {\n return Type.Infinite;\n }\n }\n\n return stringifiedValue as Type;\n}\n\nconst createTypeGuard =\n <T>(type: Type) =>\n (value: unknown): value is T =>\n getType(value) === type;\n\n/**\n * Check if a value is not null or undefined\n * @param value the value to check\n * @returns boolean\n */\nexport const isDefined = <T>(value: T | undefined | null): value is T =>\n value != null;\n\n/**\n * Check if a value is null\n * @param value the value to check\n * @returns boolean\n */\nexport const isNull = createTypeGuard<null>(Type.Null);\n\n/**\n * Check if a value is undefined\n * @param value the value to check\n * @returns boolean\n */\nexport const isUndefined = createTypeGuard<undefined>(Type.Undefined);\n\n/**\n * Check if a value is an object\n * @param value the value to check\n * @returns boolean\n */\nexport const isObject = createTypeGuard<AnyObject>(Type.Object);\n\n/**\n * Check if a value is an array\n * @param value the value to check\n * @returns boolean\n */\nexport const isArray = createTypeGuard<unknown[]>(Type.Array);\n\n/**\n * Check if a value is a string\n * @param value the value to check\n * @returns boolean\n */\nexport const isString = createTypeGuard<string>(Type.String);\n\n/**\n * Check if a value is a number\n * @param value the value to check\n * @returns boolean\n */\nexport const isNumber = createTypeGuard<number>(Type.Number);\n\n/**\n * Check if a value is a boolean\n * @param value the value to check\n * @returns boolean\n */\nexport const isBoolean = createTypeGuard<boolean>(Type.Boolean);\n\n/**\n * Check if a value is a function\n * @param value the value to check\n * @returns boolean\n */\nexport const isFunction = createTypeGuard<AnyFunction>(Type.Function);\n\n/**\n * Check if a value is a regular expression\n * @param value the value to check\n * @returns boolean\n */\nexport const isRegExp = createTypeGuard<RegExp>(Type.RegExp);\n\n/**\n * Check if a value is a DOM element\n * @param value the value to check\n * @returns boolean\n */\nexport const isElement = createTypeGuard<HTMLElement>(Type.Element);\n\n/**\n * Check if a value is NaN\n * @param value the value to check\n * @returns boolean\n */\nexport const isNaN = createTypeGuard<number>(Type.NaN) as (\n value: unknown,\n) => boolean;\n\n/**\n * Check if a value is infinity\n * @param value the value to check\n * @returns boolean\n */\nexport const isInfinite = createTypeGuard<number>(Type.Infinite) as (\n value: unknown,\n) => boolean;\n\n/**\n * Check if a value is a symbol\n * @param value the value to check\n * @returns boolean\n */\nexport const isSymbol = createTypeGuard<symbol>(Type.Symbol);\n"],"names":["getType","value","stringifiedValue","createTypeGuard","type","isDefined","isNull","isUndefined","isObject","isArray","isString","isNumber","isBoolean","isFunction","isRegExp","isElement","isNaN","isInfinite","isSymbol"],"mappings":"aAkBA,SAASA,EAAQC,EAAsB,CACrC,GAAIA,IAAU,OACZ,MAAO,YAET,GAAIA,IAAU,KACZ,MAAO,OAKT,GAAIA,IAAUA,EAAM,WAAa,GAAKA,EAAM,WAAa,GACvD,MAAO,UAGT,MAAMC,EAAmB,OAAO,UAAU,SAAS,KAAKD,CAAK,EAG7D,GAAIC,IAAqB,kBAAa,CACpC,GAAI,OAAO,MAAMD,CAAe,EAC9B,MAAO,MAET,GAAI,CAAC,OAAO,SAASA,CAAe,EAClC,MAAO,UAEX,CAEA,OAAOC,CACT,CAEA,MAAMC,EACAC,GACHH,GACCD,EAAQC,CAAK,IAAMG,EAOVC,EAAgBJ,GAC3BA,GAAS,KAOEK,EAASH,EAAsB,MAAA,EAO/BI,EAAcJ,EAA2B,WAAA,EAOzCK,EAAWL,EAA2B,iBAAA,EAOtCM,EAAUN,EAA2B,gBAAA,EAOrCO,EAAWP,EAAwB,iBAAA,EAOnCQ,EAAWR,EAAwB,iBAAA,EAOnCS,EAAYT,EAAyB,kBAAA,EAOrCU,EAAaV,EAA6B,mBAAA,EAO1CW,EAAWX,EAAwB,iBAAA,EAOnCY,EAAYZ,EAA6B,SAAA,EAOzCa,EAAQb,EAAwB,KAAA,EAShCc,EAAad,EAAwB,UAAA,EASrCe,EAAWf,EAAwB,iBAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const f=require("yummies/format"),r=require("yummies/type-guard"),s=(i,n)=>{const t={...s.defaultSettings,...n},l=t?.fallback??0;let e;if(r.typeGuard.isNumber(i))e=i;else if(r.typeGuard.isString(i)){const a=f.format.skipSpaces(i).replace(",",".");a===""?e=l:e=Number(a)}else e=l;return r.typeGuard.isNumber(e)?(t?.clamped!=null&&(e=Math.max(t.clamped[0]??-1/0,Math.min(e,t.clamped[1]??1/0))),t?.ceil!=null&&(e=Math.ceil(e)),t?.floor!=null&&(e=Math.floor(e)),t?.digits!=null&&(e=+e.toFixed(t.digits)),e):l};s.defaultSettings={};exports.number=s;
|
|
2
|
+
//# sourceMappingURL=~number-B1MpW9GU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"~number-B1MpW9GU.js","sources":["../src/parser/number.ts"],"sourcesContent":["import { format } from 'yummies/format';\nimport { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/utils/types';\n\nexport interface NumberParserSettings<TFallback = number> {\n digits?: number;\n fallback?: TFallback;\n /**\n * Round to upper boundary\n * 5.1 -> 6\n */\n ceil?: boolean;\n /**\n * Round to bottom boundary\n * 5.9 -> 5\n */\n floor?: boolean;\n clamped?: [min?: Maybe<number>, max?: Maybe<number>];\n}\n\nexport const number = <TFallback = number>(\n input: Maybe<unknown>,\n userSettings?: Maybe<NumberParserSettings<TFallback>>,\n): number | TFallback => {\n const settings = {\n ...number.defaultSettings,\n ...userSettings,\n };\n\n const fallback = settings?.fallback ?? 0;\n\n let result: number;\n\n if (typeGuard.isNumber(input)) {\n result = input;\n } else if (typeGuard.isString(input)) {\n const formattedInput = format.skipSpaces(input).replace(',', '.');\n if (formattedInput === '') {\n result = fallback as any;\n } else {\n result = Number(formattedInput);\n }\n } else {\n result = fallback as any;\n }\n\n if (typeGuard.isNumber(result)) {\n if (settings?.clamped != null) {\n result = Math.max(\n settings.clamped[0] ?? -Infinity,\n Math.min(result, settings.clamped[1] ?? Infinity),\n );\n }\n\n if (settings?.ceil != null) {\n result = Math.ceil(result);\n }\n\n if (settings?.floor != null) {\n result = Math.floor(result);\n }\n\n if (settings?.digits != null) {\n result = +result.toFixed(settings.digits);\n }\n\n return result;\n } else {\n return fallback;\n }\n};\n\nnumber.defaultSettings = {} as NumberParserSettings;\n"],"names":["number","input","userSettings","settings","fallback","result","typeGuard","formattedInput","format"],"mappings":"+EAoBaA,EAAS,CACpBC,EACAC,IACuB,CACvB,MAAMC,EAAW,CACf,GAAGH,EAAO,gBACV,GAAGE,CAAA,EAGCE,EAAWD,GAAU,UAAY,EAEvC,IAAIE,EAEJ,GAAIC,EAAAA,UAAU,SAASL,CAAK,EAC1BI,EAASJ,UACAK,EAAAA,UAAU,SAASL,CAAK,EAAG,CACpC,MAAMM,EAAiBC,EAAAA,OAAO,WAAWP,CAAK,EAAE,QAAQ,IAAK,GAAG,EAC5DM,IAAmB,GACrBF,EAASD,EAETC,EAAS,OAAOE,CAAc,CAElC,MACEF,EAASD,EAGX,OAAIE,EAAAA,UAAU,SAASD,CAAM,GACvBF,GAAU,SAAW,OACvBE,EAAS,KAAK,IACZF,EAAS,QAAQ,CAAC,GAAK,KACvB,KAAK,IAAIE,EAAQF,EAAS,QAAQ,CAAC,GAAK,GAAQ,CAAA,GAIhDA,GAAU,MAAQ,OACpBE,EAAS,KAAK,KAAKA,CAAM,GAGvBF,GAAU,OAAS,OACrBE,EAAS,KAAK,MAAMA,CAAM,GAGxBF,GAAU,QAAU,OACtBE,EAAS,CAACA,EAAO,QAAQF,EAAS,MAAM,GAGnCE,GAEAD,CAEX,EAEAJ,EAAO,gBAAkB,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const I=require("yummies/parser"),u=require("yummies/type-guard"),f="–",$="-",x="∞",n=(o,m)=>{const t={...n.defaultSettings,...m},a=t.digits??0,g=t?.cutZeros??!1,c=t.delimiter??" ",p=t.postfix??"",N=t.emptyText??f,y=t.digitsOnlyForFloat??!0;let e;if(u.typeGuard.isString(o)?e=I.parser.number(e,{fallback:void 0}):e=o,u.typeGuard.isNumber(e)){let s=`${e}`;a!==!1&&(s=e.toFixed(a)),g&&(s=`${+s}`);const[F,i]=s.split(".",2);let r=F,l="";i&&(!y||!/^0+$/.test(i))&&(l=`.${i}`);const d=/(\d+)(\d{3})/;for(;d.test(r)&&c;)r=r.replace(d,`$1${c}$2`);return r+l+p}return N};n.defaultSettings={};exports.HYPHEN=$;exports.INFINITY=x;exports.NO_VALUE=f;exports.number=n;
|
|
2
|
+
//# sourceMappingURL=~number-DX076ykA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"~number-DX076ykA.js","sources":["../src/format/constants.ts","../src/format/number.ts"],"sourcesContent":["export const NO_VALUE = '–'; // en-dash\n\nexport const HYPHEN = '-';\n\nexport const INFINITY = '∞';\n","import { parser } from 'yummies/parser';\nimport { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/utils/types';\nimport { NO_VALUE } from './constants.js';\n\nexport interface NumberFormatSettings {\n delimiter?: string;\n /**\n * digitsOnlyForFloat - Show digits after decimal point only if they are not zeros after converting to number.\n * Example: \"0.00\" -> \"0\", \"0.10\" -> \"0.1\", but \"0.003\" -> \"0.003\"\n *\n * @default true\n */\n digitsOnlyForFloat?: boolean;\n /**\n * Text which will be returned if the value is undefined, null, NaN, Infinity or empty string.\n * Example: \"–\" will be returned if the value is undefined and emptyText is \"–\".\n */\n emptyText?: string;\n /**\n * Text to append to the end of the formatted number.\n * Example: if value is 1000 and postfix is \"₽\", result will be \"1 000₽\".\n */\n postfix?: string;\n /**\n * Fixed number of digits after the decimal point (number.toFixed() method)\n * If set to false, the truncation is ignored!\n */\n digits?: number | false;\n /**\n * Remove trailing zeros from the end of the number\n * Example: 0.010000000000000000000000000000000000000000000 -> 0.01\n */\n cutZeros?: boolean;\n}\n\nexport const number = (\n rawValue: Maybe<string | number>,\n userSettings?: Maybe<NumberFormatSettings>,\n): string => {\n const settings = {\n ...number.defaultSettings,\n ...userSettings,\n };\n\n const digits = settings.digits ?? 0;\n const cutZeros = settings?.cutZeros ?? false;\n const delimiter = settings.delimiter ?? ' ';\n const postfix = settings.postfix ?? '';\n const emptyText = settings.emptyText ?? NO_VALUE;\n const digitsOnlyForFloat = settings.digitsOnlyForFloat ?? true;\n\n let value: Maybe<number>;\n\n if (typeGuard.isString(rawValue)) {\n value = parser.number(value, { fallback: undefined });\n } else {\n value = rawValue;\n }\n\n if (typeGuard.isNumber(value)) {\n let raw: string = `${value}`;\n\n if (digits !== false) {\n raw = value.toFixed(digits);\n }\n if (cutZeros) {\n raw = `${+raw}`;\n }\n\n const [integerPart, decimalPart] = raw.split('.', 2);\n\n let formattedIntegerPart = integerPart;\n let formattedDecimalPart = '';\n\n if (decimalPart && (!digitsOnlyForFloat || !/^0+$/.test(decimalPart))) {\n formattedDecimalPart = `.${decimalPart}`;\n }\n\n const rgx = /(\\d+)(\\d{3})/;\n\n while (rgx.test(formattedIntegerPart) && delimiter) {\n formattedIntegerPart = formattedIntegerPart.replace(\n rgx,\n `$1${delimiter}$2`,\n );\n }\n\n return formattedIntegerPart + formattedDecimalPart + postfix;\n }\n\n return emptyText;\n};\n\nnumber.defaultSettings = {} as NumberFormatSettings;\n"],"names":["NO_VALUE","HYPHEN","INFINITY","number","rawValue","userSettings","settings","digits","cutZeros","delimiter","postfix","emptyText","digitsOnlyForFloat","value","typeGuard","parser","raw","integerPart","decimalPart","formattedIntegerPart","formattedDecimalPart","rgx"],"mappings":"+EAAaA,EAAW,IAEXC,EAAS,IAETC,EAAW,ICgCXC,EAAS,CACpBC,EACAC,IACW,CACX,MAAMC,EAAW,CACf,GAAGH,EAAO,gBACV,GAAGE,CAAA,EAGCE,EAASD,EAAS,QAAU,EAC5BE,EAAWF,GAAU,UAAY,GACjCG,EAAYH,EAAS,WAAa,IAClCI,EAAUJ,EAAS,SAAW,GAC9BK,EAAYL,EAAS,WAAaN,EAClCY,EAAqBN,EAAS,oBAAsB,GAE1D,IAAIO,EAQJ,GANIC,EAAAA,UAAU,SAASV,CAAQ,EAC7BS,EAAQE,EAAAA,OAAO,OAAOF,EAAO,CAAE,SAAU,OAAW,EAEpDA,EAAQT,EAGNU,EAAAA,UAAU,SAASD,CAAK,EAAG,CAC7B,IAAIG,EAAc,GAAGH,CAAK,GAEtBN,IAAW,KACbS,EAAMH,EAAM,QAAQN,CAAM,GAExBC,IACFQ,EAAM,GAAG,CAACA,CAAG,IAGf,KAAM,CAACC,EAAaC,CAAW,EAAIF,EAAI,MAAM,IAAK,CAAC,EAEnD,IAAIG,EAAuBF,EACvBG,EAAuB,GAEvBF,IAAgB,CAACN,GAAsB,CAAC,OAAO,KAAKM,CAAW,KACjEE,EAAuB,IAAIF,CAAW,IAGxC,MAAMG,EAAM,eAEZ,KAAOA,EAAI,KAAKF,CAAoB,GAAKV,GACvCU,EAAuBA,EAAqB,QAC1CE,EACA,KAAKZ,CAAS,IAAA,EAIlB,OAAOU,EAAuBC,EAAuBV,CACvD,CAEA,OAAOC,CACT,EAEAR,EAAO,gBAAkB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { format as n } from "yummies/format";
|
|
2
|
+
import { typeGuard as r } from "yummies/type-guard";
|
|
3
|
+
const a = (l, f) => {
|
|
4
|
+
const t = {
|
|
5
|
+
...a.defaultSettings,
|
|
6
|
+
...f
|
|
7
|
+
}, i = t?.fallback ?? 0;
|
|
8
|
+
let e;
|
|
9
|
+
if (r.isNumber(l))
|
|
10
|
+
e = l;
|
|
11
|
+
else if (r.isString(l)) {
|
|
12
|
+
const s = n.skipSpaces(l).replace(",", ".");
|
|
13
|
+
s === "" ? e = i : e = Number(s);
|
|
14
|
+
} else
|
|
15
|
+
e = i;
|
|
16
|
+
return r.isNumber(e) ? (t?.clamped != null && (e = Math.max(
|
|
17
|
+
t.clamped[0] ?? -1 / 0,
|
|
18
|
+
Math.min(e, t.clamped[1] ?? 1 / 0)
|
|
19
|
+
)), t?.ceil != null && (e = Math.ceil(e)), t?.floor != null && (e = Math.floor(e)), t?.digits != null && (e = +e.toFixed(t.digits)), e) : i;
|
|
20
|
+
};
|
|
21
|
+
a.defaultSettings = {};
|
|
22
|
+
export {
|
|
23
|
+
a as n
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=~number-EWff2XI6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"~number-EWff2XI6.js","sources":["../src/parser/number.ts"],"sourcesContent":["import { format } from 'yummies/format';\nimport { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/utils/types';\n\nexport interface NumberParserSettings<TFallback = number> {\n digits?: number;\n fallback?: TFallback;\n /**\n * Round to upper boundary\n * 5.1 -> 6\n */\n ceil?: boolean;\n /**\n * Round to bottom boundary\n * 5.9 -> 5\n */\n floor?: boolean;\n clamped?: [min?: Maybe<number>, max?: Maybe<number>];\n}\n\nexport const number = <TFallback = number>(\n input: Maybe<unknown>,\n userSettings?: Maybe<NumberParserSettings<TFallback>>,\n): number | TFallback => {\n const settings = {\n ...number.defaultSettings,\n ...userSettings,\n };\n\n const fallback = settings?.fallback ?? 0;\n\n let result: number;\n\n if (typeGuard.isNumber(input)) {\n result = input;\n } else if (typeGuard.isString(input)) {\n const formattedInput = format.skipSpaces(input).replace(',', '.');\n if (formattedInput === '') {\n result = fallback as any;\n } else {\n result = Number(formattedInput);\n }\n } else {\n result = fallback as any;\n }\n\n if (typeGuard.isNumber(result)) {\n if (settings?.clamped != null) {\n result = Math.max(\n settings.clamped[0] ?? -Infinity,\n Math.min(result, settings.clamped[1] ?? Infinity),\n );\n }\n\n if (settings?.ceil != null) {\n result = Math.ceil(result);\n }\n\n if (settings?.floor != null) {\n result = Math.floor(result);\n }\n\n if (settings?.digits != null) {\n result = +result.toFixed(settings.digits);\n }\n\n return result;\n } else {\n return fallback;\n }\n};\n\nnumber.defaultSettings = {} as NumberParserSettings;\n"],"names":["number","input","userSettings","settings","fallback","result","typeGuard","formattedInput","format"],"mappings":";;AAoBO,MAAMA,IAAS,CACpBC,GACAC,MACuB;AACvB,QAAMC,IAAW;AAAA,IACf,GAAGH,EAAO;AAAA,IACV,GAAGE;AAAA,EAAA,GAGCE,IAAWD,GAAU,YAAY;AAEvC,MAAIE;AAEJ,MAAIC,EAAU,SAASL,CAAK;AAC1B,IAAAI,IAASJ;AAAA,WACAK,EAAU,SAASL,CAAK,GAAG;AACpC,UAAMM,IAAiBC,EAAO,WAAWP,CAAK,EAAE,QAAQ,KAAK,GAAG;AAChE,IAAIM,MAAmB,KACrBF,IAASD,IAETC,IAAS,OAAOE,CAAc;AAAA,EAElC;AACE,IAAAF,IAASD;AAGX,SAAIE,EAAU,SAASD,CAAM,KACvBF,GAAU,WAAW,SACvBE,IAAS,KAAK;AAAA,IACZF,EAAS,QAAQ,CAAC,KAAK;AAAA,IACvB,KAAK,IAAIE,GAAQF,EAAS,QAAQ,CAAC,KAAK,KAAQ;AAAA,EAAA,IAIhDA,GAAU,QAAQ,SACpBE,IAAS,KAAK,KAAKA,CAAM,IAGvBF,GAAU,SAAS,SACrBE,IAAS,KAAK,MAAMA,CAAM,IAGxBF,GAAU,UAAU,SACtBE,IAAS,CAACA,EAAO,QAAQF,EAAS,MAAM,IAGnCE,KAEAD;AAEX;AAEAJ,EAAO,kBAAkB,CAAA;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { parser as F } from "yummies/parser";
|
|
2
|
+
import { typeGuard as d } from "yummies/type-guard";
|
|
3
|
+
const N = "–", P = "-", b = "∞", f = (o, m) => {
|
|
4
|
+
const t = {
|
|
5
|
+
...f.defaultSettings,
|
|
6
|
+
...m
|
|
7
|
+
}, n = t.digits ?? 0, g = t?.cutZeros ?? !1, a = t.delimiter ?? " ", p = t.postfix ?? "", u = t.emptyText ?? N, x = t.digitsOnlyForFloat ?? !0;
|
|
8
|
+
let e;
|
|
9
|
+
if (d.isString(o) ? e = F.number(e, { fallback: void 0 }) : e = o, d.isNumber(e)) {
|
|
10
|
+
let s = `${e}`;
|
|
11
|
+
n !== !1 && (s = e.toFixed(n)), g && (s = `${+s}`);
|
|
12
|
+
const [$, r] = s.split(".", 2);
|
|
13
|
+
let i = $, l = "";
|
|
14
|
+
r && (!x || !/^0+$/.test(r)) && (l = `.${r}`);
|
|
15
|
+
const c = /(\d+)(\d{3})/;
|
|
16
|
+
for (; c.test(i) && a; )
|
|
17
|
+
i = i.replace(
|
|
18
|
+
c,
|
|
19
|
+
`$1${a}$2`
|
|
20
|
+
);
|
|
21
|
+
return i + l + p;
|
|
22
|
+
}
|
|
23
|
+
return u;
|
|
24
|
+
};
|
|
25
|
+
f.defaultSettings = {};
|
|
26
|
+
export {
|
|
27
|
+
P as H,
|
|
28
|
+
b as I,
|
|
29
|
+
N,
|
|
30
|
+
f as n
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=~number-baxVnzrJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"~number-baxVnzrJ.js","sources":["../src/format/constants.ts","../src/format/number.ts"],"sourcesContent":["export const NO_VALUE = '–'; // en-dash\n\nexport const HYPHEN = '-';\n\nexport const INFINITY = '∞';\n","import { parser } from 'yummies/parser';\nimport { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/utils/types';\nimport { NO_VALUE } from './constants.js';\n\nexport interface NumberFormatSettings {\n delimiter?: string;\n /**\n * digitsOnlyForFloat - Show digits after decimal point only if they are not zeros after converting to number.\n * Example: \"0.00\" -> \"0\", \"0.10\" -> \"0.1\", but \"0.003\" -> \"0.003\"\n *\n * @default true\n */\n digitsOnlyForFloat?: boolean;\n /**\n * Text which will be returned if the value is undefined, null, NaN, Infinity or empty string.\n * Example: \"–\" will be returned if the value is undefined and emptyText is \"–\".\n */\n emptyText?: string;\n /**\n * Text to append to the end of the formatted number.\n * Example: if value is 1000 and postfix is \"₽\", result will be \"1 000₽\".\n */\n postfix?: string;\n /**\n * Fixed number of digits after the decimal point (number.toFixed() method)\n * If set to false, the truncation is ignored!\n */\n digits?: number | false;\n /**\n * Remove trailing zeros from the end of the number\n * Example: 0.010000000000000000000000000000000000000000000 -> 0.01\n */\n cutZeros?: boolean;\n}\n\nexport const number = (\n rawValue: Maybe<string | number>,\n userSettings?: Maybe<NumberFormatSettings>,\n): string => {\n const settings = {\n ...number.defaultSettings,\n ...userSettings,\n };\n\n const digits = settings.digits ?? 0;\n const cutZeros = settings?.cutZeros ?? false;\n const delimiter = settings.delimiter ?? ' ';\n const postfix = settings.postfix ?? '';\n const emptyText = settings.emptyText ?? NO_VALUE;\n const digitsOnlyForFloat = settings.digitsOnlyForFloat ?? true;\n\n let value: Maybe<number>;\n\n if (typeGuard.isString(rawValue)) {\n value = parser.number(value, { fallback: undefined });\n } else {\n value = rawValue;\n }\n\n if (typeGuard.isNumber(value)) {\n let raw: string = `${value}`;\n\n if (digits !== false) {\n raw = value.toFixed(digits);\n }\n if (cutZeros) {\n raw = `${+raw}`;\n }\n\n const [integerPart, decimalPart] = raw.split('.', 2);\n\n let formattedIntegerPart = integerPart;\n let formattedDecimalPart = '';\n\n if (decimalPart && (!digitsOnlyForFloat || !/^0+$/.test(decimalPart))) {\n formattedDecimalPart = `.${decimalPart}`;\n }\n\n const rgx = /(\\d+)(\\d{3})/;\n\n while (rgx.test(formattedIntegerPart) && delimiter) {\n formattedIntegerPart = formattedIntegerPart.replace(\n rgx,\n `$1${delimiter}$2`,\n );\n }\n\n return formattedIntegerPart + formattedDecimalPart + postfix;\n }\n\n return emptyText;\n};\n\nnumber.defaultSettings = {} as NumberFormatSettings;\n"],"names":["NO_VALUE","HYPHEN","INFINITY","number","rawValue","userSettings","settings","digits","cutZeros","delimiter","postfix","emptyText","digitsOnlyForFloat","value","typeGuard","parser","raw","integerPart","decimalPart","formattedIntegerPart","formattedDecimalPart","rgx"],"mappings":";;AAAO,MAAMA,IAAW,KAEXC,IAAS,KAETC,IAAW,KCgCXC,IAAS,CACpBC,GACAC,MACW;AACX,QAAMC,IAAW;AAAA,IACf,GAAGH,EAAO;AAAA,IACV,GAAGE;AAAA,EAAA,GAGCE,IAASD,EAAS,UAAU,GAC5BE,IAAWF,GAAU,YAAY,IACjCG,IAAYH,EAAS,aAAa,KAClCI,IAAUJ,EAAS,WAAW,IAC9BK,IAAYL,EAAS,aAAaN,GAClCY,IAAqBN,EAAS,sBAAsB;AAE1D,MAAIO;AAQJ,MANIC,EAAU,SAASV,CAAQ,IAC7BS,IAAQE,EAAO,OAAOF,GAAO,EAAE,UAAU,QAAW,IAEpDA,IAAQT,GAGNU,EAAU,SAASD,CAAK,GAAG;AAC7B,QAAIG,IAAc,GAAGH,CAAK;AAE1B,IAAIN,MAAW,OACbS,IAAMH,EAAM,QAAQN,CAAM,IAExBC,MACFQ,IAAM,GAAG,CAACA,CAAG;AAGf,UAAM,CAACC,GAAaC,CAAW,IAAIF,EAAI,MAAM,KAAK,CAAC;AAEnD,QAAIG,IAAuBF,GACvBG,IAAuB;AAE3B,IAAIF,MAAgB,CAACN,KAAsB,CAAC,OAAO,KAAKM,CAAW,OACjEE,IAAuB,IAAIF,CAAW;AAGxC,UAAMG,IAAM;AAEZ,WAAOA,EAAI,KAAKF,CAAoB,KAAKV;AACvC,MAAAU,IAAuBA,EAAqB;AAAA,QAC1CE;AAAA,QACA,KAAKZ,CAAS;AAAA,MAAA;AAIlB,WAAOU,IAAuBC,IAAuBV;AAAA,EACvD;AAEA,SAAOC;AACT;AAEAR,EAAO,kBAAkB,CAAA;"}
|
package/async.d.cts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Создает промис, который будет ждать указанное количество ms, чтобы выполниться
|
|
3
|
-
*
|
|
4
|
-
* @param ms значение в миллисекундах
|
|
5
|
-
* @returns Promise
|
|
6
|
-
*/
|
|
7
|
-
export declare const sleep: (time?: number) => Promise<unknown>;
|
|
8
|
-
/**
|
|
9
|
-
* Создает промис, который будет ждать указанное количество ms, чтобы выполниться
|
|
10
|
-
*
|
|
11
|
-
* @deprecated используй {sleep}
|
|
12
|
-
* @param ms значение в миллисекундах
|
|
13
|
-
* @returns Promise
|
|
14
|
-
*/
|
|
15
|
-
export declare const waitAsync: (ms?: number) => Promise<unknown>;
|
|
16
|
-
/**
|
|
17
|
-
* Создает вызов requestAnimationFrame, посылая туда фукнцию {quitFn}, если она возвращает true,
|
|
18
|
-
* тогда повторно не будет создан вызов requestAnimationFrame, иначе будут создаваться повторно
|
|
19
|
-
* вызовы requestAnimationFrame до тем пор, пока эта функция не вернёт true
|
|
20
|
-
*
|
|
21
|
-
* @param quitFn - сама фукнция которая исполнится в requestAnimationFrame
|
|
22
|
-
* @param asMicrotask - дополнительно оборачивает RAF в queueMicrotask
|
|
23
|
-
* @returns void
|
|
24
|
-
*/
|
|
25
|
-
export declare const endlessRAF: (quitFunction: () => boolean | void, asMicrotask?: boolean) => void;
|
|
26
|
-
export declare function setAbortableTimeout(callback: VoidFunction, delayInMs?: number, signal?: AbortSignal): void;
|
|
27
|
-
export declare function setAbortableInterval(callback: VoidFunction, delayInMs?: number, signal?: AbortSignal): void;
|
|
28
|
-
//# sourceMappingURL=async.d.ts.map
|
package/async.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"async.d.ts","sourceRoot":"","sources":["../src/async.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAAI,OAAM,MAAU,qBACe,CAAC;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GAAU,WAAS,qBACU,CAAC;AAEpD;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GACrB,cAAc,MAAM,OAAO,GAAG,IAAI,EAClC,cAAc,OAAO,SAYtB,CAAC;AAEF,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,YAAY,EACtB,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,WAAW,QAkBrB;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,YAAY,EACtB,SAAS,CAAC,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,WAAW,QAerB"}
|
package/common.d.cts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { MaybeFn } from "./utils/types.cjs";
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated use {MaybeFn} type
|
|
4
|
-
*/
|
|
5
|
-
export type FnValue<TValue, TArgs extends any[] = []> = MaybeFn<TValue, TArgs>;
|
|
6
|
-
/**
|
|
7
|
-
* Calls the provided function with the given arguments if it is a function;
|
|
8
|
-
* otherwise, returns the value directly.
|
|
9
|
-
*/
|
|
10
|
-
export declare const callFunction: <TValue, TArgs extends any[] = []>(fn: MaybeFn<TValue, TArgs>, ...args: TArgs) => TValue;
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated use {callFunction}
|
|
13
|
-
*/
|
|
14
|
-
export declare const resolveFnValue: <TValue, TArgs extends any[] = []>(fn: MaybeFn<TValue, TArgs>, ...args: TArgs) => TValue;
|
|
15
|
-
//# sourceMappingURL=common.d.ts.map
|
package/common.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,0BAAyB;AAEhD;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,MAAM,EAAE,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,IAAI,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,EAAE,KAAK,SAAS,GAAG,EAAE,GAAG,EAAE,EAC3D,IAAI,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,EAC1B,GAAG,MAAM,KAAK,WAOf,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAdE,MAAM,EAAE,KAAK,SAAS,GAAG,EAAE,WAClD,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,WACjB,KAAK,WAY0B,CAAC"}
|
package/complex/counter.cjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createCounter = void 0;
|
|
4
|
-
const createCounter = (processValue, initial = 0) => {
|
|
5
|
-
const update = (counter) => {
|
|
6
|
-
fn.value = processValue?.(counter) ?? counter;
|
|
7
|
-
return fn.value;
|
|
8
|
-
};
|
|
9
|
-
const increment = () => update(++fn.counter);
|
|
10
|
-
const decrement = () => update(--fn.counter);
|
|
11
|
-
const fn = increment;
|
|
12
|
-
fn.increment = increment;
|
|
13
|
-
fn.decrement = decrement;
|
|
14
|
-
fn.reset = () => {
|
|
15
|
-
fn.counter = initial;
|
|
16
|
-
fn.value = processValue?.(initial) ?? initial;
|
|
17
|
-
};
|
|
18
|
-
fn.reset();
|
|
19
|
-
return fn;
|
|
20
|
-
};
|
|
21
|
-
exports.createCounter = createCounter;
|
package/complex/counter.d.cts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export interface Counter<TValue = number> {
|
|
2
|
-
(): TValue;
|
|
3
|
-
counter: number;
|
|
4
|
-
value: TValue;
|
|
5
|
-
increment(): TValue;
|
|
6
|
-
decrement(): TValue;
|
|
7
|
-
reset(): void;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated use {`Counter`}. Will be removed in next major release
|
|
11
|
-
*/
|
|
12
|
-
export interface CounterFn<TValue = number> extends Counter<TValue> {
|
|
13
|
-
}
|
|
14
|
-
export declare const createCounter: <TValue = number>(processValue?: (value: number) => TValue, initial?: number) => Counter<TValue>;
|
|
15
|
-
//# sourceMappingURL=counter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"counter.d.ts","sourceRoot":"","sources":["../../src/complex/counter.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO,CAAC,MAAM,GAAG,MAAM;IACtC,IAAI,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,IAAI,MAAM,CAAC;IACpB,SAAS,IAAI,MAAM,CAAC;IACpB,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,MAAM,GAAG,MAAM,CAAE,SAAQ,OAAO,CAAC,MAAM,CAAC;CAAG;AAEtE,eAAO,MAAM,aAAa,GAAI,MAAM,GAAG,MAAM,EAC3C,eAAe,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,EACxC,UAAS,MAAU,KAClB,OAAO,CAAC,MAAM,CAsBhB,CAAC"}
|
package/complex/counter.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export const createCounter = (processValue, initial = 0) => {
|
|
2
|
-
const update = (counter) => {
|
|
3
|
-
fn.value = processValue?.(counter) ?? counter;
|
|
4
|
-
return fn.value;
|
|
5
|
-
};
|
|
6
|
-
const increment = () => update(++fn.counter);
|
|
7
|
-
const decrement = () => update(--fn.counter);
|
|
8
|
-
const fn = increment;
|
|
9
|
-
fn.increment = increment;
|
|
10
|
-
fn.decrement = decrement;
|
|
11
|
-
fn.reset = () => {
|
|
12
|
-
fn.counter = initial;
|
|
13
|
-
fn.value = processValue?.(initial) ?? initial;
|
|
14
|
-
};
|
|
15
|
-
fn.reset();
|
|
16
|
-
return fn;
|
|
17
|
-
};
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createGlobalDynamicConfig = exports.createGlobalConfig = void 0;
|
|
4
|
-
const createGlobalPoint = (accessSymbol) => {
|
|
5
|
-
if (accessSymbol == null) {
|
|
6
|
-
let storedValue;
|
|
7
|
-
return {
|
|
8
|
-
get: () => storedValue,
|
|
9
|
-
set: (value) => {
|
|
10
|
-
storedValue = value;
|
|
11
|
-
return value;
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
const _globalThis = globalThis;
|
|
16
|
-
return {
|
|
17
|
-
get: () => _globalThis[accessSymbol],
|
|
18
|
-
set: (value) => {
|
|
19
|
-
_globalThis[accessSymbol] = value;
|
|
20
|
-
return value;
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Создает глобальный конфиг, который может быть доступен в любой точке в коде
|
|
26
|
-
*/
|
|
27
|
-
const createGlobalConfig = (defaultValue, accessSymbol) => {
|
|
28
|
-
const globalPoint = createGlobalPoint(accessSymbol);
|
|
29
|
-
return globalPoint.get() || globalPoint.set(defaultValue);
|
|
30
|
-
};
|
|
31
|
-
exports.createGlobalConfig = createGlobalConfig;
|
|
32
|
-
const createGlobalDynamicConfig = (processFn, accessSymbol) => {
|
|
33
|
-
const globalPoint = createGlobalPoint(accessSymbol);
|
|
34
|
-
const getValue = () => {
|
|
35
|
-
return globalPoint.get() ?? globalPoint.set(processFn(null, null));
|
|
36
|
-
};
|
|
37
|
-
return {
|
|
38
|
-
get: getValue,
|
|
39
|
-
set: globalPoint.set,
|
|
40
|
-
update: (value) => {
|
|
41
|
-
const currentValue = getValue();
|
|
42
|
-
Object.assign(currentValue, processFn(value, currentValue));
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
exports.createGlobalDynamicConfig = createGlobalDynamicConfig;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { AnyObject, Maybe } from "../utils/types.cjs";
|
|
2
|
-
/**
|
|
3
|
-
* Создает глобальный конфиг, который может быть доступен в любой точке в коде
|
|
4
|
-
*/
|
|
5
|
-
export declare const createGlobalConfig: <T extends AnyObject>(defaultValue: T, accessSymbol?: keyof any) => T;
|
|
6
|
-
export declare const createGlobalDynamicConfig: <T extends AnyObject>(processFn: (change: Maybe<Partial<T>>, current: Maybe<T>) => T, accessSymbol?: keyof any) => {
|
|
7
|
-
get: () => T;
|
|
8
|
-
set: (value: T | null | undefined) => T | null | undefined;
|
|
9
|
-
update: (value: Partial<T>) => void;
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=global-config.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"global-config.d.ts","sourceRoot":"","sources":["../../src/complex/global-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,2BAA0B;AAyB1D;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,CAAC,SAAS,SAAS,EACpD,cAAc,CAAC,EACf,eAAe,MAAM,GAAG,MAIzB,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,CAAC,SAAS,SAAS,EAC3D,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAC9D,eAAe,MAAM,GAAG;;;oBAWN,OAAO,CAAC,CAAC,CAAC;CAK7B,CAAC"}
|
package/complex/global-config.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
const createGlobalPoint = (accessSymbol) => {
|
|
2
|
-
if (accessSymbol == null) {
|
|
3
|
-
let storedValue;
|
|
4
|
-
return {
|
|
5
|
-
get: () => storedValue,
|
|
6
|
-
set: (value) => {
|
|
7
|
-
storedValue = value;
|
|
8
|
-
return value;
|
|
9
|
-
},
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
const _globalThis = globalThis;
|
|
13
|
-
return {
|
|
14
|
-
get: () => _globalThis[accessSymbol],
|
|
15
|
-
set: (value) => {
|
|
16
|
-
_globalThis[accessSymbol] = value;
|
|
17
|
-
return value;
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Создает глобальный конфиг, который может быть доступен в любой точке в коде
|
|
23
|
-
*/
|
|
24
|
-
export const createGlobalConfig = (defaultValue, accessSymbol) => {
|
|
25
|
-
const globalPoint = createGlobalPoint(accessSymbol);
|
|
26
|
-
return globalPoint.get() || globalPoint.set(defaultValue);
|
|
27
|
-
};
|
|
28
|
-
export const createGlobalDynamicConfig = (processFn, accessSymbol) => {
|
|
29
|
-
const globalPoint = createGlobalPoint(accessSymbol);
|
|
30
|
-
const getValue = () => {
|
|
31
|
-
return globalPoint.get() ?? globalPoint.set(processFn(null, null));
|
|
32
|
-
};
|
|
33
|
-
return {
|
|
34
|
-
get: getValue,
|
|
35
|
-
set: globalPoint.set,
|
|
36
|
-
update: (value) => {
|
|
37
|
-
const currentValue = getValue();
|
|
38
|
-
Object.assign(currentValue, processFn(value, currentValue));
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
};
|
package/complex/index.cjs
DELETED
|
@@ -1,19 +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("./counter.cjs"), exports);
|
|
18
|
-
__exportStar(require("./global-config.cjs"), exports);
|
|
19
|
-
__exportStar(require("./modules-factory.cjs"), exports);
|
package/complex/index.d.cts
DELETED
package/complex/index.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/complex/index.ts"],"names":[],"mappings":"AAAA,8BAA6B;AAC7B,oCAAmC;AACnC,sCAAqC"}
|
package/complex/index.js
DELETED