@splendidlabz/utils 1.11.3 → 1.11.5
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/dist/cjs/dom/accessibility.cjs +53 -0
- package/dist/cjs/dom/actions/index.cjs +410 -0
- package/dist/cjs/dom/actions/masonry.cjs +152 -0
- package/dist/cjs/dom/actions/prefer-horizontal-scroll.cjs +157 -0
- package/dist/cjs/dom/actions/sticky.cjs +213 -0
- package/dist/cjs/dom/bounding-box.cjs +70 -0
- package/dist/cjs/dom/clipboard.cjs +37 -0
- package/dist/cjs/dom/cookie.cjs +57 -0
- package/dist/cjs/dom/css-vars.cjs +57 -0
- package/dist/cjs/dom/events.cjs +59 -0
- package/{src/dom/focusable.js → dist/cjs/dom/focusable.cjs} +51 -73
- package/dist/cjs/dom/font-size.cjs +80 -0
- package/dist/cjs/dom/get-element.cjs +98 -0
- package/dist/cjs/dom/hash.cjs +35 -0
- package/dist/cjs/dom/index.cjs +1267 -0
- package/dist/cjs/dom/keyboard.cjs +51 -0
- package/dist/cjs/dom/local-store.cjs +79 -0
- package/dist/cjs/dom/media.cjs +59 -0
- package/dist/cjs/dom/observers/index.cjs +253 -0
- package/dist/cjs/dom/observers/intersection-observer.cjs +91 -0
- package/dist/cjs/dom/observers/mutation-observer.cjs +95 -0
- package/dist/cjs/dom/observers/observer.cjs +48 -0
- package/dist/cjs/dom/observers/resize-observer.cjs +84 -0
- package/dist/cjs/dom/observers/scroll-observer.cjs +177 -0
- package/dist/cjs/dom/pkce.cjs +53 -0
- package/dist/cjs/dom/query-params.cjs +38 -0
- package/dist/cjs/dom/random-string.cjs +38 -0
- package/dist/cjs/dom/sanitize.cjs +65 -0
- package/dist/cjs/dom/session-store.cjs +49 -0
- package/dist/cjs/dom/spam-prevention.cjs +50 -0
- package/dist/cjs/dom/trap-focus.cjs +197 -0
- package/dist/cjs/dom/ui/aria-current.cjs +43 -0
- package/dist/cjs/dom/ui/inconsistent-button-fix.cjs +35 -0
- package/dist/cjs/dom/ui/index.cjs +105 -0
- package/dist/cjs/dom/ui/scroll-container.cjs +47 -0
- package/dist/cjs/dom/ui/traverse-and-scramble.cjs +50 -0
- package/dist/cjs/lib/arrays/index.cjs +139 -0
- package/dist/cjs/lib/arrays/item-position.cjs +42 -0
- package/dist/cjs/lib/arrays/join.cjs +43 -0
- package/dist/cjs/lib/arrays/shuffle.cjs +42 -0
- package/dist/cjs/lib/arrays/sort.cjs +67 -0
- package/dist/cjs/lib/arrays/split-array.cjs +41 -0
- package/dist/cjs/lib/arrays/unique.cjs +31 -0
- package/dist/cjs/lib/auth/index.cjs +53 -0
- package/dist/cjs/lib/auth/route-manager.cjs +51 -0
- package/dist/cjs/lib/checks.cjs +63 -0
- package/dist/cjs/lib/date/days.cjs +37 -0
- package/dist/cjs/lib/date/index.cjs +208 -0
- package/dist/cjs/lib/date/months.cjs +102 -0
- package/dist/cjs/lib/date/time.cjs +117 -0
- package/dist/cjs/lib/form/form-data.cjs +83 -0
- package/dist/cjs/lib/form/index.cjs +122 -0
- package/dist/cjs/lib/form/sanitize.cjs +61 -0
- package/dist/cjs/lib/functions/callback.cjs +31 -0
- package/dist/cjs/lib/functions/debounce.cjs +43 -0
- package/dist/cjs/lib/functions/env.cjs +32 -0
- package/dist/cjs/lib/functions/functional.cjs +82 -0
- package/dist/cjs/lib/functions/index.cjs +142 -0
- package/dist/cjs/lib/functions/throttle.cjs +38 -0
- package/dist/cjs/lib/functions/timeout.cjs +41 -0
- package/dist/cjs/lib/hash.cjs +43 -0
- package/dist/cjs/lib/index.cjs +1178 -0
- package/dist/cjs/lib/numbers/index.cjs +49 -0
- package/dist/cjs/lib/numbers/math.cjs +36 -0
- package/dist/cjs/lib/objects/camelcase-keys.cjs +80 -0
- package/dist/cjs/lib/objects/empty.cjs +39 -0
- package/dist/cjs/lib/objects/equal.cjs +47 -0
- package/dist/cjs/lib/objects/extend.cjs +147 -0
- package/dist/cjs/lib/objects/flatten.cjs +48 -0
- package/dist/cjs/lib/objects/index.cjs +378 -0
- package/dist/cjs/lib/objects/json.cjs +35 -0
- package/dist/cjs/lib/objects/loop.cjs +40 -0
- package/dist/cjs/lib/objects/mix/mix.cjs +115 -0
- package/dist/cjs/lib/objects/nested-property.cjs +45 -0
- package/dist/cjs/lib/objects/normalize-object.cjs +106 -0
- package/dist/cjs/lib/objects/omit-empty.cjs +40 -0
- package/dist/cjs/lib/objects/size.cjs +63 -0
- package/dist/cjs/lib/objects/split.cjs +39 -0
- package/dist/cjs/lib/promises/index.cjs +69 -0
- package/dist/cjs/lib/promises/reject.cjs +67 -0
- package/dist/cjs/lib/sse.cjs +99 -0
- package/dist/cjs/lib/strings/convert-case/convert-case.cjs +96 -0
- package/dist/cjs/lib/strings/index.cjs +197 -0
- package/dist/cjs/lib/strings/markdown.cjs +76 -0
- package/dist/cjs/lib/strings/name.cjs +46 -0
- package/dist/cjs/lib/strings/pluralize.cjs +40 -0
- package/dist/cjs/lib/strings/query-string.cjs +43 -0
- package/dist/cjs/lib/style/index.cjs +64 -0
- package/dist/cjs/lib/symbols/index.cjs +40 -0
- package/dist/cjs/lib/symbols/symbols.cjs +38 -0
- package/dist/cjs/node/dirname.cjs +49 -0
- package/dist/cjs/node/file-cache.cjs +200 -0
- package/dist/cjs/node/file.cjs +50 -0
- package/dist/cjs/node/hash.cjs +42 -0
- package/dist/cjs/node/index.cjs +296 -0
- package/dist/cjs/node/pkce.cjs +64 -0
- package/dist/cjs/node/random-string.cjs +43 -0
- package/dist/cjs/node/sanitize.cjs +65 -0
- package/dist/cjs/node/uuid.cjs +42 -0
- package/dist/esm/dom/accessibility.js +26 -0
- package/dist/esm/dom/actions/index.js +3 -0
- package/dist/esm/dom/actions/masonry.js +38 -0
- package/dist/esm/dom/actions/prefer-horizontal-scroll.js +90 -0
- package/dist/esm/dom/actions/sticky.js +70 -0
- package/dist/esm/dom/bounding-box.js +44 -0
- package/dist/esm/dom/clipboard.js +12 -0
- package/dist/esm/dom/cookie.js +31 -0
- package/dist/esm/dom/css-vars.js +21 -0
- package/dist/esm/dom/events.js +31 -0
- package/dist/esm/dom/focusable.js +117 -0
- package/dist/esm/dom/font-size.js +40 -0
- package/dist/esm/dom/get-element.js +66 -0
- package/dist/esm/dom/hash.js +10 -0
- package/dist/esm/dom/index.js +23 -0
- package/dist/esm/dom/keyboard.js +22 -0
- package/{src → dist/esm}/dom/local-store.js +16 -28
- package/dist/esm/dom/media.js +32 -0
- package/dist/esm/dom/observers/index.js +4 -0
- package/dist/esm/dom/observers/intersection-observer.js +36 -0
- package/dist/esm/dom/observers/mutation-observer.js +40 -0
- package/dist/esm/dom/observers/observer.js +15 -0
- package/dist/esm/dom/observers/resize-observer.js +29 -0
- package/dist/esm/dom/observers/scroll-observer.js +95 -0
- package/dist/esm/dom/pkce.js +20 -0
- package/dist/esm/dom/query-params.js +13 -0
- package/dist/esm/dom/random-string.js +12 -0
- package/dist/esm/dom/sanitize.js +8 -0
- package/dist/esm/dom/session-store.js +24 -0
- package/dist/esm/dom/spam-prevention.js +25 -0
- package/dist/esm/dom/trap-focus.js +51 -0
- package/dist/esm/dom/ui/aria-current.js +17 -0
- package/dist/esm/dom/ui/inconsistent-button-fix.js +10 -0
- package/dist/esm/dom/ui/index.js +4 -0
- package/dist/esm/dom/ui/scroll-container.js +22 -0
- package/dist/esm/dom/ui/traverse-and-scramble.js +25 -0
- package/dist/esm/lib/arrays/index.js +6 -0
- package/dist/esm/lib/arrays/item-position.js +15 -0
- package/dist/esm/lib/arrays/join.js +12 -0
- package/dist/esm/lib/arrays/shuffle.js +17 -0
- package/dist/esm/lib/arrays/sort.js +36 -0
- package/dist/esm/lib/arrays/split-array.js +16 -0
- package/dist/esm/lib/arrays/unique.js +6 -0
- package/dist/esm/lib/auth/index.js +1 -0
- package/dist/esm/lib/auth/route-manager.js +25 -0
- package/dist/esm/lib/checks.js +34 -0
- package/dist/esm/lib/date/days.js +12 -0
- package/dist/esm/lib/date/index.js +3 -0
- package/dist/esm/lib/date/months.js +77 -0
- package/dist/esm/lib/date/time.js +75 -0
- package/dist/esm/lib/form/form-data.js +57 -0
- package/dist/esm/lib/form/index.js +2 -0
- package/dist/esm/lib/form/sanitize.js +34 -0
- package/dist/esm/lib/functions/callback.js +6 -0
- package/dist/esm/lib/functions/debounce.js +18 -0
- package/dist/esm/lib/functions/env.js +7 -0
- package/dist/esm/lib/functions/functional.js +52 -0
- package/dist/esm/lib/functions/index.js +5 -0
- package/dist/esm/lib/functions/throttle.js +13 -0
- package/dist/esm/lib/functions/timeout.js +14 -0
- package/dist/esm/lib/hash.js +18 -0
- package/dist/esm/lib/index.js +14 -0
- package/dist/esm/lib/numbers/index.js +11 -0
- package/dist/esm/lib/numbers/math.js +10 -0
- package/dist/esm/lib/objects/camelcase-keys.js +16 -0
- package/dist/esm/lib/objects/empty.js +13 -0
- package/dist/esm/lib/objects/equal.js +11 -0
- package/dist/esm/lib/objects/extend.js +13 -0
- package/dist/esm/lib/objects/flatten.js +17 -0
- package/dist/esm/lib/objects/index.js +13 -0
- package/dist/esm/lib/objects/json.js +10 -0
- package/dist/esm/lib/objects/loop.js +14 -0
- package/dist/esm/lib/objects/mix/mix.js +88 -0
- package/dist/esm/lib/objects/nested-property.js +18 -0
- package/dist/esm/lib/objects/normalize-object.js +9 -0
- package/dist/esm/lib/objects/omit-empty.js +15 -0
- package/dist/esm/lib/objects/size.js +38 -0
- package/dist/esm/lib/objects/split.js +14 -0
- package/dist/esm/lib/promises/index.js +1 -0
- package/dist/esm/lib/promises/reject.js +17 -0
- package/dist/esm/lib/sse.js +50 -0
- package/dist/esm/lib/strings/convert-case/convert-case.js +64 -0
- package/dist/esm/lib/strings/index.js +5 -0
- package/dist/esm/lib/strings/markdown.js +40 -0
- package/dist/esm/lib/strings/name.js +21 -0
- package/dist/esm/lib/strings/pluralize.js +5 -0
- package/dist/esm/lib/strings/query-string.js +16 -0
- package/dist/esm/lib/style/index.js +12 -0
- package/dist/esm/lib/symbols/index.js +1 -0
- package/dist/esm/lib/symbols/symbols.js +12 -0
- package/dist/esm/node/context.js +0 -0
- package/dist/esm/node/dirname.js +13 -0
- package/dist/esm/node/file-cache.js +121 -0
- package/dist/esm/node/file.js +14 -0
- package/dist/esm/node/hash.js +7 -0
- package/dist/esm/node/index.js +7 -0
- package/dist/esm/node/pkce.js +20 -0
- package/dist/esm/node/random-string.js +8 -0
- package/dist/esm/node/sanitize.js +8 -0
- package/dist/esm/node/uuid.js +7 -0
- package/dist/types/dom/accessibility.d.cts +30 -0
- package/dist/types/dom/actions/index.d.cts +3 -0
- package/dist/types/dom/actions/masonry.d.cts +5 -0
- package/dist/types/dom/actions/prefer-horizontal-scroll.d.cts +5 -0
- package/dist/types/dom/actions/sticky.d.cts +5 -0
- package/{src/dom/bounding-box.js → dist/types/dom/bounding-box.d.cts} +8 -49
- package/dist/types/dom/clipboard.d.cts +7 -0
- package/dist/types/dom/cookie.d.cts +7 -0
- package/dist/types/dom/css-vars.d.cts +6 -0
- package/{src/dom/events.js → dist/types/dom/events.d.cts} +52 -31
- package/dist/types/dom/focusable.d.cts +78 -0
- package/dist/types/dom/font-size.d.cts +8 -0
- package/{src/dom/get-element.js → dist/types/dom/get-element.d.cts} +25 -99
- package/dist/types/dom/hash.d.cts +3 -0
- package/dist/types/dom/index.d.cts +31 -0
- package/{src/dom/keyboard.js → dist/types/dom/keyboard.d.cts} +7 -19
- package/dist/types/dom/local-store.d.cts +31 -0
- package/dist/types/dom/media.d.cts +5 -0
- package/dist/types/dom/observers/index.d.cts +4 -0
- package/dist/types/dom/observers/intersection-observer.d.cts +10 -0
- package/dist/types/dom/observers/mutation-observer.d.cts +9 -0
- package/dist/types/dom/observers/observer.d.cts +3 -0
- package/{src/dom/observers/resize-observer.js → dist/types/dom/observers/resize-observer.d.cts} +6 -32
- package/dist/types/dom/observers/scroll-observer.d.cts +40 -0
- package/dist/types/dom/pkce.d.cts +8 -0
- package/dist/types/dom/query-params.d.cts +6 -0
- package/dist/types/dom/random-string.d.cts +9 -0
- package/dist/types/dom/sanitize.d.cts +10 -0
- package/dist/types/dom/session-store.d.cts +7 -0
- package/dist/types/dom/spam-prevention.d.cts +14 -0
- package/dist/types/dom/trap-focus.d.cts +32 -0
- package/dist/types/dom/ui/aria-current.d.cts +7 -0
- package/{src/dom/ui/inconsistent-button-fix.js → dist/types/dom/ui/inconsistent-button-fix.d.cts} +5 -11
- package/dist/types/dom/ui/index.d.cts +4 -0
- package/dist/types/dom/ui/scroll-container.d.cts +3 -0
- package/dist/types/dom/ui/traverse-and-scramble.d.cts +21 -0
- package/dist/types/lib/arrays/index.d.cts +6 -0
- package/{src/lib/arrays/item-position.js → dist/types/lib/arrays/item-position.d.cts} +5 -12
- package/{src/lib/arrays/join.js → dist/types/lib/arrays/join.d.cts} +4 -9
- package/dist/types/lib/arrays/shuffle.d.cts +3 -0
- package/dist/types/lib/arrays/sort.d.cts +32 -0
- package/dist/types/lib/arrays/split-array.d.cts +6 -0
- package/dist/types/lib/arrays/unique.d.cts +3 -0
- package/dist/types/lib/auth/index.d.cts +1 -0
- package/dist/types/lib/auth/route-manager.d.cts +28 -0
- package/dist/types/lib/checks.d.cts +33 -0
- package/dist/types/lib/date/days.d.cts +7 -0
- package/dist/types/lib/date/index.d.cts +3 -0
- package/dist/types/lib/date/months.d.cts +11 -0
- package/dist/types/lib/date/time.d.cts +21 -0
- package/dist/types/lib/form/form-data.d.cts +9 -0
- package/dist/types/lib/form/index.d.cts +2 -0
- package/{src/lib/form/sanitize.js → dist/types/lib/form/sanitize.d.cts} +19 -39
- package/{src/lib/functions/callback.js → dist/types/lib/functions/callback.d.cts} +3 -3
- package/dist/types/lib/functions/debounce.d.cts +3 -0
- package/dist/types/lib/functions/env.d.cts +3 -0
- package/{src/lib/functions/functional.js → dist/types/lib/functions/functional.d.cts} +8 -49
- package/dist/types/lib/functions/index.d.cts +5 -0
- package/dist/types/lib/functions/throttle.d.cts +3 -0
- package/dist/types/lib/functions/timeout.d.cts +5 -0
- package/dist/types/lib/hash.d.cts +3 -0
- package/dist/types/lib/index.d.cts +43 -0
- package/dist/types/lib/numbers/index.d.cts +5 -0
- package/dist/types/lib/numbers/math.d.cts +4 -0
- package/dist/types/lib/objects/camelcase-keys.d.cts +3 -0
- package/dist/types/lib/objects/empty.d.cts +4 -0
- package/dist/types/lib/objects/equal.d.cts +4 -0
- package/dist/types/lib/objects/extend.d.cts +6 -0
- package/dist/types/lib/objects/flatten.d.cts +6 -0
- package/dist/types/lib/objects/index.d.cts +13 -0
- package/dist/types/lib/objects/json.d.cts +3 -0
- package/dist/types/lib/objects/loop.d.cts +4 -0
- package/dist/types/lib/objects/mix/mix.d.cts +44 -0
- package/{src/lib/objects/nested-property.js → dist/types/lib/objects/nested-property.d.cts} +4 -21
- package/dist/types/lib/objects/normalize-object.d.cts +3 -0
- package/dist/types/lib/objects/omit-empty.d.cts +3 -0
- package/dist/types/lib/objects/size.d.cts +3 -0
- package/dist/types/lib/objects/split.d.cts +14 -0
- package/dist/types/lib/promises/index.d.cts +1 -0
- package/dist/types/lib/promises/reject.d.cts +5 -0
- package/dist/types/lib/sse.d.cts +18 -0
- package/dist/types/lib/strings/convert-case/convert-case.d.cts +10 -0
- package/dist/types/lib/strings/index.d.cts +5 -0
- package/dist/types/lib/strings/markdown.d.cts +25 -0
- package/dist/types/lib/strings/name.d.cts +7 -0
- package/dist/types/lib/strings/pluralize.d.cts +3 -0
- package/dist/types/lib/strings/query-string.d.cts +10 -0
- package/dist/types/lib/style/index.d.cts +3 -0
- package/dist/types/lib/symbols/index.d.cts +1 -0
- package/dist/types/lib/symbols/symbols.d.cts +4 -0
- package/dist/types/node/context.d.cts +2 -0
- package/dist/types/node/dirname.d.cts +9 -0
- package/dist/types/node/file-cache.d.cts +56 -0
- package/dist/types/node/file.d.cts +4 -0
- package/dist/types/node/hash.d.cts +3 -0
- package/dist/types/node/index.d.cts +7 -0
- package/dist/types/node/pkce.d.cts +14 -0
- package/dist/types/node/random-string.d.cts +3 -0
- package/{src/node/sanitize.js → dist/types/node/sanitize.d.cts} +3 -6
- package/dist/types/node/uuid.d.cts +3 -0
- package/package.json +18 -15
- package/CHANGELOG.md +0 -237
- package/eslint.config.js +0 -2
- package/src/dom/accessibility.js +0 -58
- package/src/dom/actions/index.js +0 -3
- package/src/dom/actions/masonry.js +0 -43
- package/src/dom/actions/prefer-horizontal-scroll.js +0 -121
- package/src/dom/actions/sticky.js +0 -85
- package/src/dom/clipboard.js +0 -14
- package/src/dom/cookie.js +0 -32
- package/src/dom/css-vars.js +0 -19
- package/src/dom/font-size.js +0 -40
- package/src/dom/hash.js +0 -9
- package/src/dom/index.js +0 -23
- package/src/dom/media.js +0 -30
- package/src/dom/observers/index.js +0 -4
- package/src/dom/observers/intersection-observer.js +0 -43
- package/src/dom/observers/mutation-observer.js +0 -51
- package/src/dom/observers/observer.js +0 -18
- package/src/dom/observers/scroll-observer.js +0 -146
- package/src/dom/pkce.js +0 -34
- package/src/dom/query-params.js +0 -14
- package/src/dom/random-string.js +0 -18
- package/src/dom/random-string.test.js +0 -13
- package/src/dom/sanitize.js +0 -16
- package/src/dom/session-store.js +0 -29
- package/src/dom/spam-prevention.js +0 -40
- package/src/dom/trap-focus.js +0 -70
- package/src/dom/ui/aria-current.js +0 -20
- package/src/dom/ui/index.js +0 -4
- package/src/dom/ui/scroll-container.js +0 -25
- package/src/dom/ui/traverse-and-scramble.js +0 -61
- package/src/lib/arrays/index.js +0 -6
- package/src/lib/arrays/shuffle.js +0 -21
- package/src/lib/arrays/sort.js +0 -88
- package/src/lib/arrays/sort.spec.js +0 -123
- package/src/lib/arrays/split-array.js +0 -15
- package/src/lib/arrays/unique.js +0 -3
- package/src/lib/auth/index.js +0 -1
- package/src/lib/auth/route-manager.js +0 -45
- package/src/lib/checks.js +0 -57
- package/src/lib/date/days.js +0 -9
- package/src/lib/date/index.js +0 -3
- package/src/lib/date/months.js +0 -74
- package/src/lib/date/time.js +0 -83
- package/src/lib/form/form-data.js +0 -73
- package/src/lib/form/index.js +0 -2
- package/src/lib/form/sanitize.spec.js +0 -126
- package/src/lib/functions/debounce.js +0 -18
- package/src/lib/functions/env.js +0 -5
- package/src/lib/functions/functional.test.js +0 -196
- package/src/lib/functions/index.js +0 -5
- package/src/lib/functions/throttle.js +0 -11
- package/src/lib/functions/timeout.js +0 -15
- package/src/lib/hash.js +0 -18
- package/src/lib/hash.spec.js +0 -163
- package/src/lib/index.js +0 -14
- package/src/lib/numbers/index.js +0 -12
- package/src/lib/numbers/math.js +0 -9
- package/src/lib/numbers/split-unit.test.js +0 -45
- package/src/lib/objects/camelcase-keys.js +0 -17
- package/src/lib/objects/camelcase-keys.test.js +0 -72
- package/src/lib/objects/empty.js +0 -10
- package/src/lib/objects/equal.js +0 -9
- package/src/lib/objects/extend.js +0 -16
- package/src/lib/objects/extend.test.js +0 -35
- package/src/lib/objects/flatten.js +0 -19
- package/src/lib/objects/index.js +0 -13
- package/src/lib/objects/json.js +0 -7
- package/src/lib/objects/loop.js +0 -11
- package/src/lib/objects/loop.test.js +0 -31
- package/src/lib/objects/mix/mix.js +0 -191
- package/src/lib/objects/mix/mix.md +0 -78
- package/src/lib/objects/mix/mix.test.js +0 -445
- package/src/lib/objects/normalize-object.js +0 -10
- package/src/lib/objects/omit-empty.js +0 -23
- package/src/lib/objects/omit-empty.test.js +0 -85
- package/src/lib/objects/size.js +0 -41
- package/src/lib/objects/split.js +0 -19
- package/src/lib/promises/index.js +0 -1
- package/src/lib/promises/reject.js +0 -17
- package/src/lib/sse.js +0 -61
- package/src/lib/strings/convert-case/convert-case.js +0 -86
- package/src/lib/strings/convert-case/convert-case.md +0 -44
- package/src/lib/strings/convert-case/convert-case.test.js +0 -50
- package/src/lib/strings/index.js +0 -5
- package/src/lib/strings/markdown.js +0 -71
- package/src/lib/strings/markdown.spec.js +0 -73
- package/src/lib/strings/name.js +0 -24
- package/src/lib/strings/name.test.js +0 -67
- package/src/lib/strings/pluralize.js +0 -2
- package/src/lib/strings/query-string.js +0 -18
- package/src/lib/style/index.js +0 -13
- package/src/lib/symbols/index.js +0 -1
- package/src/lib/symbols/symbols.js +0 -9
- package/src/node/dirname.js +0 -17
- package/src/node/file-cache.js +0 -184
- package/src/node/file.js +0 -13
- package/src/node/hash.js +0 -5
- package/src/node/index.js +0 -7
- package/src/node/pkce.js +0 -33
- package/src/node/random-string.js +0 -10
- package/src/node/random-string.test.js +0 -15
- package/src/node/sanitize.spec.js +0 -142
- package/src/node/uuid.js +0 -5
- package/tsconfig.json +0 -23
- package/tsup.config.js +0 -38
- package/tsup.config.mjs +0 -63
- /package/{src/node/context.js → dist/cjs/node/context.cjs} +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/lib/arrays/join.js
|
|
20
|
+
var join_exports = {};
|
|
21
|
+
__export(join_exports, {
|
|
22
|
+
joinWithConjunction: () => joinWithConjunction
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(join_exports);
|
|
25
|
+
|
|
26
|
+
// src/lib/arrays/item-position.js
|
|
27
|
+
function lastArrayItem(array) {
|
|
28
|
+
return array[array.length - 1];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// src/lib/arrays/join.js
|
|
32
|
+
function joinWithConjunction(array, { conjunction = "and" } = {}) {
|
|
33
|
+
if (!array?.length) return "";
|
|
34
|
+
if (array.length === 1) return array[0];
|
|
35
|
+
if (array.length === 2) return `${array[0]} ${conjunction} ${array[1]}`;
|
|
36
|
+
const lastItem = lastArrayItem(array);
|
|
37
|
+
const rest = array.slice(0, -1);
|
|
38
|
+
return `${rest.join(", ")} ${conjunction} ${lastItem}`;
|
|
39
|
+
}
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
joinWithConjunction
|
|
43
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/lib/arrays/shuffle.js
|
|
20
|
+
var shuffle_exports = {};
|
|
21
|
+
__export(shuffle_exports, {
|
|
22
|
+
shuffle: () => shuffle
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(shuffle_exports);
|
|
25
|
+
function shuffle(array) {
|
|
26
|
+
const clone = array.slice();
|
|
27
|
+
let currentIndex = array.length;
|
|
28
|
+
let temporaryValue;
|
|
29
|
+
let randomIndex;
|
|
30
|
+
while (currentIndex !== 0) {
|
|
31
|
+
randomIndex = Math.floor(Math.random() * currentIndex);
|
|
32
|
+
currentIndex -= 1;
|
|
33
|
+
temporaryValue = clone[currentIndex];
|
|
34
|
+
clone[currentIndex] = clone[randomIndex];
|
|
35
|
+
clone[randomIndex] = temporaryValue;
|
|
36
|
+
}
|
|
37
|
+
return clone;
|
|
38
|
+
}
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
shuffle
|
|
42
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/lib/arrays/sort.js
|
|
20
|
+
var sort_exports = {};
|
|
21
|
+
__export(sort_exports, {
|
|
22
|
+
sort: () => sort
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(sort_exports);
|
|
25
|
+
|
|
26
|
+
// src/lib/objects/nested-property.js
|
|
27
|
+
function getNestedValue(object, path) {
|
|
28
|
+
return path.split(".").reduce((acc, part) => acc?.[part], object);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// src/lib/arrays/sort.js
|
|
32
|
+
function sort(array, { props = null, reverse = false } = {}) {
|
|
33
|
+
const clone = array.slice();
|
|
34
|
+
if (props === null) {
|
|
35
|
+
return clone.sort((a, b) => {
|
|
36
|
+
const comparison = compareValues(a, b);
|
|
37
|
+
return reverse ? -comparison : comparison;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const properties = Array.isArray(props) ? props : [props];
|
|
41
|
+
return clone.sort((a, b) => {
|
|
42
|
+
for (const property of properties) {
|
|
43
|
+
const aValue = getNestedValue(a, property);
|
|
44
|
+
const bValue = getNestedValue(b, property);
|
|
45
|
+
if (aValue === bValue) continue;
|
|
46
|
+
if (aValue == null) return 1;
|
|
47
|
+
if (bValue == null) return -1;
|
|
48
|
+
const comparison = compareValues(aValue, bValue);
|
|
49
|
+
return reverse ? -comparison : comparison;
|
|
50
|
+
}
|
|
51
|
+
return 0;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function compareValues(a, b) {
|
|
55
|
+
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
56
|
+
if (typeof a === "string" && typeof b === "string") return a.localeCompare(b);
|
|
57
|
+
const aDate = new Date(a);
|
|
58
|
+
const bDate = new Date(b);
|
|
59
|
+
const aTime = aDate.getTime();
|
|
60
|
+
const bTime = bDate.getTime();
|
|
61
|
+
if (!isNaN(aTime) && !isNaN(bTime)) return aTime - bTime;
|
|
62
|
+
return String(a).localeCompare(String(b));
|
|
63
|
+
}
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
sort
|
|
67
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/lib/arrays/split-array.js
|
|
20
|
+
var split_array_exports = {};
|
|
21
|
+
__export(split_array_exports, {
|
|
22
|
+
splitArray: () => splitArray
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(split_array_exports);
|
|
25
|
+
function splitArray(array, predicate) {
|
|
26
|
+
const ret = {
|
|
27
|
+
picked: [],
|
|
28
|
+
omitted: []
|
|
29
|
+
};
|
|
30
|
+
array.forEach((item, index, arr) => {
|
|
31
|
+
if (predicate(item, index, arr)) ret.picked.push(item);
|
|
32
|
+
else ret.omitted.push(item);
|
|
33
|
+
});
|
|
34
|
+
ret.p = ret.picked;
|
|
35
|
+
ret.o = ret.omitted;
|
|
36
|
+
return ret;
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
splitArray
|
|
41
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/lib/arrays/unique.js
|
|
20
|
+
var unique_exports = {};
|
|
21
|
+
__export(unique_exports, {
|
|
22
|
+
uniqueArray: () => uniqueArray
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(unique_exports);
|
|
25
|
+
function uniqueArray(array) {
|
|
26
|
+
return Array.from(new Set(array));
|
|
27
|
+
}
|
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
29
|
+
0 && (module.exports = {
|
|
30
|
+
uniqueArray
|
|
31
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/lib/auth/index.js
|
|
20
|
+
var auth_exports = {};
|
|
21
|
+
__export(auth_exports, {
|
|
22
|
+
AuthManager: () => AuthManager,
|
|
23
|
+
RouteManager: () => RouteManager
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(auth_exports);
|
|
26
|
+
|
|
27
|
+
// src/lib/auth/route-manager.js
|
|
28
|
+
function RouteManager(config) {
|
|
29
|
+
const { protectedRoutes, bypassRoutes } = config;
|
|
30
|
+
return {
|
|
31
|
+
isProtectedRoute(pathname) {
|
|
32
|
+
return isMatch(protectedRoutes, pathname);
|
|
33
|
+
},
|
|
34
|
+
isBypassRoute(pathname) {
|
|
35
|
+
return isMatch(bypassRoutes, pathname);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function AuthManager(config) {
|
|
40
|
+
return RouteManager(config);
|
|
41
|
+
}
|
|
42
|
+
function isMatch(routeConfig, pathname) {
|
|
43
|
+
const { is, startsWith, includes } = routeConfig;
|
|
44
|
+
const isExactMatch = is && is.some((u) => pathname === u);
|
|
45
|
+
const startsWithMatch = startsWith && startsWith.some((u) => pathname.startsWith(u));
|
|
46
|
+
const includesMatch = includes && includes.some((u) => pathname.includes(u));
|
|
47
|
+
return isExactMatch || startsWithMatch || includesMatch;
|
|
48
|
+
}
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
AuthManager,
|
|
52
|
+
RouteManager
|
|
53
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/lib/auth/route-manager.js
|
|
20
|
+
var route_manager_exports = {};
|
|
21
|
+
__export(route_manager_exports, {
|
|
22
|
+
AuthManager: () => AuthManager,
|
|
23
|
+
RouteManager: () => RouteManager
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(route_manager_exports);
|
|
26
|
+
function RouteManager(config) {
|
|
27
|
+
const { protectedRoutes, bypassRoutes } = config;
|
|
28
|
+
return {
|
|
29
|
+
isProtectedRoute(pathname) {
|
|
30
|
+
return isMatch(protectedRoutes, pathname);
|
|
31
|
+
},
|
|
32
|
+
isBypassRoute(pathname) {
|
|
33
|
+
return isMatch(bypassRoutes, pathname);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function AuthManager(config) {
|
|
38
|
+
return RouteManager(config);
|
|
39
|
+
}
|
|
40
|
+
function isMatch(routeConfig, pathname) {
|
|
41
|
+
const { is, startsWith, includes } = routeConfig;
|
|
42
|
+
const isExactMatch = is && is.some((u) => pathname === u);
|
|
43
|
+
const startsWithMatch = startsWith && startsWith.some((u) => pathname.startsWith(u));
|
|
44
|
+
const includesMatch = includes && includes.some((u) => pathname.includes(u));
|
|
45
|
+
return isExactMatch || startsWithMatch || includesMatch;
|
|
46
|
+
}
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
AuthManager,
|
|
50
|
+
RouteManager
|
|
51
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/lib/checks.js
|
|
20
|
+
var checks_exports = {};
|
|
21
|
+
__export(checks_exports, {
|
|
22
|
+
getType: () => getType,
|
|
23
|
+
isArray: () => isArray,
|
|
24
|
+
isFunction: () => isFunction,
|
|
25
|
+
isObject: () => isObject,
|
|
26
|
+
notObject: () => notObject
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(checks_exports);
|
|
29
|
+
function isObject(x) {
|
|
30
|
+
return typeof x === "object" && !Array.isArray(x) && x !== null;
|
|
31
|
+
}
|
|
32
|
+
function isArray(x) {
|
|
33
|
+
return Array.isArray(x);
|
|
34
|
+
}
|
|
35
|
+
function notObject(x) {
|
|
36
|
+
return !isObject(x);
|
|
37
|
+
}
|
|
38
|
+
function getType(x) {
|
|
39
|
+
if (typeof x === "string") return "string";
|
|
40
|
+
if (typeof x === "number") {
|
|
41
|
+
if (Number.isInteger(x)) return "integer";
|
|
42
|
+
return "float";
|
|
43
|
+
}
|
|
44
|
+
if (typeof x === "boolean") return "boolean";
|
|
45
|
+
if (typeof x === "function") return "function";
|
|
46
|
+
if (typeof x === "undefined") return "undefined";
|
|
47
|
+
if (typeof x === "symbol") return "symbol";
|
|
48
|
+
if (typeof x === "bigint") return "bigint";
|
|
49
|
+
if (Array.isArray(x)) return "array";
|
|
50
|
+
if (typeof x === "object") return "object";
|
|
51
|
+
return "unknown";
|
|
52
|
+
}
|
|
53
|
+
function isFunction(x) {
|
|
54
|
+
return typeof x === "function";
|
|
55
|
+
}
|
|
56
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
+
0 && (module.exports = {
|
|
58
|
+
getType,
|
|
59
|
+
isArray,
|
|
60
|
+
isFunction,
|
|
61
|
+
isObject,
|
|
62
|
+
notObject
|
|
63
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/lib/date/days.js
|
|
20
|
+
var days_exports = {};
|
|
21
|
+
__export(days_exports, {
|
|
22
|
+
DAYS: () => DAYS
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(days_exports);
|
|
25
|
+
var DAYS = [
|
|
26
|
+
{ short: "Sun", long: "Sunday", numeric: 1 },
|
|
27
|
+
{ short: "Mon", long: "Monday", numeric: 2 },
|
|
28
|
+
{ short: "Tue", long: "Tuesday", numeric: 3 },
|
|
29
|
+
{ short: "Wed", long: "Wednesday", numeric: 4 },
|
|
30
|
+
{ short: "Thu", long: "Thursday", numeric: 5 },
|
|
31
|
+
{ short: "Fri", long: "Friday", numeric: 6 },
|
|
32
|
+
{ short: "Sat", long: "Saturday", numeric: 7 }
|
|
33
|
+
];
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
DAYS
|
|
37
|
+
});
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/lib/date/index.js
|
|
20
|
+
var date_exports = {};
|
|
21
|
+
__export(date_exports, {
|
|
22
|
+
DAYS: () => DAYS,
|
|
23
|
+
MONTHS: () => MONTHS,
|
|
24
|
+
getTimeInMs: () => getTimeInMs,
|
|
25
|
+
ms: () => ms,
|
|
26
|
+
toDays: () => toDays,
|
|
27
|
+
toHours: () => toHours,
|
|
28
|
+
toMinutes: () => toMinutes,
|
|
29
|
+
toReadableTime: () => toReadableTime,
|
|
30
|
+
toSeconds: () => toSeconds,
|
|
31
|
+
toWeeks: () => toWeeks
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(date_exports);
|
|
34
|
+
|
|
35
|
+
// src/lib/date/days.js
|
|
36
|
+
var DAYS = [
|
|
37
|
+
{ short: "Sun", long: "Sunday", numeric: 1 },
|
|
38
|
+
{ short: "Mon", long: "Monday", numeric: 2 },
|
|
39
|
+
{ short: "Tue", long: "Tuesday", numeric: 3 },
|
|
40
|
+
{ short: "Wed", long: "Wednesday", numeric: 4 },
|
|
41
|
+
{ short: "Thu", long: "Thursday", numeric: 5 },
|
|
42
|
+
{ short: "Fri", long: "Friday", numeric: 6 },
|
|
43
|
+
{ short: "Sat", long: "Saturday", numeric: 7 }
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
// src/lib/date/months.js
|
|
47
|
+
var MONTHS = [
|
|
48
|
+
{
|
|
49
|
+
long: "January",
|
|
50
|
+
short: "jan",
|
|
51
|
+
numeric: 1,
|
|
52
|
+
lastDay: { default: 31, leapYear: 31 }
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
long: "February",
|
|
56
|
+
short: "feb",
|
|
57
|
+
numeric: 2,
|
|
58
|
+
lastDay: { default: 28, leapYear: 29 }
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
long: "March",
|
|
62
|
+
short: "mar",
|
|
63
|
+
numeric: 3,
|
|
64
|
+
lastDay: { default: 31, leapYear: 31 }
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
long: "April",
|
|
68
|
+
short: "apr",
|
|
69
|
+
numeric: 4,
|
|
70
|
+
lastDay: { default: 30, leapYear: 30 }
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
long: "May",
|
|
74
|
+
short: "may",
|
|
75
|
+
numeric: 5,
|
|
76
|
+
lastDay: { default: 31, leapYear: 31 }
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
long: "June",
|
|
80
|
+
short: "jun",
|
|
81
|
+
numeric: 6,
|
|
82
|
+
lastDay: { default: 30, leapYear: 30 }
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
long: "July",
|
|
86
|
+
short: "jul",
|
|
87
|
+
numeric: 7,
|
|
88
|
+
lastDay: { default: 31, leapYear: 31 }
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
long: "August",
|
|
92
|
+
short: "aug",
|
|
93
|
+
numeric: 8,
|
|
94
|
+
lastDay: { default: 31, leapYear: 31 }
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
long: "September",
|
|
98
|
+
short: "sep",
|
|
99
|
+
numeric: 9,
|
|
100
|
+
lastDay: { default: 30, leapYear: 30 }
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
long: "October",
|
|
104
|
+
short: "oct",
|
|
105
|
+
numeric: 10,
|
|
106
|
+
lastDay: { default: 31, leapYear: 31 }
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
long: "November",
|
|
110
|
+
short: "nov",
|
|
111
|
+
numeric: 11,
|
|
112
|
+
lastDay: { default: 30, leapYear: 30 }
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
long: "December",
|
|
116
|
+
short: "dec",
|
|
117
|
+
numeric: 12,
|
|
118
|
+
lastDay: { default: 31, leapYear: 31 }
|
|
119
|
+
}
|
|
120
|
+
];
|
|
121
|
+
|
|
122
|
+
// src/lib/numbers/index.js
|
|
123
|
+
function splitUnit(string) {
|
|
124
|
+
if (typeof string === "number") return [string, null];
|
|
125
|
+
const regex = /(-?\d*\.?\d+)\s*([a-z]+)/i;
|
|
126
|
+
const match = string.match(regex);
|
|
127
|
+
if (match) return [parseFloat(match[1]), match[2]];
|
|
128
|
+
return [parseFloat(string), null];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// src/lib/date/time.js
|
|
132
|
+
function ms(arg) {
|
|
133
|
+
const [value, unit] = splitUnit(arg);
|
|
134
|
+
if (unit === "d") return getTimeInMs(value, "days");
|
|
135
|
+
if (unit === "day") return getTimeInMs(value, "days");
|
|
136
|
+
if (unit === "days") return getTimeInMs(value, "days");
|
|
137
|
+
if (unit === "h") return getTimeInMs(value, "hours");
|
|
138
|
+
if (unit === "hr") return getTimeInMs(value, "hours");
|
|
139
|
+
if (unit === "hour") return getTimeInMs(value, "hours");
|
|
140
|
+
if (unit === "hours") return getTimeInMs(value, "hours");
|
|
141
|
+
if (unit === "m") return getTimeInMs(value, "minutes");
|
|
142
|
+
if (unit === "min") return getTimeInMs(value, "minutes");
|
|
143
|
+
if (unit === "mins") return getTimeInMs(value, "minutes");
|
|
144
|
+
if (unit === "minute") return getTimeInMs(value, "minutes");
|
|
145
|
+
if (unit === "minutes") return getTimeInMs(value, "minutes");
|
|
146
|
+
if (unit === "s") return getTimeInMs(value, "seconds");
|
|
147
|
+
if (unit === "sec") return getTimeInMs(value, "seconds");
|
|
148
|
+
if (unit === "secs") return getTimeInMs(value, "seconds");
|
|
149
|
+
if (unit === "second") return getTimeInMs(value, "seconds");
|
|
150
|
+
if (unit === "seconds") return getTimeInMs(value, "seconds");
|
|
151
|
+
return value;
|
|
152
|
+
}
|
|
153
|
+
function getTimeInMs(value, unit = "ms") {
|
|
154
|
+
switch (unit) {
|
|
155
|
+
case "ms":
|
|
156
|
+
return value;
|
|
157
|
+
case "seconds":
|
|
158
|
+
return value * 1e3;
|
|
159
|
+
case "minutes":
|
|
160
|
+
return value * 1e3 * 60;
|
|
161
|
+
case "hours":
|
|
162
|
+
return value * 1e3 * 60 * 60;
|
|
163
|
+
case "days":
|
|
164
|
+
return value * 1e3 * 60 * 60 * 24;
|
|
165
|
+
case "weeks":
|
|
166
|
+
return value * 1e3 * 60 * 60 * 24 * 7;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function toWeeks(ms2) {
|
|
170
|
+
return ms2 / 1e3 / 60 / 60 / 24 / 7;
|
|
171
|
+
}
|
|
172
|
+
function toDays(ms2) {
|
|
173
|
+
return ms2 / 1e3 / 60 / 60 / 24;
|
|
174
|
+
}
|
|
175
|
+
function toHours(ms2) {
|
|
176
|
+
return ms2 / 1e3 / 60 / 60;
|
|
177
|
+
}
|
|
178
|
+
function toMinutes(ms2) {
|
|
179
|
+
return ms2 / 1e3 / 60;
|
|
180
|
+
}
|
|
181
|
+
function toSeconds(ms2) {
|
|
182
|
+
return ms2 / 1e3;
|
|
183
|
+
}
|
|
184
|
+
function toReadableTime(ms2) {
|
|
185
|
+
const weekMs = 1e3 * 60 * 60 * 24 * 7;
|
|
186
|
+
const dayMs = 1e3 * 60 * 60 * 24;
|
|
187
|
+
const hourMs = 1e3 * 60 * 60;
|
|
188
|
+
const minuteMs = 1e3 * 60;
|
|
189
|
+
const weeks = Math.floor(ms2 / weekMs);
|
|
190
|
+
const days = Math.floor(ms2 % weekMs / dayMs);
|
|
191
|
+
const hours = Math.floor(ms2 % dayMs / hourMs);
|
|
192
|
+
const minutes = Math.floor(ms2 % hourMs / minuteMs);
|
|
193
|
+
const seconds = Math.floor(ms2 % minuteMs / 1e3);
|
|
194
|
+
return { weeks, days, hours, minutes, seconds };
|
|
195
|
+
}
|
|
196
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
197
|
+
0 && (module.exports = {
|
|
198
|
+
DAYS,
|
|
199
|
+
MONTHS,
|
|
200
|
+
getTimeInMs,
|
|
201
|
+
ms,
|
|
202
|
+
toDays,
|
|
203
|
+
toHours,
|
|
204
|
+
toMinutes,
|
|
205
|
+
toReadableTime,
|
|
206
|
+
toSeconds,
|
|
207
|
+
toWeeks
|
|
208
|
+
});
|