@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,16 @@
|
|
|
1
|
+
import { objectForEach } from "./loop.js";
|
|
2
|
+
import { toCamel } from "../strings/convert-case/convert-case.js";
|
|
3
|
+
function camelCaseKeys(obj) {
|
|
4
|
+
if (typeof obj !== "object" || obj === null) {
|
|
5
|
+
return obj;
|
|
6
|
+
}
|
|
7
|
+
const result = {};
|
|
8
|
+
objectForEach(obj, ({ key, value }) => {
|
|
9
|
+
const camelCaseKey = toCamel(key);
|
|
10
|
+
result[camelCaseKey] = camelCaseKeys(value);
|
|
11
|
+
});
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
camelCaseKeys
|
|
16
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function isEmpty(obj) {
|
|
2
|
+
if (typeof obj === "undefined") return true;
|
|
3
|
+
if (obj === null) return true;
|
|
4
|
+
if (Array.isArray(obj)) return obj.length === 0;
|
|
5
|
+
return Object.keys(obj).length === 0;
|
|
6
|
+
}
|
|
7
|
+
function notEmpty(obj) {
|
|
8
|
+
return !isEmpty(obj);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
isEmpty,
|
|
12
|
+
notEmpty
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { objectForEach, objectMap } from "./loop.js";
|
|
2
|
+
import { curry } from "../functions/functional.js";
|
|
3
|
+
import { mix } from "./mix/mix.js";
|
|
4
|
+
function extendObject(object) {
|
|
5
|
+
const orig = object;
|
|
6
|
+
const extended = mix({}, object);
|
|
7
|
+
extended.forEach = curry(objectForEach)(orig);
|
|
8
|
+
extended.map = curry(objectMap)(orig);
|
|
9
|
+
return { orig, extended };
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
extendObject
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isObject } from "../checks.js";
|
|
2
|
+
function flattenObject(obj, { separator, prefix = "" }) {
|
|
3
|
+
return Object.entries(obj).reduce((acc, [key, value]) => {
|
|
4
|
+
const newKey = prefix ? `${prefix}${separator}${key}` : key;
|
|
5
|
+
const isAnObject = isObject(value);
|
|
6
|
+
const hasNestedObject = isAnObject && Object.values(value).some(isObject);
|
|
7
|
+
if (hasNestedObject) {
|
|
8
|
+
Object.assign(acc, flattenObject(value, { separator, prefix: newKey }));
|
|
9
|
+
} else {
|
|
10
|
+
acc[newKey] = value;
|
|
11
|
+
}
|
|
12
|
+
return acc;
|
|
13
|
+
}, {});
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
flattenObject
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from "./camelcase-keys.js";
|
|
2
|
+
export * from "./empty.js";
|
|
3
|
+
export * from "./equal.js";
|
|
4
|
+
export * from "./extend.js";
|
|
5
|
+
export * from "./flatten.js";
|
|
6
|
+
export * from "./json.js";
|
|
7
|
+
export * from "./loop.js";
|
|
8
|
+
export * from "./mix/mix.js";
|
|
9
|
+
export * from "./nested-property.js";
|
|
10
|
+
export * from "./normalize-object.js";
|
|
11
|
+
export * from "./omit-empty.js";
|
|
12
|
+
export * from "./size.js";
|
|
13
|
+
export * from "./split.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function objectForEach(object, callback) {
|
|
2
|
+
Object.entries(object).forEach(([key, value]) => {
|
|
3
|
+
callback({ key, value });
|
|
4
|
+
});
|
|
5
|
+
}
|
|
6
|
+
function objectMap(object, callback) {
|
|
7
|
+
return Object.entries(object).map(([key, value]) => {
|
|
8
|
+
return callback({ key, value });
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
objectForEach,
|
|
13
|
+
objectMap
|
|
14
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
const DEFAULT_OPTIONS = { array: "replace" };
|
|
2
|
+
const mix = createMix();
|
|
3
|
+
const concatMix = createMix({ array: "concat" });
|
|
4
|
+
function createMix(userOptions = {}) {
|
|
5
|
+
const options = { ...DEFAULT_OPTIONS, ...userOptions };
|
|
6
|
+
function _mix(...sources) {
|
|
7
|
+
const result = {};
|
|
8
|
+
for (const source of sources) {
|
|
9
|
+
if (source == null) continue;
|
|
10
|
+
merge(result, source, options);
|
|
11
|
+
}
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
return _mix;
|
|
15
|
+
}
|
|
16
|
+
function merge(output, input, options) {
|
|
17
|
+
const props = Object.keys(input);
|
|
18
|
+
for (const prop of props) {
|
|
19
|
+
if (prop === "__proto__") continue;
|
|
20
|
+
const descriptor = Object.getOwnPropertyDescriptor(input, prop);
|
|
21
|
+
const value = descriptor.value;
|
|
22
|
+
if (value) descriptor.value = cloneDescriptorValue(value);
|
|
23
|
+
if (!output[prop]) {
|
|
24
|
+
Object.defineProperty(output, prop, descriptor);
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
if (typeof output[prop] !== "object") {
|
|
28
|
+
Object.defineProperty(output, prop, descriptor);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (descriptor.value == null || typeof descriptor.value !== "object") {
|
|
32
|
+
Object.defineProperty(output, prop, descriptor);
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (objectType(descriptor.value) === "[object Array]") {
|
|
36
|
+
output[prop] = options.array === "replace" ? descriptor.value.slice() : output[prop].concat(descriptor.value);
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
merge(output[prop], descriptor.value, options);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function cloneDescriptorValue(value) {
|
|
43
|
+
if (objectType(value) === "[object Array]") {
|
|
44
|
+
const array = [];
|
|
45
|
+
for (let v of value) {
|
|
46
|
+
v = cloneDescriptorValue(v);
|
|
47
|
+
array.push(v);
|
|
48
|
+
}
|
|
49
|
+
return array;
|
|
50
|
+
}
|
|
51
|
+
if (objectType(value) === "[object Object]") {
|
|
52
|
+
const obj = {};
|
|
53
|
+
const props = Object.keys(value);
|
|
54
|
+
for (const prop of props) {
|
|
55
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, prop);
|
|
56
|
+
if (descriptor.value)
|
|
57
|
+
descriptor.value = cloneDescriptorValue(descriptor.value);
|
|
58
|
+
Object.defineProperty(obj, prop, descriptor);
|
|
59
|
+
}
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
if (objectType(value) === "[object Date]") {
|
|
63
|
+
return new Date(value.getTime());
|
|
64
|
+
}
|
|
65
|
+
if (objectType(value) === "[object Map]") {
|
|
66
|
+
const map = /* @__PURE__ */ new Map();
|
|
67
|
+
for (const entry of value) {
|
|
68
|
+
map.set(entry[0], cloneDescriptorValue(entry[1]));
|
|
69
|
+
}
|
|
70
|
+
return map;
|
|
71
|
+
}
|
|
72
|
+
if (objectType(value) === "[object Set]") {
|
|
73
|
+
const set = /* @__PURE__ */ new Set();
|
|
74
|
+
for (const entry of value.entries()) {
|
|
75
|
+
set.add(cloneDescriptorValue(entry[0]));
|
|
76
|
+
}
|
|
77
|
+
return set;
|
|
78
|
+
}
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
function objectType(value) {
|
|
82
|
+
return Object.prototype.toString.call(value);
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
concatMix,
|
|
86
|
+
createMix,
|
|
87
|
+
mix
|
|
88
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function getNestedProperty(object, pathArr) {
|
|
2
|
+
return pathArr.reduce(
|
|
3
|
+
(nestedObject, key) => nestedObject && nestedObject[key] !== "undefined" ? nestedObject[key] : void 0,
|
|
4
|
+
object
|
|
5
|
+
);
|
|
6
|
+
}
|
|
7
|
+
function getNestedProperty2(object, path) {
|
|
8
|
+
const pathArray = path.split(".");
|
|
9
|
+
return getNestedProperty(object, pathArray);
|
|
10
|
+
}
|
|
11
|
+
function getNestedValue(object, path) {
|
|
12
|
+
return path.split(".").reduce((acc, part) => acc?.[part], object);
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
getNestedProperty,
|
|
16
|
+
getNestedProperty2,
|
|
17
|
+
getNestedValue
|
|
18
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { pipe } from "../functions/functional.js";
|
|
2
|
+
import { camelCaseKeys } from "./camelcase-keys.js";
|
|
3
|
+
import { omitEmpty } from "./omit-empty.js";
|
|
4
|
+
function normalizeObject(object) {
|
|
5
|
+
return pipe(omitEmpty, camelCaseKeys)(object);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
normalizeObject
|
|
9
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
function omitEmpty(obj, shallow = false) {
|
|
2
|
+
if (typeof obj !== "object" || obj === null) return obj;
|
|
3
|
+
if (obj instanceof Date) return obj;
|
|
4
|
+
const result = Array.isArray(obj) ? [] : {};
|
|
5
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
6
|
+
if (value === null || value === void 0 || value === "" || typeof value === "object" && !(value instanceof Date) && Object.keys(value).length === 0) {
|
|
7
|
+
continue;
|
|
8
|
+
}
|
|
9
|
+
result[key] = shallow ? value : omitEmpty(value);
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
omitEmpty
|
|
15
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
function sizeOf(obj) {
|
|
2
|
+
let bytes = 0;
|
|
3
|
+
function size(obj2) {
|
|
4
|
+
if (obj2 !== null && obj2 !== void 0) {
|
|
5
|
+
switch (typeof obj2) {
|
|
6
|
+
case "number":
|
|
7
|
+
bytes += 8;
|
|
8
|
+
break;
|
|
9
|
+
case "string":
|
|
10
|
+
bytes += obj2.length * 2;
|
|
11
|
+
break;
|
|
12
|
+
case "boolean":
|
|
13
|
+
bytes += 4;
|
|
14
|
+
break;
|
|
15
|
+
case "object":
|
|
16
|
+
const objClass = Object.prototype.toString.call(obj2).slice(8, -1);
|
|
17
|
+
if (objClass === "Object" || objClass === "Array") {
|
|
18
|
+
for (const key in obj2) {
|
|
19
|
+
if (!obj2.hasOwnProperty(key)) continue;
|
|
20
|
+
size(obj2[key]);
|
|
21
|
+
}
|
|
22
|
+
} else bytes += obj2.toString().length * 2;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return bytes;
|
|
27
|
+
}
|
|
28
|
+
function formatByteSize(bytes2) {
|
|
29
|
+
if (bytes2 < 1024) return bytes2 + " bytes";
|
|
30
|
+
else if (bytes2 < 1048576) return (bytes2 / 1024).toFixed(3) + " KiB";
|
|
31
|
+
else if (bytes2 < 1073741824) return (bytes2 / 1048576).toFixed(3) + " MiB";
|
|
32
|
+
else return (bytes2 / 1073741824).toFixed(3) + " GiB";
|
|
33
|
+
}
|
|
34
|
+
return formatByteSize(size(obj));
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
sizeOf
|
|
38
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function splitObject(obj, keys) {
|
|
2
|
+
const picked = {};
|
|
3
|
+
const omitted = { ...obj };
|
|
4
|
+
keys.forEach((key) => {
|
|
5
|
+
if (key in obj) {
|
|
6
|
+
picked[key] = obj[key];
|
|
7
|
+
delete omitted[key];
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
return { picked, omitted, p: picked, o: omitted };
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
splitObject
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./reject.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import statuses from "statuses";
|
|
2
|
+
import { omitEmpty } from "../objects/omit-empty.js";
|
|
3
|
+
function reject(props, { includeStack = true } = {}) {
|
|
4
|
+
const { status, statusText, body, message } = props;
|
|
5
|
+
const e = new Error();
|
|
6
|
+
const err = {
|
|
7
|
+
status,
|
|
8
|
+
statusText: statusText || status && statuses(status),
|
|
9
|
+
body,
|
|
10
|
+
message,
|
|
11
|
+
stack: includeStack && e.stack
|
|
12
|
+
};
|
|
13
|
+
return Promise.reject(omitEmpty(err));
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
reject
|
|
17
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { parseJSON } from "./objects/json.js";
|
|
2
|
+
import { omitEmpty } from "./objects/omit-empty.js";
|
|
3
|
+
function createSSE({ event, data, id, retry }) {
|
|
4
|
+
const eventString = event ? `event: ${event}
|
|
5
|
+
` : "";
|
|
6
|
+
const idString = id ? `id: ${id}
|
|
7
|
+
` : "";
|
|
8
|
+
const retryString = retry ? `retry: ${retry}
|
|
9
|
+
` : "";
|
|
10
|
+
if (typeof data === "object") data = JSON.stringify(data);
|
|
11
|
+
const dataString = data ? `data: ${data}
|
|
12
|
+
` : "";
|
|
13
|
+
return `${eventString}${dataString}${idString}${retryString}
|
|
14
|
+
`;
|
|
15
|
+
}
|
|
16
|
+
function parseSSE(message) {
|
|
17
|
+
const lines = message.split("\n");
|
|
18
|
+
const result = {
|
|
19
|
+
event: "message",
|
|
20
|
+
// Default event type
|
|
21
|
+
data: "",
|
|
22
|
+
id: null,
|
|
23
|
+
retry: null
|
|
24
|
+
};
|
|
25
|
+
for (const line of lines) {
|
|
26
|
+
if (line.startsWith("data:")) {
|
|
27
|
+
const data = line.slice(5).trim();
|
|
28
|
+
result.data = parseJSON(data);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
if (line.startsWith("event:")) {
|
|
32
|
+
result.event = line.slice(6).trim();
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
if (line.startsWith("id:")) {
|
|
36
|
+
result.id = line.slice(3).trim();
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
if (line.startsWith("retry:")) {
|
|
40
|
+
result.retry = parseInt(line.slice(6).trim(), 10);
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const ret = omitEmpty(result);
|
|
45
|
+
return ret.data ? ret : null;
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
createSSE,
|
|
49
|
+
parseSSE
|
|
50
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
function toKebab(string) {
|
|
2
|
+
if (!string) return "";
|
|
3
|
+
return string.split("").map((letter, index) => {
|
|
4
|
+
const previousLetter = string[index - 1] || "";
|
|
5
|
+
const currentLetter = letter;
|
|
6
|
+
if (isDigit(currentLetter) && !isDigit(previousLetter)) {
|
|
7
|
+
return `-${currentLetter}`;
|
|
8
|
+
}
|
|
9
|
+
if (!isCaps(currentLetter)) return currentLetter;
|
|
10
|
+
if (previousLetter === "") {
|
|
11
|
+
return `${currentLetter.toLowerCase()}`;
|
|
12
|
+
}
|
|
13
|
+
if (isCaps(previousLetter)) {
|
|
14
|
+
return `${currentLetter.toLowerCase()}`;
|
|
15
|
+
}
|
|
16
|
+
return `-${currentLetter.toLowerCase()}`;
|
|
17
|
+
}).join("").trim().replace(/[-_\s]+/g, "-");
|
|
18
|
+
}
|
|
19
|
+
function toCamel(string) {
|
|
20
|
+
return toKebab(string).split("-").map((word, index) => {
|
|
21
|
+
if (index === 0) return word;
|
|
22
|
+
return word.slice(0, 1).toUpperCase() + word.slice(1).toLowerCase();
|
|
23
|
+
}).join("");
|
|
24
|
+
}
|
|
25
|
+
function toPascal(string) {
|
|
26
|
+
const camel = toCamel(string);
|
|
27
|
+
return camel.slice(0, 1).toUpperCase() + camel.slice(1);
|
|
28
|
+
}
|
|
29
|
+
function toTitle(string) {
|
|
30
|
+
return toKebab(string).split("-").map((word) => {
|
|
31
|
+
return word.slice(0, 1).toUpperCase() + word.slice(1);
|
|
32
|
+
}).join(" ");
|
|
33
|
+
}
|
|
34
|
+
function toSlug(string) {
|
|
35
|
+
return toKebab(string);
|
|
36
|
+
}
|
|
37
|
+
function toSentence(string) {
|
|
38
|
+
const interim = toKebab(string).replace(/-/g, " ");
|
|
39
|
+
return interim.slice(0, 1).toUpperCase() + interim.slice(1);
|
|
40
|
+
}
|
|
41
|
+
function toUpper(string) {
|
|
42
|
+
const interim = toKebab(string).replace(/-/g, " ");
|
|
43
|
+
return interim.toUpperCase();
|
|
44
|
+
}
|
|
45
|
+
function toLower(string) {
|
|
46
|
+
const interim = toKebab(string).replace(/-/g, " ");
|
|
47
|
+
return interim.toLowerCase();
|
|
48
|
+
}
|
|
49
|
+
function isCaps(char) {
|
|
50
|
+
return /\p{Lu}/u.test(char);
|
|
51
|
+
}
|
|
52
|
+
function isDigit(char) {
|
|
53
|
+
return /[0-9]/.test(char);
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
toCamel,
|
|
57
|
+
toKebab,
|
|
58
|
+
toLower,
|
|
59
|
+
toPascal,
|
|
60
|
+
toSentence,
|
|
61
|
+
toSlug,
|
|
62
|
+
toTitle,
|
|
63
|
+
toUpper
|
|
64
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import markdownit from "markdown-it";
|
|
2
|
+
import anchor from "markdown-it-anchor";
|
|
3
|
+
const md = markdownit({
|
|
4
|
+
html: true,
|
|
5
|
+
linkify: true,
|
|
6
|
+
typographer: true
|
|
7
|
+
});
|
|
8
|
+
md.use(anchor, {
|
|
9
|
+
permalink: false,
|
|
10
|
+
slugify: (s) => s.toLowerCase().replace(/\s+/g, "-").replace(/[^\w-]/g, "")
|
|
11
|
+
});
|
|
12
|
+
function markdown(content, options = {}) {
|
|
13
|
+
const defaultOptions = { inline: false };
|
|
14
|
+
const opts = { ...defaultOptions, ...options };
|
|
15
|
+
const { content: treated } = treatMarkdownWhitespace(content, opts);
|
|
16
|
+
if (opts.inline) return md.renderInline(treated);
|
|
17
|
+
return md.render(treated);
|
|
18
|
+
}
|
|
19
|
+
function treatMarkdownWhitespace(content, { inline } = {}) {
|
|
20
|
+
if (!content) return { content: "", inline };
|
|
21
|
+
const lines = content.split("\n");
|
|
22
|
+
if (lines[0] !== "" && inline) return { content, inline: true };
|
|
23
|
+
const firstLineWithLeadingSpacesIndex = lines.findIndex(
|
|
24
|
+
(line) => line.match(/^\s+/)
|
|
25
|
+
);
|
|
26
|
+
const firstLineWithLeadingSpaces = lines[firstLineWithLeadingSpacesIndex];
|
|
27
|
+
const indentation = firstLineWithLeadingSpaces?.match(/^\s+/)?.[0]?.length ?? 0;
|
|
28
|
+
const retContent = lines.map((line, index) => {
|
|
29
|
+
if (index < firstLineWithLeadingSpacesIndex) return line + "\n";
|
|
30
|
+
return line.slice(indentation) + "\n";
|
|
31
|
+
}).join("");
|
|
32
|
+
return {
|
|
33
|
+
content: retContent,
|
|
34
|
+
inline
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
markdown,
|
|
39
|
+
treatMarkdownWhitespace
|
|
40
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function parseFullName(name) {
|
|
2
|
+
const parts = name.trim().split(/\s+/);
|
|
3
|
+
if (parts.length === 1) {
|
|
4
|
+
return { firstName: parts[0], middleName: "", lastName: "" };
|
|
5
|
+
}
|
|
6
|
+
if (parts.length === 2) {
|
|
7
|
+
return { firstName: parts[0], middleName: "", lastName: parts[1] };
|
|
8
|
+
}
|
|
9
|
+
if (parts.length === 3) {
|
|
10
|
+
const firstName2 = parts.slice(0, 2).join(" ");
|
|
11
|
+
const lastName2 = parts[2];
|
|
12
|
+
return { firstName: firstName2, middleName: "", lastName: lastName2 };
|
|
13
|
+
}
|
|
14
|
+
const firstName = parts.slice(0, 2).join(" ");
|
|
15
|
+
const lastName = parts[parts.length - 1];
|
|
16
|
+
const middleName = parts.slice(2, -1).join(" ");
|
|
17
|
+
return { firstName, middleName, lastName };
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
parseFullName
|
|
21
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
function toQueryString(object) {
|
|
2
|
+
const searchParams = new URLSearchParams(object);
|
|
3
|
+
return searchParams.toString();
|
|
4
|
+
}
|
|
5
|
+
function plural(count, noun, suffix = "s") {
|
|
6
|
+
console.warn("plural is deprecated. Use pluralize instead");
|
|
7
|
+
return `${count} ${noun}${count !== 1 ? suffix : ""}`;
|
|
8
|
+
}
|
|
9
|
+
function stripNumbers(string) {
|
|
10
|
+
return string.replace(/\d*/, "");
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
plural,
|
|
14
|
+
stripNumbers,
|
|
15
|
+
toQueryString
|
|
16
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { toKebab } from "../strings/convert-case/convert-case.js";
|
|
2
|
+
function toStyleString(style) {
|
|
3
|
+
if (!style) return null;
|
|
4
|
+
if (typeof style === "string") return style;
|
|
5
|
+
return Object.entries(style).map(([k, v]) => {
|
|
6
|
+
if (k.startsWith("--")) return `${k}:${v}`;
|
|
7
|
+
else return `${toKebab(k)}:${v}`;
|
|
8
|
+
}).join("; ").concat(";");
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
toStyleString
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./symbols.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
function getSymbol(object, description) {
|
|
2
|
+
return Object.getOwnPropertySymbols(object).find(
|
|
3
|
+
(s) => s.description === description
|
|
4
|
+
);
|
|
5
|
+
}
|
|
6
|
+
function getSymbolValue(object, description) {
|
|
7
|
+
return object[getSymbol(object, description)];
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
getSymbol,
|
|
11
|
+
getSymbolValue
|
|
12
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
function __dirname(url) {
|
|
4
|
+
if (!url) throw Error("Please provide 'import.meta.url' to dirname");
|
|
5
|
+
return path.dirname(fileURLToPath(url));
|
|
6
|
+
}
|
|
7
|
+
function dirname(url) {
|
|
8
|
+
return __dirname(url);
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
__dirname,
|
|
12
|
+
dirname
|
|
13
|
+
};
|