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/ms.cjs
CHANGED
|
@@ -1,22 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.ms = exports.unitsToMs = void 0;
|
|
4
|
-
exports.unitsToMs = {
|
|
5
|
-
ms: 1,
|
|
6
|
-
sec: 1000,
|
|
7
|
-
min: 1000 * 60,
|
|
8
|
-
hour: 1000 * 60 * 60,
|
|
9
|
-
day: 1000 * 60 * 60 * 24,
|
|
10
|
-
week: 1000 * 60 * 60 * 24 * 7,
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Переводит значение в юнитах в миллисекунды
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* ms(1, 'min') // 60_000
|
|
18
|
-
* ms(30, 'sec') // 30_000
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
const ms = (value, unit = 'ms') => value * exports.unitsToMs[unit];
|
|
22
|
-
exports.ms = ms;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={ms:1,sec:1e3,min:1e3*60,hour:1e3*60*60,day:1e3*60*60*24,week:1e3*60*60*24*7},o=(s,t="ms")=>s*e[t];exports.ms=o;exports.unitsToMs=e;
|
|
2
|
+
//# sourceMappingURL=ms.cjs.map
|
package/ms.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ms.cjs","sources":["../src/ms.ts"],"sourcesContent":["export const unitsToMs = {\n ms: 1,\n sec: 1000,\n min: 1000 * 60,\n hour: 1000 * 60 * 60,\n day: 1000 * 60 * 60 * 24,\n week: 1000 * 60 * 60 * 24 * 7,\n} as const;\n\n/**\n * Переводит значение в юнитах в миллисекунды\n *\n * @example\n * ```ts\n * ms(1, 'min') // 60_000\n * ms(30, 'sec') // 30_000\n * ```\n */\nexport const ms = (value: number, unit: keyof typeof unitsToMs = 'ms') =>\n value * unitsToMs[unit];\n"],"names":["unitsToMs","ms","value","unit"],"mappings":"gFAAO,MAAMA,EAAY,CACvB,GAAI,EACJ,IAAK,IACL,IAAK,IAAO,GACZ,KAAM,IAAO,GAAK,GAClB,IAAK,IAAO,GAAK,GAAK,GACtB,KAAM,IAAO,GAAK,GAAK,GAAK,CAC9B,EAWaC,EAAK,CAACC,EAAeC,EAA+B,OAC/DD,EAAQF,EAAUG,CAAI"}
|
package/ms.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
const o = {
|
|
2
|
+
ms: 1,
|
|
3
|
+
sec: 1e3,
|
|
4
|
+
min: 6e4,
|
|
5
|
+
hour: 36e5,
|
|
6
|
+
day: 864e5,
|
|
7
|
+
week: 6048e5
|
|
8
|
+
}, m = (e, s = "ms") => e * o[s];
|
|
9
|
+
export {
|
|
10
|
+
m as ms,
|
|
11
|
+
o as unitsToMs
|
|
8
12
|
};
|
|
9
|
-
|
|
10
|
-
* Переводит значение в юнитах в миллисекунды
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* ms(1, 'min') // 60_000
|
|
15
|
-
* ms(30, 'sec') // 30_000
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export const ms = (value, unit = 'ms') => value * unitsToMs[unit];
|
|
13
|
+
//# sourceMappingURL=ms.js.map
|
package/ms.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ms.js","sources":["../src/ms.ts"],"sourcesContent":["export const unitsToMs = {\n ms: 1,\n sec: 1000,\n min: 1000 * 60,\n hour: 1000 * 60 * 60,\n day: 1000 * 60 * 60 * 24,\n week: 1000 * 60 * 60 * 24 * 7,\n} as const;\n\n/**\n * Переводит значение в юнитах в миллисекунды\n *\n * @example\n * ```ts\n * ms(1, 'min') // 60_000\n * ms(30, 'sec') // 30_000\n * ```\n */\nexport const ms = (value: number, unit: keyof typeof unitsToMs = 'ms') =>\n value * unitsToMs[unit];\n"],"names":["unitsToMs","ms","value","unit"],"mappings":"AAAO,MAAMA,IAAY;AAAA,EACvB,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AACR,GAWaC,IAAK,CAACC,GAAeC,IAA+B,SAC/DD,IAAQF,EAAUG,CAAI;"}
|
package/number.cjs
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.round = round;
|
|
4
|
-
/**
|
|
5
|
-
* Works like `parseFloat(number.toFixed(4))` but performance better
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* round(191.212999999999999999999999, 4) // 191.213
|
|
9
|
-
*/
|
|
10
|
-
function round(value, decimalPlaces = 0) {
|
|
11
|
-
if (!decimalPlaces) {
|
|
12
|
-
return Math.round(value);
|
|
13
|
-
}
|
|
14
|
-
const factor = 10 ** decimalPlaces;
|
|
15
|
-
return Math.round(value * factor) / factor;
|
|
16
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function o(r,t=0){if(!t)return Math.round(r);const n=10**t;return Math.round(r*n)/n}exports.round=o;
|
|
2
|
+
//# sourceMappingURL=number.cjs.map
|
package/number.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.cjs","sources":["../src/number.ts"],"sourcesContent":["/**\n * Works like `parseFloat(number.toFixed(4))` but performance better\n *\n * @example\n * round(191.212999999999999999999999, 4) // 191.213\n */\nexport function round(value: number, decimalPlaces: number = 0): number {\n if (!decimalPlaces) {\n return Math.round(value);\n }\n\n const factor = 10 ** decimalPlaces;\n return Math.round(value * factor) / factor;\n}\n"],"names":["round","value","decimalPlaces","factor"],"mappings":"gFAMO,SAASA,EAAMC,EAAeC,EAAwB,EAAW,CACtE,GAAI,CAACA,EACH,OAAO,KAAK,MAAMD,CAAK,EAGzB,MAAME,EAAS,IAAMD,EACrB,OAAO,KAAK,MAAMD,EAAQE,CAAM,EAAIA,CACtC"}
|
package/number.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
export function round(value, decimalPlaces = 0) {
|
|
8
|
-
if (!decimalPlaces) {
|
|
9
|
-
return Math.round(value);
|
|
10
|
-
}
|
|
11
|
-
const factor = 10 ** decimalPlaces;
|
|
12
|
-
return Math.round(value * factor) / factor;
|
|
1
|
+
function o(r, n = 0) {
|
|
2
|
+
if (!n)
|
|
3
|
+
return Math.round(r);
|
|
4
|
+
const t = 10 ** n;
|
|
5
|
+
return Math.round(r * t) / t;
|
|
13
6
|
}
|
|
7
|
+
export {
|
|
8
|
+
o as round
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=number.js.map
|
package/number.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.js","sources":["../src/number.ts"],"sourcesContent":["/**\n * Works like `parseFloat(number.toFixed(4))` but performance better\n *\n * @example\n * round(191.212999999999999999999999, 4) // 191.213\n */\nexport function round(value: number, decimalPlaces: number = 0): number {\n if (!decimalPlaces) {\n return Math.round(value);\n }\n\n const factor = 10 ** decimalPlaces;\n return Math.round(value * factor) / factor;\n}\n"],"names":["round","value","decimalPlaces","factor"],"mappings":"AAMO,SAASA,EAAMC,GAAeC,IAAwB,GAAW;AACtE,MAAI,CAACA;AACH,WAAO,KAAK,MAAMD,CAAK;AAGzB,QAAME,IAAS,MAAMD;AACrB,SAAO,KAAK,MAAMD,IAAQE,CAAM,IAAIA;AACtC;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "yummies",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"javascript",
|
|
6
6
|
"typescript",
|
|
@@ -47,174 +47,205 @@
|
|
|
47
47
|
"@vitest/coverage-istanbul": "^3.1.2",
|
|
48
48
|
"commitfmt": "^1.0.4",
|
|
49
49
|
"js2me-biome-config": "^1.0.3",
|
|
50
|
-
"sborshik": "^1.0.10",
|
|
51
50
|
"jsdom": "^26.1.0",
|
|
52
51
|
"lefthook": "^1.11.16",
|
|
53
52
|
"nodemon": "^3.1.9",
|
|
54
53
|
"rimraf": "^6.0.1",
|
|
54
|
+
"sborshik": "^1.0.22",
|
|
55
55
|
"tsx": "^4.20.5",
|
|
56
56
|
"typescript": "^5.8.3",
|
|
57
|
+
"vite": "^7.1.9",
|
|
58
|
+
"vite-plugin-dts": "^4.5.4",
|
|
57
59
|
"vitest": "^3.1.2",
|
|
58
60
|
"zshy": "^0.4.2"
|
|
59
61
|
},
|
|
60
62
|
"type": "module",
|
|
61
|
-
"files": [
|
|
62
|
-
"*"
|
|
63
|
-
],
|
|
64
63
|
"exports": {
|
|
65
|
-
"./package.json": "./package.json",
|
|
66
|
-
"./complex": {
|
|
67
|
-
"types": "./complex/index.d.cts",
|
|
68
|
-
"import": "./complex/index.js",
|
|
69
|
-
"require": "./complex/index.cjs"
|
|
70
|
-
},
|
|
71
|
-
"./format": {
|
|
72
|
-
"types": "./format/index.d.cts",
|
|
73
|
-
"import": "./format/index.js",
|
|
74
|
-
"require": "./format/index.cjs"
|
|
75
|
-
},
|
|
76
|
-
"./mobx": {
|
|
77
|
-
"types": "./mobx/index.d.cts",
|
|
78
|
-
"import": "./mobx/index.js",
|
|
79
|
-
"require": "./mobx/index.cjs"
|
|
80
|
-
},
|
|
81
|
-
"./parser": {
|
|
82
|
-
"types": "./parser/index.d.cts",
|
|
83
|
-
"import": "./parser/index.js",
|
|
84
|
-
"require": "./parser/index.cjs"
|
|
85
|
-
},
|
|
86
|
-
"./react": {
|
|
87
|
-
"types": "./react/index.d.cts",
|
|
88
|
-
"import": "./react/index.js",
|
|
89
|
-
"require": "./react/index.cjs"
|
|
90
|
-
},
|
|
91
|
-
"./type-guard": {
|
|
92
|
-
"types": "./type-guard/index.d.cts",
|
|
93
|
-
"import": "./type-guard/index.js",
|
|
94
|
-
"require": "./type-guard/index.cjs"
|
|
95
|
-
},
|
|
96
|
-
"./utils/types": {
|
|
97
|
-
"types": "./utils/types.d.cts",
|
|
98
|
-
"import": "./utils/types.js",
|
|
99
|
-
"require": "./utils/types.cjs"
|
|
100
|
-
},
|
|
101
64
|
"./async": {
|
|
102
|
-
"types": "./async.d.cts",
|
|
103
65
|
"import": "./async.js",
|
|
66
|
+
"default": "./async.js",
|
|
67
|
+
"types": "./async.d.ts",
|
|
104
68
|
"require": "./async.cjs"
|
|
105
69
|
},
|
|
106
70
|
"./common": {
|
|
107
|
-
"types": "./common.d.cts",
|
|
108
71
|
"import": "./common.js",
|
|
72
|
+
"default": "./common.js",
|
|
73
|
+
"types": "./common.d.ts",
|
|
109
74
|
"require": "./common.cjs"
|
|
110
75
|
},
|
|
76
|
+
"./complex": {
|
|
77
|
+
"import": "./complex.js",
|
|
78
|
+
"default": "./complex.js",
|
|
79
|
+
"types": "./complex/index.d.ts",
|
|
80
|
+
"require": "./complex.cjs"
|
|
81
|
+
},
|
|
111
82
|
"./cookie": {
|
|
112
|
-
"types": "./cookie.d.cts",
|
|
113
83
|
"import": "./cookie.js",
|
|
84
|
+
"default": "./cookie.js",
|
|
85
|
+
"types": "./cookie.d.ts",
|
|
114
86
|
"require": "./cookie.cjs"
|
|
115
87
|
},
|
|
116
88
|
"./css": {
|
|
117
|
-
"types": "./css.d.cts",
|
|
118
89
|
"import": "./css.js",
|
|
90
|
+
"default": "./css.js",
|
|
91
|
+
"types": "./css.d.ts",
|
|
119
92
|
"require": "./css.cjs"
|
|
120
93
|
},
|
|
121
94
|
"./data": {
|
|
122
|
-
"types": "./data.d.cts",
|
|
123
95
|
"import": "./data.js",
|
|
96
|
+
"default": "./data.js",
|
|
97
|
+
"types": "./data.d.ts",
|
|
124
98
|
"require": "./data.cjs"
|
|
125
99
|
},
|
|
126
100
|
"./date-time": {
|
|
127
|
-
"types": "./date-time.d.cts",
|
|
128
101
|
"import": "./date-time.js",
|
|
102
|
+
"default": "./date-time.js",
|
|
103
|
+
"types": "./date-time.d.ts",
|
|
129
104
|
"require": "./date-time.cjs"
|
|
130
105
|
},
|
|
131
106
|
"./device": {
|
|
132
|
-
"types": "./device.d.cts",
|
|
133
107
|
"import": "./device.js",
|
|
108
|
+
"default": "./device.js",
|
|
109
|
+
"types": "./device.d.ts",
|
|
134
110
|
"require": "./device.cjs"
|
|
135
111
|
},
|
|
136
112
|
"./encodings": {
|
|
137
|
-
"types": "./encodings.d.cts",
|
|
138
113
|
"import": "./encodings.js",
|
|
114
|
+
"default": "./encodings.js",
|
|
115
|
+
"types": "./encodings.d.ts",
|
|
139
116
|
"require": "./encodings.cjs"
|
|
140
117
|
},
|
|
141
118
|
"./errors": {
|
|
142
|
-
"types": "./errors.d.cts",
|
|
143
119
|
"import": "./errors.js",
|
|
120
|
+
"default": "./errors.js",
|
|
121
|
+
"types": "./errors.d.ts",
|
|
144
122
|
"require": "./errors.cjs"
|
|
145
123
|
},
|
|
146
124
|
"./file": {
|
|
147
|
-
"types": "./file.d.cts",
|
|
148
125
|
"import": "./file.js",
|
|
126
|
+
"default": "./file.js",
|
|
127
|
+
"types": "./file.d.ts",
|
|
149
128
|
"require": "./file.cjs"
|
|
150
129
|
},
|
|
130
|
+
"./format": {
|
|
131
|
+
"import": "./format.js",
|
|
132
|
+
"default": "./format.js",
|
|
133
|
+
"types": "./format/index.d.ts",
|
|
134
|
+
"require": "./format.cjs"
|
|
135
|
+
},
|
|
151
136
|
"./html": {
|
|
152
|
-
"types": "./html.d.cts",
|
|
153
137
|
"import": "./html.js",
|
|
138
|
+
"default": "./html.js",
|
|
139
|
+
"types": "./html.d.ts",
|
|
154
140
|
"require": "./html.cjs"
|
|
155
141
|
},
|
|
156
142
|
"./id": {
|
|
157
|
-
"types": "./id.d.cts",
|
|
158
143
|
"import": "./id.js",
|
|
144
|
+
"default": "./id.js",
|
|
145
|
+
"types": "./id.d.ts",
|
|
159
146
|
"require": "./id.cjs"
|
|
160
147
|
},
|
|
161
148
|
"./imports": {
|
|
162
|
-
"types": "./imports.d.cts",
|
|
163
149
|
"import": "./imports.js",
|
|
150
|
+
"default": "./imports.js",
|
|
151
|
+
"types": "./imports.d.ts",
|
|
164
152
|
"require": "./imports.cjs"
|
|
165
153
|
},
|
|
166
154
|
"./math": {
|
|
167
|
-
"types": "./math.d.cts",
|
|
168
155
|
"import": "./math.js",
|
|
156
|
+
"default": "./math.js",
|
|
157
|
+
"types": "./math.d.ts",
|
|
169
158
|
"require": "./math.cjs"
|
|
170
159
|
},
|
|
171
160
|
"./media": {
|
|
172
|
-
"types": "./media.d.cts",
|
|
173
161
|
"import": "./media.js",
|
|
162
|
+
"default": "./media.js",
|
|
163
|
+
"types": "./media.d.ts",
|
|
174
164
|
"require": "./media.cjs"
|
|
175
165
|
},
|
|
166
|
+
"./mobx": {
|
|
167
|
+
"import": "./mobx.js",
|
|
168
|
+
"default": "./mobx.js",
|
|
169
|
+
"types": "./mobx/index.d.ts",
|
|
170
|
+
"require": "./mobx.cjs"
|
|
171
|
+
},
|
|
176
172
|
"./ms": {
|
|
177
|
-
"types": "./ms.d.cts",
|
|
178
173
|
"import": "./ms.js",
|
|
174
|
+
"default": "./ms.js",
|
|
175
|
+
"types": "./ms.d.ts",
|
|
179
176
|
"require": "./ms.cjs"
|
|
180
177
|
},
|
|
181
178
|
"./number": {
|
|
182
|
-
"types": "./number.d.cts",
|
|
183
179
|
"import": "./number.js",
|
|
180
|
+
"default": "./number.js",
|
|
181
|
+
"types": "./number.d.ts",
|
|
184
182
|
"require": "./number.cjs"
|
|
185
183
|
},
|
|
184
|
+
"./parser": {
|
|
185
|
+
"import": "./parser.js",
|
|
186
|
+
"default": "./parser.js",
|
|
187
|
+
"types": "./parser/index.d.ts",
|
|
188
|
+
"require": "./parser.cjs"
|
|
189
|
+
},
|
|
186
190
|
"./price": {
|
|
187
|
-
"types": "./price.d.cts",
|
|
188
191
|
"import": "./price.js",
|
|
192
|
+
"default": "./price.js",
|
|
193
|
+
"types": "./price.d.ts",
|
|
189
194
|
"require": "./price.cjs"
|
|
190
195
|
},
|
|
191
196
|
"./random": {
|
|
192
|
-
"types": "./random.d.cts",
|
|
193
197
|
"import": "./random.js",
|
|
198
|
+
"default": "./random.js",
|
|
199
|
+
"types": "./random.d.ts",
|
|
194
200
|
"require": "./random.cjs"
|
|
195
201
|
},
|
|
202
|
+
"./react": {
|
|
203
|
+
"import": "./react.js",
|
|
204
|
+
"default": "./react.js",
|
|
205
|
+
"types": "./react/index.d.ts",
|
|
206
|
+
"require": "./react.cjs"
|
|
207
|
+
},
|
|
196
208
|
"./sound": {
|
|
197
|
-
"types": "./sound.d.cts",
|
|
198
209
|
"import": "./sound.js",
|
|
210
|
+
"default": "./sound.js",
|
|
211
|
+
"types": "./sound.d.ts",
|
|
199
212
|
"require": "./sound.cjs"
|
|
200
213
|
},
|
|
201
|
-
"./storage": {
|
|
202
|
-
"types": "./storage.d.cts",
|
|
203
|
-
"import": "./storage.js",
|
|
204
|
-
"require": "./storage.cjs"
|
|
205
|
-
},
|
|
206
214
|
"./text": {
|
|
207
|
-
"types": "./text.d.cts",
|
|
208
215
|
"import": "./text.js",
|
|
216
|
+
"default": "./text.js",
|
|
217
|
+
"types": "./text.d.ts",
|
|
209
218
|
"require": "./text.cjs"
|
|
210
219
|
},
|
|
220
|
+
"./type-guard": {
|
|
221
|
+
"import": "./type-guard.js",
|
|
222
|
+
"default": "./type-guard.js",
|
|
223
|
+
"types": "./type-guard/index.d.ts",
|
|
224
|
+
"require": "./type-guard.cjs"
|
|
225
|
+
},
|
|
226
|
+
"./utility-types": {
|
|
227
|
+
"import": "./utility-types.js",
|
|
228
|
+
"default": "./utility-types.js",
|
|
229
|
+
"types": "./utility-types.d.ts",
|
|
230
|
+
"require": "./utility-types.cjs"
|
|
231
|
+
},
|
|
232
|
+
"./utils/types": {
|
|
233
|
+
"import": "./utils/types.js",
|
|
234
|
+
"default": "./utils/types.js",
|
|
235
|
+
"types": "./utils/types.d.ts",
|
|
236
|
+
"require": "./utils/types.cjs"
|
|
237
|
+
},
|
|
211
238
|
"./vibrate": {
|
|
212
|
-
"types": "./vibrate.d.cts",
|
|
213
239
|
"import": "./vibrate.js",
|
|
240
|
+
"default": "./vibrate.js",
|
|
241
|
+
"types": "./vibrate.d.ts",
|
|
214
242
|
"require": "./vibrate.cjs"
|
|
215
243
|
},
|
|
216
|
-
"./
|
|
244
|
+
"./package.json": "./package.json"
|
|
217
245
|
},
|
|
246
|
+
"files": [
|
|
247
|
+
"*"
|
|
248
|
+
],
|
|
218
249
|
"scripts": {
|
|
219
250
|
"clean": "rm -rf dist",
|
|
220
251
|
"lint:check": "pnpm exec biome check --write --no-errors-on-unmatched --files-ignore-unknown=true",
|
|
@@ -222,7 +253,7 @@
|
|
|
222
253
|
"check": "npm run lint:check && npm run ts:check",
|
|
223
254
|
"prebuild": "npm run clean && npm run check",
|
|
224
255
|
"build:watch": "pnpm build && nodemon --watch src --ext ts --exec \"pnpm build\"",
|
|
225
|
-
"build": "
|
|
256
|
+
"build": "vite build && tsx scripts/prepare-dist && tsx scripts/generate-utility-types-file",
|
|
226
257
|
"pub": "pnpm build && sborshik publish --useDistDir",
|
|
227
258
|
"pub:patch": "PUBLISH_VERSION=patch pnpm pub",
|
|
228
259
|
"pub:minor": "PUBLISH_VERSION=minor pnpm pub",
|
package/parser/_exports.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
1
|
+
export * from './number.js';
|
|
2
|
+
export * from './percent.js';
|
|
3
|
+
export * from './string.js';
|
|
4
4
|
//# sourceMappingURL=_exports.d.ts.map
|
package/parser/_exports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_exports.d.ts","sourceRoot":"","sources":["../../src/parser/_exports.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"_exports.d.ts","sourceRoot":"","sources":["../../src/parser/_exports.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC"}
|
package/parser/index.d.ts
CHANGED
package/parser/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/parser/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/parser/number.d.ts
CHANGED
package/parser/number.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/parser/number.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/parser/number.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,WAAW,oBAAoB,CAAC,SAAS,GAAG,MAAM;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,MAAM;KAAI,SAAS,kBACvB,KAAK,CAAC,OAAO,CAAC,iBACN,KAAK,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,GACpD,MAAM,GAAG,SAAS;;CA+CpB,CAAC"}
|
package/parser/percent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import { Maybe } from '../utils/types.ts';
|
|
2
|
+
import { NumberParserSettings } from './number.js';
|
|
3
3
|
export declare const percent: <TFallback = number>(value: Maybe<string | number>, maxValue?: Maybe<string | number>, settings?: Maybe<NumberParserSettings<TFallback>>) => number | TFallback;
|
|
4
4
|
//# sourceMappingURL=percent.d.ts.map
|
package/parser/percent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["../../src/parser/percent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"percent.d.ts","sourceRoot":"","sources":["../../src/parser/percent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAE,KAAK,oBAAoB,EAAU,MAAM,aAAa,CAAC;AAEhE,eAAO,MAAM,OAAO,GAAI,SAAS,GAAG,MAAM,EACxC,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAC7B,WAAW,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EACjC,WAAW,KAAK,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,uBAGlD,CAAC"}
|
package/parser/string.d.ts
CHANGED
package/parser/string.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/parser/string.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../src/parser/string.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,MAAM,WAAW,oBAAoB,CAAC,SAAS,GAAG,MAAM;IACtD,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,MAAM,GAAI,SAAS,GAAG,MAAM,EACvC,OAAO,KAAK,CAAC,OAAO,CAAC,EACrB,WAAW,KAAK,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC,KAChD,MAAM,GAAG,SAiBX,CAAC"}
|
package/parser.cjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./~number-B1MpW9GU.js"),u=require("yummies/type-guard"),l=(r,e,t)=>n.number(Number(r)/Number(e)*100,t),o=(r,e)=>{const t=e&&"fallback"in e?e.fallback:"";return r==null?t:u.typeGuard.isObject(r)?e?.prettyJson?JSON.stringify(r,null,2):JSON.stringify(r):String(r)},b=Object.freeze(Object.defineProperty({__proto__:null,number:n.number,percent:l,string:o},Symbol.toStringTag,{value:"Module"}));exports.parser=b;
|
|
2
|
+
//# sourceMappingURL=parser.cjs.map
|
package/parser.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.cjs","sources":["../src/parser/percent.ts","../src/parser/string.ts"],"sourcesContent":["import type { Maybe } from 'yummies/utils/types';\n\nimport { type NumberParserSettings, number } from './number.js';\n\nexport const percent = <TFallback = number>(\n value: Maybe<string | number>,\n maxValue?: Maybe<string | number>,\n settings?: Maybe<NumberParserSettings<TFallback>>,\n) => {\n return number<TFallback>((Number(value) / Number(maxValue)) * 100, settings);\n};\n","import { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/utils/types';\n\nexport interface StringParserSettings<TFallback = string> {\n fallback?: TFallback;\n prettyJson?: boolean;\n}\n\nexport const string = <TFallback = string>(\n input: Maybe<unknown>,\n settings?: Maybe<StringParserSettings<TFallback>>,\n): string | TFallback => {\n const fallback =\n settings && 'fallback' in settings ? (settings.fallback as TFallback) : '';\n\n if (input == null) {\n return fallback;\n }\n\n if (typeGuard.isObject(input)) {\n if (settings?.prettyJson) {\n return JSON.stringify(input, null, 2);\n }\n\n return JSON.stringify(input);\n }\n\n return String(input);\n};\n"],"names":["percent","value","maxValue","settings","number","string","input","fallback","typeGuard"],"mappings":"yJAIaA,EAAU,CACrBC,EACAC,EACAC,IAEOC,EAAAA,OAAmB,OAAOH,CAAK,EAAI,OAAOC,CAAQ,EAAK,IAAKC,CAAQ,ECDhEE,EAAS,CACpBC,EACAH,IACuB,CACvB,MAAMI,EACJJ,GAAY,aAAcA,EAAYA,EAAS,SAAyB,GAE1E,OAAIG,GAAS,KACJC,EAGLC,EAAAA,UAAU,SAASF,CAAK,EACtBH,GAAU,WACL,KAAK,UAAUG,EAAO,KAAM,CAAC,EAG/B,KAAK,UAAUA,CAAK,EAGtB,OAAOA,CAAK,CACrB"}
|
package/parser.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { n as o } from "./~number-EWff2XI6.js";
|
|
2
|
+
import { typeGuard as n } from "yummies/type-guard";
|
|
3
|
+
const l = (r, e, t) => o(Number(r) / Number(e) * 100, t), a = (r, e) => {
|
|
4
|
+
const t = e && "fallback" in e ? e.fallback : "";
|
|
5
|
+
return r == null ? t : n.isObject(r) ? e?.prettyJson ? JSON.stringify(r, null, 2) : JSON.stringify(r) : String(r);
|
|
6
|
+
}, b = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
7
|
+
__proto__: null,
|
|
8
|
+
number: o,
|
|
9
|
+
percent: l,
|
|
10
|
+
string: a
|
|
11
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
12
|
+
export {
|
|
13
|
+
b as parser
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=parser.js.map
|
package/parser.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sources":["../src/parser/percent.ts","../src/parser/string.ts"],"sourcesContent":["import type { Maybe } from 'yummies/utils/types';\n\nimport { type NumberParserSettings, number } from './number.js';\n\nexport const percent = <TFallback = number>(\n value: Maybe<string | number>,\n maxValue?: Maybe<string | number>,\n settings?: Maybe<NumberParserSettings<TFallback>>,\n) => {\n return number<TFallback>((Number(value) / Number(maxValue)) * 100, settings);\n};\n","import { typeGuard } from 'yummies/type-guard';\nimport type { Maybe } from 'yummies/utils/types';\n\nexport interface StringParserSettings<TFallback = string> {\n fallback?: TFallback;\n prettyJson?: boolean;\n}\n\nexport const string = <TFallback = string>(\n input: Maybe<unknown>,\n settings?: Maybe<StringParserSettings<TFallback>>,\n): string | TFallback => {\n const fallback =\n settings && 'fallback' in settings ? (settings.fallback as TFallback) : '';\n\n if (input == null) {\n return fallback;\n }\n\n if (typeGuard.isObject(input)) {\n if (settings?.prettyJson) {\n return JSON.stringify(input, null, 2);\n }\n\n return JSON.stringify(input);\n }\n\n return String(input);\n};\n"],"names":["percent","value","maxValue","settings","number","string","input","fallback","typeGuard"],"mappings":";;AAIO,MAAMA,IAAU,CACrBC,GACAC,GACAC,MAEOC,EAAmB,OAAOH,CAAK,IAAI,OAAOC,CAAQ,IAAK,KAAKC,CAAQ,GCDhEE,IAAS,CACpBC,GACAH,MACuB;AACvB,QAAMI,IACJJ,KAAY,cAAcA,IAAYA,EAAS,WAAyB;AAE1E,SAAIG,KAAS,OACJC,IAGLC,EAAU,SAASF,CAAK,IACtBH,GAAU,aACL,KAAK,UAAUG,GAAO,MAAM,CAAC,IAG/B,KAAK,UAAUA,CAAK,IAGtB,OAAOA,CAAK;AACrB;;;;;;"}
|
package/price.cjs
CHANGED
|
@@ -1,21 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.formatPrice = void 0;
|
|
4
|
-
const formatPrice = (price, locale, currency, { withoutSymbol, customSymbol, ...options } = {}) => {
|
|
5
|
-
const priceFormatter = new Intl.NumberFormat(locale, {
|
|
6
|
-
style: 'currency',
|
|
7
|
-
currency,
|
|
8
|
-
minimumFractionDigits: 0,
|
|
9
|
-
currencyDisplay: 'narrowSymbol',
|
|
10
|
-
...options,
|
|
11
|
-
});
|
|
12
|
-
const zeroPrice = priceFormatter.format(0);
|
|
13
|
-
const currencySymbol = zeroPrice.replace('0', '');
|
|
14
|
-
const rawPrice = priceFormatter.format(price);
|
|
15
|
-
const priceWithoutCurrency = rawPrice.replace(currencySymbol, '');
|
|
16
|
-
if (withoutSymbol) {
|
|
17
|
-
return priceWithoutCurrency;
|
|
18
|
-
}
|
|
19
|
-
return `${priceWithoutCurrency} ${customSymbol ?? (currency === 'RUB' ? 'р' : currencySymbol)}`.replace(/\s{2,}/, ' ');
|
|
20
|
-
};
|
|
21
|
-
exports.formatPrice = formatPrice;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=(o,i,r,{withoutSymbol:n,customSymbol:a,...m}={})=>{const e=new Intl.NumberFormat(i,{style:"currency",currency:r,minimumFractionDigits:0,currencyDisplay:"narrowSymbol",...m}),t=e.format(0).replace("0",""),c=e.format(o).replace(t,"");return n?c:`${c} ${a??(r==="RUB"?"р":t)}`.replace(/\s{2,}/," ")};exports.formatPrice=s;
|
|
2
|
+
//# sourceMappingURL=price.cjs.map
|
package/price.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price.cjs","sources":["../src/price.ts"],"sourcesContent":["export interface PriceFormatOptions\n extends Partial<Omit<Intl.NumberFormatOptions, 'currency'>> {\n withoutSymbol?: boolean;\n customSymbol?: string;\n}\n\nexport const formatPrice = (\n price: number,\n locale: string,\n currency?: string,\n { withoutSymbol, customSymbol, ...options }: PriceFormatOptions = {},\n) => {\n const priceFormatter = new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n minimumFractionDigits: 0,\n currencyDisplay: 'narrowSymbol',\n ...options,\n });\n\n const zeroPrice = priceFormatter.format(0);\n const currencySymbol = zeroPrice.replace('0', '');\n const rawPrice = priceFormatter.format(price);\n const priceWithoutCurrency = rawPrice.replace(currencySymbol, '');\n\n if (withoutSymbol) {\n return priceWithoutCurrency;\n }\n\n return `${priceWithoutCurrency} ${\n customSymbol ?? (currency === 'RUB' ? 'р' : currencySymbol)\n }`.replace(/\\s{2,}/, ' ');\n};\n"],"names":["formatPrice","price","locale","currency","withoutSymbol","customSymbol","options","priceFormatter","currencySymbol","priceWithoutCurrency"],"mappings":"gFAMO,MAAMA,EAAc,CACzBC,EACAC,EACAC,EACA,CAAE,cAAAC,EAAe,aAAAC,EAAc,GAAGC,CAAA,EAAgC,KAC/D,CACH,MAAMC,EAAiB,IAAI,KAAK,aAAaL,EAAQ,CACnD,MAAO,WACP,SAAAC,EACA,sBAAuB,EACvB,gBAAiB,eACjB,GAAGG,CAAA,CACJ,EAGKE,EADYD,EAAe,OAAO,CAAC,EACR,QAAQ,IAAK,EAAE,EAE1CE,EADWF,EAAe,OAAON,CAAK,EACN,QAAQO,EAAgB,EAAE,EAEhE,OAAIJ,EACKK,EAGF,GAAGA,CAAoB,IAC5BJ,IAAiBF,IAAa,MAAQ,IAAMK,EAC9C,GAAG,QAAQ,SAAU,GAAG,CAC1B"}
|
package/price.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const currencySymbol = zeroPrice.replace('0', '');
|
|
11
|
-
const rawPrice = priceFormatter.format(price);
|
|
12
|
-
const priceWithoutCurrency = rawPrice.replace(currencySymbol, '');
|
|
13
|
-
if (withoutSymbol) {
|
|
14
|
-
return priceWithoutCurrency;
|
|
15
|
-
}
|
|
16
|
-
return `${priceWithoutCurrency} ${customSymbol ?? (currency === 'RUB' ? 'р' : currencySymbol)}`.replace(/\s{2,}/, ' ');
|
|
1
|
+
const u = (o, n, r, { withoutSymbol: i, customSymbol: a, ...m } = {}) => {
|
|
2
|
+
const e = new Intl.NumberFormat(n, {
|
|
3
|
+
style: "currency",
|
|
4
|
+
currency: r,
|
|
5
|
+
minimumFractionDigits: 0,
|
|
6
|
+
currencyDisplay: "narrowSymbol",
|
|
7
|
+
...m
|
|
8
|
+
}), c = e.format(0).replace("0", ""), t = e.format(o).replace(c, "");
|
|
9
|
+
return i ? t : `${t} ${a ?? (r === "RUB" ? "р" : c)}`.replace(/\s{2,}/, " ");
|
|
17
10
|
};
|
|
11
|
+
export {
|
|
12
|
+
u as formatPrice
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=price.js.map
|
package/price.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price.js","sources":["../src/price.ts"],"sourcesContent":["export interface PriceFormatOptions\n extends Partial<Omit<Intl.NumberFormatOptions, 'currency'>> {\n withoutSymbol?: boolean;\n customSymbol?: string;\n}\n\nexport const formatPrice = (\n price: number,\n locale: string,\n currency?: string,\n { withoutSymbol, customSymbol, ...options }: PriceFormatOptions = {},\n) => {\n const priceFormatter = new Intl.NumberFormat(locale, {\n style: 'currency',\n currency,\n minimumFractionDigits: 0,\n currencyDisplay: 'narrowSymbol',\n ...options,\n });\n\n const zeroPrice = priceFormatter.format(0);\n const currencySymbol = zeroPrice.replace('0', '');\n const rawPrice = priceFormatter.format(price);\n const priceWithoutCurrency = rawPrice.replace(currencySymbol, '');\n\n if (withoutSymbol) {\n return priceWithoutCurrency;\n }\n\n return `${priceWithoutCurrency} ${\n customSymbol ?? (currency === 'RUB' ? 'р' : currencySymbol)\n }`.replace(/\\s{2,}/, ' ');\n};\n"],"names":["formatPrice","price","locale","currency","withoutSymbol","customSymbol","options","priceFormatter","currencySymbol","priceWithoutCurrency"],"mappings":"AAMO,MAAMA,IAAc,CACzBC,GACAC,GACAC,GACA,EAAE,eAAAC,GAAe,cAAAC,GAAc,GAAGC,EAAA,IAAgC,OAC/D;AACH,QAAMC,IAAiB,IAAI,KAAK,aAAaL,GAAQ;AAAA,IACnD,OAAO;AAAA,IACP,UAAAC;AAAA,IACA,uBAAuB;AAAA,IACvB,iBAAiB;AAAA,IACjB,GAAGG;AAAA,EAAA,CACJ,GAGKE,IADYD,EAAe,OAAO,CAAC,EACR,QAAQ,KAAK,EAAE,GAE1CE,IADWF,EAAe,OAAON,CAAK,EACN,QAAQO,GAAgB,EAAE;AAEhE,SAAIJ,IACKK,IAGF,GAAGA,CAAoB,IAC5BJ,MAAiBF,MAAa,QAAQ,MAAMK,EAC9C,GAAG,QAAQ,UAAU,GAAG;AAC1B;"}
|
package/random.cjs
CHANGED
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.getFrequencyValue = exports.getMinorRandomBool = exports.getMajorRandomBool = exports.getRandomBool = exports.getRandomSizeArray = exports.getRandomChoice = exports.getRandomInt = exports.getRandomFloat = void 0;
|
|
4
|
-
const getRandomFloat = (min = 0, max = 1) => (Math.random() * (max - min) + min);
|
|
5
|
-
exports.getRandomFloat = getRandomFloat;
|
|
6
|
-
const getRandomInt = (min = 0, max = 1) => min === max ? min : Math.round((0, exports.getRandomFloat)(min, max));
|
|
7
|
-
exports.getRandomInt = getRandomInt;
|
|
8
|
-
const getRandomChoice = (arr) => arr[(0, exports.getRandomInt)(0, arr.length - 1)];
|
|
9
|
-
exports.getRandomChoice = getRandomChoice;
|
|
10
|
-
const getRandomSizeArray = (min = 0, max = 10) => Array.from({ length: (0, exports.getRandomInt)(min, max) }).fill(null);
|
|
11
|
-
exports.getRandomSizeArray = getRandomSizeArray;
|
|
12
|
-
const getRandomBool = () => (0, exports.getRandomInt)(0, 1) === 1;
|
|
13
|
-
exports.getRandomBool = getRandomBool;
|
|
14
|
-
const getMajorRandomBool = () => {
|
|
15
|
-
return (0, exports.getRandomInt)(0, 10) <= 6;
|
|
16
|
-
};
|
|
17
|
-
exports.getMajorRandomBool = getMajorRandomBool;
|
|
18
|
-
const getMinorRandomBool = () => {
|
|
19
|
-
return !(0, exports.getMajorRandomBool)();
|
|
20
|
-
};
|
|
21
|
-
exports.getMinorRandomBool = getMinorRandomBool;
|
|
22
|
-
const getFrequencyValue = (frequency) => {
|
|
23
|
-
return Math.random() < frequency;
|
|
24
|
-
};
|
|
25
|
-
exports.getFrequencyValue = getFrequencyValue;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=(o=0,t=1)=>Math.random()*(t-o)+o,e=(o=0,t=1)=>o===t?o:Math.round(n(o,t)),r=o=>o[e(0,o.length-1)],g=(o=0,t=10)=>Array.from({length:e(o,t)}).fill(null),d=()=>e(0,1)===1,a=()=>e(0,10)<=6,l=()=>!a(),c=o=>Math.random()<o;exports.getFrequencyValue=c;exports.getMajorRandomBool=a;exports.getMinorRandomBool=l;exports.getRandomBool=d;exports.getRandomChoice=r;exports.getRandomFloat=n;exports.getRandomInt=e;exports.getRandomSizeArray=g;
|
|
2
|
+
//# sourceMappingURL=random.cjs.map
|
package/random.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random.cjs","sources":["../src/random.ts"],"sourcesContent":["export const getRandomFloat = <T extends number = number>(\n min = 0,\n max = 1,\n): T => (Math.random() * (max - min) + min) as T;\n\nexport const getRandomInt = <T extends number = number>(min = 0, max = 1): T =>\n min === max ? (min as T) : (Math.round(getRandomFloat(min, max)) as T);\n\nexport const getRandomChoice = <T>(arr: T[]): T =>\n arr[getRandomInt(0, arr.length - 1)];\n\nexport const getRandomSizeArray = (min = 0, max = 10) =>\n Array.from({ length: getRandomInt(min, max) }).fill(null);\n\nexport const getRandomBool = () => getRandomInt(0, 1) === 1;\n\nexport const getMajorRandomBool = () => {\n return getRandomInt(0, 10) <= 6;\n};\n\nexport const getMinorRandomBool = () => {\n return !getMajorRandomBool();\n};\n\nexport const getFrequencyValue = (frequency: number) => {\n return Math.random() < frequency;\n};\n"],"names":["getRandomFloat","min","max","getRandomInt","getRandomChoice","arr","getRandomSizeArray","getRandomBool","getMajorRandomBool","getMinorRandomBool","getFrequencyValue","frequency"],"mappings":"gFAAO,MAAMA,EAAiB,CAC5BC,EAAM,EACNC,EAAM,IACC,KAAK,OAAA,GAAYA,EAAMD,GAAOA,EAE1BE,EAAe,CAA4BF,EAAM,EAAGC,EAAM,IACrED,IAAQC,EAAOD,EAAa,KAAK,MAAMD,EAAeC,EAAKC,CAAG,CAAC,EAEpDE,EAAsBC,GACjCA,EAAIF,EAAa,EAAGE,EAAI,OAAS,CAAC,CAAC,EAExBC,EAAqB,CAACL,EAAM,EAAGC,EAAM,KAChD,MAAM,KAAK,CAAE,OAAQC,EAAaF,EAAKC,CAAG,EAAG,EAAE,KAAK,IAAI,EAE7CK,EAAgB,IAAMJ,EAAa,EAAG,CAAC,IAAM,EAE7CK,EAAqB,IACzBL,EAAa,EAAG,EAAE,GAAK,EAGnBM,EAAqB,IACzB,CAACD,EAAA,EAGGE,EAAqBC,GACzB,KAAK,SAAWA"}
|