@design-edito/tools 0.4.23 → 0.5.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/agnostic/arrays/find-duplicates/index.d.ts +1 -1
- package/agnostic/arrays/find-duplicates/index.js +3 -2
- package/agnostic/arrays/is-array-of/index.d.ts +1 -1
- package/agnostic/arrays/is-array-of/index.js +3 -1
- package/agnostic/arrays/make/index.d.ts +1 -1
- package/agnostic/arrays/random-pick/index.js +2 -1
- package/agnostic/arrays/shuffle/index.js +1 -1
- package/agnostic/booleans/is-falsy/index.d.ts +3 -3
- package/agnostic/booleans/is-falsy/index.js +2 -3
- package/agnostic/colors/channels/index.d.ts +16 -16
- package/agnostic/colors/channels/index.js +15 -15
- package/agnostic/colors/contrast/index.d.ts +6 -6
- package/agnostic/colors/contrast/index.js +6 -8
- package/agnostic/colors/contrast/index.test.js +1 -1
- package/agnostic/colors/convert/index.d.ts +43 -43
- package/agnostic/colors/convert/index.js +60 -55
- package/agnostic/colors/distance/index.d.ts +5 -5
- package/agnostic/colors/distance/index.js +5 -4
- package/agnostic/colors/grayscale/index.d.ts +3 -3
- package/agnostic/colors/grayscale/index.js +3 -3
- package/agnostic/colors/index.d.ts +3 -3
- package/agnostic/colors/index.js +3 -3
- package/agnostic/colors/invert/index.d.ts +4 -4
- package/agnostic/colors/invert/index.js +3 -3
- package/agnostic/colors/lerp/index.d.ts +6 -7
- package/agnostic/colors/lerp/index.js +5 -6
- package/agnostic/colors/luminance/index.d.ts +4 -4
- package/agnostic/colors/luminance/index.js +3 -3
- package/agnostic/colors/palette/index.d.ts +3 -3
- package/agnostic/colors/palette/index.js +4 -3
- package/agnostic/colors/rotate/index.d.ts +4 -4
- package/agnostic/colors/rotate/index.js +4 -4
- package/agnostic/colors/tidy/index.d.ts +2 -2
- package/agnostic/colors/tidy/index.js +2 -2
- package/agnostic/colors/typechecks/index.d.ts +21 -21
- package/agnostic/colors/typechecks/index.js +22 -21
- package/agnostic/colors/types.d.ts +33 -33
- package/agnostic/css/bem/index.d.ts +11 -11
- package/agnostic/css/bem/index.js +9 -8
- package/agnostic/css/clss/index.d.ts +1 -1
- package/agnostic/css/clss/index.js +1 -1
- package/agnostic/css/index.d.ts +1 -1
- package/agnostic/css/index.js +1 -1
- package/agnostic/css/is-valid-css-class-name/index.d.ts +2 -2
- package/agnostic/css/is-valid-css-class-name/index.js +3 -3
- package/agnostic/css/scale/index.d.ts +18 -18
- package/agnostic/css/scale/index.js +18 -18
- package/agnostic/css/styles-set/index.d.ts +1 -1
- package/agnostic/css/styles-set/index.js +0 -2
- package/agnostic/errors/register/index.d.ts +1 -1
- package/agnostic/errors/register/index.js +3 -0
- package/agnostic/errors/unknown-to-string/index.d.ts +2 -2
- package/agnostic/errors/unknown-to-string/index.js +2 -3
- package/agnostic/html/deep-select/index.d.ts +3 -3
- package/agnostic/html/deep-select/index.js +11 -7
- package/agnostic/html/get-node-ancestors/index.d.ts +3 -3
- package/agnostic/html/get-node-ancestors/index.js +3 -3
- package/agnostic/html/get-position-inside-parent/index.d.ts +2 -2
- package/agnostic/html/get-position-inside-parent/index.js +2 -2
- package/agnostic/html/hyper-json/cast/index.d.ts +1 -1
- package/agnostic/html/hyper-json/cast/index.js +6 -5
- package/agnostic/html/hyper-json/method/index.d.ts +2 -2
- package/agnostic/html/hyper-json/serialize/index.d.ts +1 -1
- package/agnostic/html/hyper-json/serialize/index.js +9 -5
- package/agnostic/html/hyper-json/smart-tags/coalesced/addclass/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/and/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/append/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/append/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/at/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/at/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/call/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/clone/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/deleteproperties/index.js +0 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/getattribute/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperties/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/getproperty/index.js +1 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/hjparse/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/hjstringify/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/hjstringify/index.js +4 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/if/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/if/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +6 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +6 -6
- package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/join/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/length/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/or/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/pickrandom/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/populate/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/print/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/print/index.js +2 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/push/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/pusheach/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.js +3 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeclass/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/select/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.js +3 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/setproperty/index.js +4 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.js +5 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/coalesced/toarray/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/toboolean/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/toelement/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/toggleclass/index.js +3 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonodelist/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonull/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/tonumber/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/torecord/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/toref/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/tostring/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/totext/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/transformselected/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/trim/index.js +1 -1
- package/agnostic/html/hyper-json/smart-tags/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/any/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/array/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/get/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/guess/index.js +3 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/isolated/index.js +2 -2
- package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.js +1 -0
- package/agnostic/html/hyper-json/smart-tags/isolated/null/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/record/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/ref/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/ref/index.js +3 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/text/index.js +2 -2
- package/agnostic/html/hyper-json/transformer/index.d.ts +5 -5
- package/agnostic/html/hyper-json/tree/index.d.ts +1 -1
- package/agnostic/html/hyper-json/tree/index.js +14 -8
- package/agnostic/html/hyper-json/types/index.d.ts +11 -11
- package/agnostic/html/hyper-json/utils/index.d.ts +3 -3
- package/agnostic/html/hyper-json/utils/index.js +8 -3
- package/agnostic/html/index.d.ts +4 -4
- package/agnostic/html/index.js +4 -4
- package/agnostic/html/insert-node/index.d.ts +4 -4
- package/agnostic/html/insert-node/index.js +4 -4
- package/agnostic/html/replace-in-element/index.d.ts +3 -3
- package/agnostic/html/replace-in-element/index.js +4 -4
- package/agnostic/html/selector-to-element/index.d.ts +2 -2
- package/agnostic/html/selector-to-element/index.js +11 -11
- package/agnostic/html/string-to-nodes/index.d.ts +3 -3
- package/agnostic/html/string-to-nodes/index.js +3 -3
- package/agnostic/html/watch-selection/index.d.ts +4 -5
- package/agnostic/html/watch-selection/index.js +5 -6
- package/agnostic/misc/assert/index.js +3 -1
- package/agnostic/misc/cast/index.d.ts +16 -16
- package/agnostic/misc/cast/index.js +18 -18
- package/agnostic/misc/connection/index.d.ts +5 -5
- package/agnostic/misc/connection/index.js +4 -2
- package/agnostic/misc/crawler/index.d.ts +18 -18
- package/agnostic/misc/crawler/index.js +10 -9
- package/agnostic/misc/crawler/index.test.js +2 -2
- package/agnostic/misc/crossenv/detect-runtime/index.d.ts +1 -1
- package/agnostic/misc/crossenv/detect-runtime/index.js +10 -11
- package/agnostic/misc/crossenv/window/index.d.ts +6 -6
- package/agnostic/misc/crossenv/window/index.js +6 -5
- package/agnostic/misc/data-size/index.js +2 -0
- package/agnostic/misc/index.d.ts +2 -2
- package/agnostic/misc/index.js +2 -2
- package/agnostic/misc/is-constructor-function/index.d.ts +2 -2
- package/agnostic/misc/is-constructor-function/index.js +3 -2
- package/agnostic/misc/is-constructor-function/index.test.js +2 -2
- package/agnostic/misc/is-nullish/index.d.ts +5 -5
- package/agnostic/misc/is-nullish/index.js +5 -4
- package/agnostic/misc/logs/index.d.ts +1 -1
- package/agnostic/misc/logs/index.js +1 -1
- package/agnostic/misc/logs/logger/index.js +2 -2
- package/agnostic/misc/lorem-ipsum/index.js +4 -4
- package/agnostic/misc/normalize-extension/index.d.ts +3 -3
- package/agnostic/misc/normalize-extension/index.js +4 -4
- package/agnostic/misc/outcome/index.d.ts +14 -14
- package/agnostic/misc/outcome/index.js +6 -4
- package/agnostic/numbers/absolute-modulo/index.d.ts +3 -3
- package/agnostic/numbers/absolute-modulo/index.js +3 -3
- package/agnostic/numbers/approximate-rational/index.d.ts +6 -6
- package/agnostic/numbers/approximate-rational/index.js +9 -9
- package/agnostic/numbers/clamp/index.d.ts +4 -4
- package/agnostic/numbers/clamp/index.js +4 -4
- package/agnostic/numbers/geometric-progressions/index.d.ts +5 -5
- package/agnostic/numbers/geometric-progressions/index.js +7 -5
- package/agnostic/numbers/geometric-progressions/index.test.js +2 -2
- package/agnostic/numbers/index.d.ts +1 -1
- package/agnostic/numbers/index.js +1 -1
- package/agnostic/numbers/interpolate/index.d.ts +8 -8
- package/agnostic/numbers/interpolate/index.js +8 -8
- package/agnostic/numbers/round/index.d.ts +9 -9
- package/agnostic/numbers/round/index.js +9 -9
- package/agnostic/objects/deep-get-property/index.d.ts +4 -4
- package/agnostic/objects/deep-get-property/index.js +3 -3
- package/agnostic/objects/enums/is-in-enum/index.d.ts +3 -3
- package/agnostic/objects/enums/is-in-enum/index.js +3 -3
- package/agnostic/objects/flatten-getters/index.d.ts +2 -2
- package/agnostic/objects/flatten-getters/index.js +3 -2
- package/agnostic/objects/index.d.ts +2 -2
- package/agnostic/objects/index.js +2 -2
- package/agnostic/objects/is-object/index.d.ts +4 -4
- package/agnostic/objects/is-object/index.js +4 -4
- package/agnostic/objects/is-record/index.d.ts +2 -2
- package/agnostic/objects/is-record/index.js +2 -2
- package/agnostic/objects/record-format/index.d.ts +9 -9
- package/agnostic/objects/record-format/index.js +8 -3
- package/agnostic/objects/record-map/index.d.ts +4 -4
- package/agnostic/objects/record-map/index.js +5 -3
- package/agnostic/objects/sort-keys/index.d.ts +3 -3
- package/agnostic/objects/sort-keys/index.js +4 -3
- package/agnostic/objects/validation/index.d.ts +3 -3
- package/agnostic/objects/validation/index.js +4 -3
- package/agnostic/optim/memoize/index.d.ts +2 -2
- package/agnostic/optim/memoize/index.js +4 -2
- package/agnostic/optim/throttle-debounce/index.d.ts +2 -2
- package/agnostic/optim/throttle-debounce/index.js +7 -6
- package/agnostic/optim/throttle-debounce/types.d.ts +2 -1
- package/agnostic/random/random/index.d.ts +7 -8
- package/agnostic/random/random/index.js +3 -3
- package/agnostic/random/uuid/index.d.ts +6 -6
- package/agnostic/random/uuid/index.js +6 -6
- package/agnostic/regexps/index.d.ts +30 -60
- package/agnostic/regexps/index.js +27 -26
- package/agnostic/sanitization/file-name/index.d.ts +3 -3
- package/agnostic/sanitization/file-name/index.js +10 -10
- package/agnostic/sanitization/html/index.d.ts +6 -6
- package/agnostic/sanitization/html/index.js +9 -6
- package/agnostic/sanitization/index.d.ts +1 -1
- package/agnostic/sanitization/index.js +1 -1
- package/agnostic/sanitization/path/index.d.ts +2 -2
- package/agnostic/sanitization/path/index.js +2 -2
- package/agnostic/sanitization/user-input/index.js +1 -0
- package/agnostic/strings/char-codes/index.js +2 -6
- package/agnostic/strings/index.d.ts +1 -1
- package/agnostic/strings/index.js +1 -1
- package/agnostic/strings/normalize-indent/index.js +2 -2
- package/agnostic/strings/parse-table/index.d.ts +13 -13
- package/agnostic/strings/parse-table/index.js +31 -16
- package/agnostic/strings/replace-all/index.d.ts +1 -1
- package/agnostic/strings/replace-all/index.js +1 -0
- package/agnostic/strings/to-alphanum/index.js +2 -2
- package/agnostic/strings/trim/index.js +2 -2
- package/agnostic/time/dates/format-date/index.js +3 -1
- package/agnostic/time/dates/index.d.ts +1 -0
- package/agnostic/time/dates/index.js +1 -0
- package/agnostic/time/dates/to-french-republican/index.d.ts +16 -0
- package/agnostic/time/dates/to-french-republican/index.js +82 -0
- package/agnostic/time/dates/to-french-republican/index.test.d.ts +1 -0
- package/agnostic/time/dates/to-french-republican/index.test.js +112 -0
- package/agnostic/time/dates/to-french-republican/types.d.ts +91 -0
- package/agnostic/time/dates/to-french-republican/types.js +47 -0
- package/agnostic/time/dates/to-french-republican/utils.d.ts +32 -0
- package/agnostic/time/dates/to-french-republican/utils.js +155 -0
- package/agnostic/time/duration/index.js +2 -0
- package/agnostic/time/index.d.ts +2 -2
- package/agnostic/time/index.js +2 -2
- package/agnostic/time/timeout/index.js +9 -9
- package/agnostic/time/transitions/index.js +8 -7
- package/components/BeforeAfter/index.controlled.js +1 -0
- package/components/BeforeAfter/index.js +4 -0
- package/components/Button/index.d.ts +1 -1
- package/components/Clippable/index.js +1 -0
- package/components/Drawer/index.js +1 -1
- package/components/Gallery/index.js +2 -1
- package/components/Gallery/utils.js +5 -1
- package/components/Iframe/index.js +3 -0
- package/components/Image/index.js +2 -0
- package/components/Input/index.controlled.js +3 -2
- package/components/IntersectionObserver/index.js +5 -2
- package/components/JsonEditor/index.js +1 -1
- package/components/Overlayer/index.d.ts +1 -1
- package/components/ScrollListener/utils.d.ts +29 -0
- package/components/Select/index.controlled.js +3 -2
- package/components/Sequencer/index.controlled.js +1 -1
- package/components/Subtitles/index.js +3 -1
- package/components/Subtitles/types.d.ts +14 -0
- package/components/Subtitles/utils.d.ts +19 -15
- package/components/Subtitles/utils.js +29 -24
- package/components/Textarea/index.controlled.js +3 -2
- package/components/UIModule/index.js +3 -1
- package/components/Video/index.controlled.d.ts +1 -1
- package/components/Video/index.controlled.js +11 -10
- package/components/Video/index.js +27 -20
- package/components/Video/utils.d.ts +1 -1
- package/components/Video/utils.js +11 -2
- package/components/index.d.ts +2 -2
- package/components/index.js +2 -2
- package/components/utils/types.d.ts +5 -0
- package/node/@aws-s3/storage/directory/copy-dir/index.d.ts +9 -9
- package/node/@aws-s3/storage/directory/copy-dir/index.js +15 -12
- package/node/@aws-s3/storage/directory/list/index.d.ts +5 -5
- package/node/@aws-s3/storage/directory/list/index.js +5 -5
- package/node/@aws-s3/storage/directory/move-dir/index.d.ts +6 -6
- package/node/@aws-s3/storage/directory/move-dir/index.js +11 -7
- package/node/@aws-s3/storage/directory/remove-dir/index.d.ts +5 -5
- package/node/@aws-s3/storage/directory/remove-dir/index.js +5 -5
- package/node/@aws-s3/storage/file/copy/index.d.ts +8 -8
- package/node/@aws-s3/storage/file/copy/index.js +12 -9
- package/node/@aws-s3/storage/file/download/index.d.ts +6 -6
- package/node/@aws-s3/storage/file/download/index.js +6 -5
- package/node/@aws-s3/storage/file/exists/index.d.ts +6 -6
- package/node/@aws-s3/storage/file/exists/index.js +15 -12
- package/node/@aws-s3/storage/file/move/index.d.ts +9 -9
- package/node/@aws-s3/storage/file/move/index.js +18 -15
- package/node/@aws-s3/storage/file/remove/index.d.ts +5 -5
- package/node/@aws-s3/storage/file/remove/index.js +16 -11
- package/node/@aws-s3/storage/file/stat/index.d.ts +5 -5
- package/node/@aws-s3/storage/file/stat/index.js +10 -7
- package/node/@aws-s3/storage/file/upload/index.d.ts +7 -7
- package/node/@aws-s3/storage/file/upload/index.js +11 -9
- package/node/@express/@multer/index.d.ts +12 -12
- package/node/@express/@multer/index.js +27 -25
- package/node/@google-cloud/storage/bucket/get-metadata/index.d.ts +4 -4
- package/node/@google-cloud/storage/bucket/get-metadata/index.js +3 -3
- package/node/@google-cloud/storage/directory/copy-dir/index.d.ts +7 -7
- package/node/@google-cloud/storage/directory/copy-dir/index.js +6 -6
- package/node/@google-cloud/storage/directory/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/index.js +1 -1
- package/node/@google-cloud/storage/directory/list/index.d.ts +6 -6
- package/node/@google-cloud/storage/directory/list/index.js +5 -5
- package/node/@google-cloud/storage/directory/move-dir/index.d.ts +6 -6
- package/node/@google-cloud/storage/directory/move-dir/index.js +5 -5
- package/node/@google-cloud/storage/directory/remove-dir/index.d.ts +7 -7
- package/node/@google-cloud/storage/directory/remove-dir/index.js +6 -6
- package/node/@google-cloud/storage/file/copy/index.d.ts +9 -9
- package/node/@google-cloud/storage/file/copy/index.js +8 -8
- package/node/@google-cloud/storage/file/download/index.d.ts +7 -7
- package/node/@google-cloud/storage/file/download/index.js +5 -5
- package/node/@google-cloud/storage/file/exists/index.d.ts +7 -7
- package/node/@google-cloud/storage/file/exists/index.js +6 -6
- package/node/@google-cloud/storage/file/generate-signed-url/index.d.ts +7 -7
- package/node/@google-cloud/storage/file/generate-signed-url/index.js +6 -6
- package/node/@google-cloud/storage/file/get-metadata/index.d.ts +5 -5
- package/node/@google-cloud/storage/file/get-metadata/index.js +4 -4
- package/node/@google-cloud/storage/file/get-permissions/index.d.ts +6 -6
- package/node/@google-cloud/storage/file/get-permissions/index.js +4 -4
- package/node/@google-cloud/storage/file/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/index.js +1 -1
- package/node/@google-cloud/storage/file/move/index.d.ts +10 -10
- package/node/@google-cloud/storage/file/move/index.js +9 -9
- package/node/@google-cloud/storage/file/remove/index.d.ts +5 -5
- package/node/@google-cloud/storage/file/remove/index.js +4 -4
- package/node/@google-cloud/storage/file/revoke-signed-urls/index.d.ts +5 -5
- package/node/@google-cloud/storage/file/revoke-signed-urls/index.js +5 -5
- package/node/@google-cloud/storage/file/stat/index.d.ts +5 -5
- package/node/@google-cloud/storage/file/stat/index.js +4 -4
- package/node/@google-cloud/storage/file/update-metadata/index.d.ts +7 -7
- package/node/@google-cloud/storage/file/update-metadata/index.js +5 -5
- package/node/@google-cloud/storage/file/upload/index.d.ts +7 -7
- package/node/@google-cloud/storage/file/upload/index.js +5 -5
- package/node/cloud-storage/clients/index.d.ts +8 -8
- package/node/cloud-storage/clients/index.js +8 -8
- package/node/cloud-storage/operations/copy-dir/index.d.ts +22 -22
- package/node/cloud-storage/operations/copy-dir/index.js +5 -5
- package/node/cloud-storage/operations/copy-file/index.d.ts +22 -22
- package/node/cloud-storage/operations/copy-file/index.js +5 -5
- package/node/cloud-storage/operations/download-file/index.d.ts +19 -19
- package/node/cloud-storage/operations/download-file/index.js +6 -6
- package/node/cloud-storage/operations/exists-file/index.d.ts +15 -26
- package/node/cloud-storage/operations/exists-file/index.js +4 -4
- package/node/cloud-storage/operations/list-dir/index.d.ts +15 -25
- package/node/cloud-storage/operations/list-dir/index.js +4 -4
- package/node/cloud-storage/operations/move-dir/index.d.ts +22 -22
- package/node/cloud-storage/operations/move-dir/index.js +5 -5
- package/node/cloud-storage/operations/move-file/index.d.ts +22 -22
- package/node/cloud-storage/operations/move-file/index.js +5 -5
- package/node/cloud-storage/operations/remove-dir/index.d.ts +18 -18
- package/node/cloud-storage/operations/remove-dir/index.js +4 -4
- package/node/cloud-storage/operations/remove-file/index.d.ts +18 -18
- package/node/cloud-storage/operations/remove-file/index.js +4 -4
- package/node/cloud-storage/operations/stat-file/index.d.ts +16 -16
- package/node/cloud-storage/operations/stat-file/index.js +4 -4
- package/node/cloud-storage/operations/upload-file/index.d.ts +23 -23
- package/node/cloud-storage/operations/upload-file/index.js +5 -5
- package/node/encryption/@aes-256-gcm/buffer/index.d.ts +6 -6
- package/node/encryption/@aes-256-gcm/buffer/index.js +6 -6
- package/node/encryption/@aes-256-gcm/uint8-array/index.d.ts +8 -8
- package/node/encryption/@aes-256-gcm/uint8-array/index.js +8 -8
- package/node/encryption/key/index.d.ts +6 -6
- package/node/encryption/key/index.js +6 -6
- package/node/files/read-write/index.d.ts +16 -16
- package/node/files/subpaths/index.d.ts +8 -8
- package/node/files/subpaths/index.js +11 -13
- package/node/ftps/directory/copy-dir/index.d.ts +6 -6
- package/node/ftps/directory/copy-dir/index.js +6 -6
- package/node/ftps/directory/list/index.d.ts +4 -4
- package/node/ftps/directory/list/index.js +3 -3
- package/node/ftps/directory/move-dir/index.d.ts +6 -6
- package/node/ftps/directory/move-dir/index.js +5 -5
- package/node/ftps/directory/remove-dir/index.d.ts +6 -6
- package/node/ftps/directory/remove-dir/index.js +8 -7
- package/node/ftps/file/copy/index.d.ts +6 -6
- package/node/ftps/file/copy/index.js +5 -5
- package/node/ftps/file/download/index.d.ts +6 -6
- package/node/ftps/file/download/index.js +5 -5
- package/node/ftps/file/exists/index.d.ts +3 -3
- package/node/ftps/file/exists/index.js +3 -3
- package/node/ftps/file/move/index.d.ts +8 -8
- package/node/ftps/file/move/index.js +11 -9
- package/node/ftps/file/remove/index.d.ts +5 -5
- package/node/ftps/file/remove/index.js +4 -4
- package/node/ftps/file/stat/index.d.ts +4 -4
- package/node/ftps/file/stat/index.js +4 -4
- package/node/ftps/file/upload/index.d.ts +7 -7
- package/node/ftps/file/upload/index.js +5 -5
- package/node/images/create/index.d.ts +2 -2
- package/node/images/create/index.js +1 -1
- package/node/images/format/index.d.ts +8 -8
- package/node/images/metadata/index.d.ts +2 -2
- package/node/images/transform/index.d.ts +2 -2
- package/node/images/transform/index.js +12 -2
- package/node/images/transform/operations/blur/index.d.ts +2 -2
- package/node/images/transform/operations/blur/index.js +1 -0
- package/node/images/transform/operations/brighten/index.d.ts +2 -2
- package/node/images/transform/operations/brighten/index.js +1 -0
- package/node/images/transform/operations/extend/index.d.ts +2 -2
- package/node/images/transform/operations/extend/index.js +1 -0
- package/node/images/transform/operations/extract/index.d.ts +2 -2
- package/node/images/transform/operations/extract/index.js +1 -0
- package/node/images/transform/operations/flatten/index.d.ts +2 -2
- package/node/images/transform/operations/flatten/index.js +1 -0
- package/node/images/transform/operations/flip/index.d.ts +2 -2
- package/node/images/transform/operations/flip/index.js +1 -0
- package/node/images/transform/operations/flop/index.d.ts +2 -2
- package/node/images/transform/operations/flop/index.js +1 -0
- package/node/images/transform/operations/hue/index.d.ts +2 -2
- package/node/images/transform/operations/hue/index.js +1 -0
- package/node/images/transform/operations/index.d.ts +2 -2
- package/node/images/transform/operations/index.js +2 -2
- package/node/images/transform/operations/level/index.d.ts +2 -2
- package/node/images/transform/operations/level/index.js +1 -0
- package/node/images/transform/operations/lighten/index.d.ts +2 -2
- package/node/images/transform/operations/lighten/index.js +1 -0
- package/node/images/transform/operations/normalize/index.d.ts +2 -2
- package/node/images/transform/operations/normalize/index.js +1 -0
- package/node/images/transform/operations/overlay/index.d.ts +2 -2
- package/node/images/transform/operations/resize/index.d.ts +2 -2
- package/node/images/transform/operations/resize/index.js +1 -0
- package/node/images/transform/operations/rotate/index.d.ts +2 -2
- package/node/images/transform/operations/rotate/index.js +1 -0
- package/node/images/transform/operations/saturate/index.d.ts +2 -2
- package/node/images/transform/operations/saturate/index.js +1 -0
- package/node/images/types.d.ts +41 -2
- package/node/images/utils/index.d.ts +10 -5
- package/node/process/index.d.ts +1 -1
- package/node/process/index.js +1 -1
- package/node/process/on-exit/index.js +2 -4
- package/node/process/prompt-continue/index.d.ts +3 -3
- package/node/process/prompt-continue/index.js +4 -3
- package/node/process/spawner/index.js +7 -6
- package/node/sftp/directory/copy-dir/index.d.ts +6 -6
- package/node/sftp/directory/copy-dir/index.js +6 -6
- package/node/sftp/directory/list/index.d.ts +3 -3
- package/node/sftp/directory/list/index.js +4 -4
- package/node/sftp/directory/move-dir/index.d.ts +7 -7
- package/node/sftp/directory/move-dir/index.js +7 -7
- package/node/sftp/directory/remove-dir/index.d.ts +5 -5
- package/node/sftp/directory/remove-dir/index.js +8 -7
- package/node/sftp/file/copy/index.d.ts +6 -6
- package/node/sftp/file/copy/index.js +5 -5
- package/node/sftp/file/download/index.d.ts +7 -7
- package/node/sftp/file/download/index.js +5 -5
- package/node/sftp/file/exists/index.d.ts +3 -3
- package/node/sftp/file/exists/index.js +3 -3
- package/node/sftp/file/index.d.ts +1 -1
- package/node/sftp/file/index.js +1 -1
- package/node/sftp/file/move/index.d.ts +7 -7
- package/node/sftp/file/move/index.js +7 -7
- package/node/sftp/file/remove/index.d.ts +4 -4
- package/node/sftp/file/remove/index.js +4 -4
- package/node/sftp/file/stat/index.d.ts +3 -3
- package/node/sftp/file/stat/index.js +6 -5
- package/node/sftp/file/upload/index.d.ts +6 -6
- package/node/sftp/file/upload/index.js +5 -5
- package/package.json +40 -39
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Merges multiple flag strings into a single string containing each flag only once.
|
|
3
3
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @returns
|
|
4
|
+
* @param flagStrs - Flag strings to merge.
|
|
5
|
+
* @returns Merged flags string.
|
|
6
6
|
*/
|
|
7
7
|
export function mergeFlags(...flagStrs) {
|
|
8
8
|
const flagsSet = new Set();
|
|
9
9
|
flagStrs.forEach(flagStr => flagStr
|
|
10
10
|
.split('')
|
|
11
|
-
.forEach(char => flagsSet.add(char)));
|
|
11
|
+
.forEach(char => { flagsSet.add(char); }));
|
|
12
12
|
return Array.from(flagsSet.values()).join('');
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* Returns a new RegExp with combined flags.
|
|
16
16
|
*
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @returns
|
|
17
|
+
* @param regexp - The original regular expression.
|
|
18
|
+
* @param flags - Flags to add.
|
|
19
|
+
* @returns New regular expression with combined flags.
|
|
20
20
|
*/
|
|
21
21
|
export function setFlags(regexp, flags) {
|
|
22
22
|
const mergedFlags = mergeFlags(regexp.flags, flags);
|
|
23
|
-
return new RegExp(
|
|
23
|
+
return new RegExp(regexp.source, mergedFlags);
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Anchors a RegExp to the start of a string.
|
|
27
27
|
*
|
|
28
|
-
* @param
|
|
29
|
-
* @param
|
|
30
|
-
* @returns
|
|
28
|
+
* @param regexp - The original regular expression.
|
|
29
|
+
* @param [flags='g'] - Optional flags to apply.
|
|
30
|
+
* @returns Anchored RegExp.
|
|
31
31
|
*/
|
|
32
32
|
export function fromStart(regexp, flags = 'g') {
|
|
33
33
|
const mergedFlags = mergeFlags(regexp.flags, flags);
|
|
@@ -36,9 +36,9 @@ export function fromStart(regexp, flags = 'g') {
|
|
|
36
36
|
/**
|
|
37
37
|
* Anchors a RegExp to the end of a string.
|
|
38
38
|
*
|
|
39
|
-
* @param
|
|
40
|
-
* @param
|
|
41
|
-
* @returns
|
|
39
|
+
* @param regexp - The original regular expression.
|
|
40
|
+
* @param [flags='g'] - Optional flags to apply.
|
|
41
|
+
* @returns Anchored RegExp.
|
|
42
42
|
*/
|
|
43
43
|
export function toEnd(regexp, flags = 'g') {
|
|
44
44
|
const mergedFlags = mergeFlags(regexp.flags, flags);
|
|
@@ -47,9 +47,9 @@ export function toEnd(regexp, flags = 'g') {
|
|
|
47
47
|
/**
|
|
48
48
|
* Anchors a RegExp to match the entire string.
|
|
49
49
|
*
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
* @returns
|
|
50
|
+
* @param regexp - The original regular expression.
|
|
51
|
+
* @param [flags='g'] - Optional flags to apply.
|
|
52
|
+
* @returns Anchored RegExp.
|
|
53
53
|
*/
|
|
54
54
|
export function fromStartToEnd(regexp, flags = 'g') {
|
|
55
55
|
const mergedFlags = mergeFlags(regexp.flags, flags);
|
|
@@ -70,13 +70,13 @@ export function stringIs(string, regexp, returnMatches = false, flags = 'g') {
|
|
|
70
70
|
/**
|
|
71
71
|
* Creates a RegExp that matches any of the provided strings.
|
|
72
72
|
*
|
|
73
|
-
* @param
|
|
74
|
-
* @returns
|
|
73
|
+
* @param strings - Strings to match.
|
|
74
|
+
* @returns Regular expression matching all strings.
|
|
75
75
|
*/
|
|
76
76
|
export function fromStrings(strings) {
|
|
77
77
|
const rootsMap = stringsToRootsMap(strings);
|
|
78
78
|
const source = sourceFromRootsMap(rootsMap, false);
|
|
79
|
-
const regexp = new RegExp(source);
|
|
79
|
+
const regexp = new RegExp(source, 'v');
|
|
80
80
|
return regexp;
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
@@ -85,8 +85,8 @@ export function fromStrings(strings) {
|
|
|
85
85
|
* - Other whitespace characters are normalized to `\\s`
|
|
86
86
|
* - RegExp special characters (including backslash) are escaped
|
|
87
87
|
*
|
|
88
|
-
* @param
|
|
89
|
-
* @returns
|
|
88
|
+
* @param string - String to escape.
|
|
89
|
+
* @returns Escaped string.
|
|
90
90
|
*/
|
|
91
91
|
export function escape(string) {
|
|
92
92
|
let result = '';
|
|
@@ -94,11 +94,11 @@ export function escape(string) {
|
|
|
94
94
|
if (ch === '\n') {
|
|
95
95
|
result += '\\n';
|
|
96
96
|
}
|
|
97
|
-
else if (/\s
|
|
97
|
+
else if (/\s/v.test(ch)) {
|
|
98
98
|
result += '\\s'; // any other whitespace (space, tab, etc.)
|
|
99
99
|
}
|
|
100
|
-
else if (/[
|
|
101
|
-
result +=
|
|
100
|
+
else if (/[.*+?^$\{\}\(\)\|\[\]\\]/v.test(ch)) {
|
|
101
|
+
result += `\\${ch}`; // regex special chars (including backslash)
|
|
102
102
|
}
|
|
103
103
|
else {
|
|
104
104
|
result += ch;
|
|
@@ -114,14 +114,15 @@ function stringsToRootsMap(strings, rootsMap = new Map()) {
|
|
|
114
114
|
if (firstChar === undefined)
|
|
115
115
|
return;
|
|
116
116
|
const roots = Array.from(rootsMap.keys());
|
|
117
|
-
const foundRoot = roots.find(root => new RegExp(`^(${escape(root)})
|
|
117
|
+
const foundRoot = roots.find(root => new RegExp(`^(${escape(root)})`, 'v').test(string));
|
|
118
118
|
const subRootsMap = foundRoot !== undefined
|
|
119
119
|
? rootsMap.get(foundRoot)?.subRootsMap
|
|
120
120
|
: undefined;
|
|
121
121
|
if (foundRoot === undefined || subRootsMap === undefined) {
|
|
122
122
|
const subRootsMap = new Map();
|
|
123
123
|
stringsToRootsMap([lastChars.join('')], subRootsMap);
|
|
124
|
-
|
|
124
|
+
rootsMap.set(firstChar, { subRootsMap, isWordEnd });
|
|
125
|
+
return;
|
|
125
126
|
}
|
|
126
127
|
stringsToRootsMap([lastChars.join('')], subRootsMap);
|
|
127
128
|
});
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* - Replaces multiple dots with a single dot and removes leading/trailing dots.
|
|
7
7
|
* - Normalizes Unicode to NFKC form to prevent homoglyph attacks.
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @returns
|
|
9
|
+
* @param input - The file name to sanitize.
|
|
10
|
+
* @param [maxLength=255] - Maximum allowed length of the sanitized file name.
|
|
11
|
+
* @returns Sanitized file name, or null if empty or exceeds maxLength.
|
|
12
12
|
*/
|
|
13
13
|
export declare function sanitizeFileName(input: string, maxLength?: number): string | null;
|
|
@@ -6,20 +6,20 @@
|
|
|
6
6
|
* - Replaces multiple dots with a single dot and removes leading/trailing dots.
|
|
7
7
|
* - Normalizes Unicode to NFKC form to prevent homoglyph attacks.
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @returns
|
|
9
|
+
* @param input - The file name to sanitize.
|
|
10
|
+
* @param [maxLength=255] - Maximum allowed length of the sanitized file name.
|
|
11
|
+
* @returns Sanitized file name, or null if empty or exceeds maxLength.
|
|
12
12
|
*/
|
|
13
13
|
export function sanitizeFileName(input, maxLength = 255) {
|
|
14
|
-
|
|
14
|
+
const _input = input
|
|
15
15
|
.normalize('NFKC') // Normalize Unicode to avoid homoglyph attacks
|
|
16
16
|
// eslint-disable-next-line no-control-regex
|
|
17
|
-
.replace(/[<>:"
|
|
17
|
+
.replace(/[<>:"\/\\\|?*\x00-\x1F]/gv, '') // Remove invalid characters (e.g., Windows and Unix forbidden characters)
|
|
18
18
|
.trim() // Trim whitespace
|
|
19
|
-
.replace(/\s+/
|
|
20
|
-
.replace(/\.+/
|
|
21
|
-
.replace(/^\.+|\.+$/
|
|
22
|
-
if (
|
|
19
|
+
.replace(/\s+/gv, ' ') // Replace multiple spaces with a single space
|
|
20
|
+
.replace(/\.+/gv, '.') // Replace multiple dots with a single dot
|
|
21
|
+
.replace(/^\.+|\.+$/gv, ''); // Remove leading/trailing dots
|
|
22
|
+
if (_input.length > maxLength)
|
|
23
23
|
return null;
|
|
24
|
-
return
|
|
24
|
+
return _input.length > 0 ? _input : null;
|
|
25
25
|
}
|
|
@@ -24,9 +24,9 @@ export declare const defaultOptions: SanitizeHtmlOptions;
|
|
|
24
24
|
* This API must not be used as a security boundary for untrusted HTML.
|
|
25
25
|
* For security-critical sanitization, use a dedicated, security-audited library.
|
|
26
26
|
*
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @returns
|
|
27
|
+
* @param inputStr - The HTML string to sanitize.
|
|
28
|
+
* @param [options=defaultOptions] - Sanitization configuration.
|
|
29
|
+
* @returns The sanitized HTML string.
|
|
30
30
|
*
|
|
31
31
|
* @throws Will throw an error if no document object is available for creating elements.
|
|
32
32
|
*/
|
|
@@ -50,9 +50,9 @@ export declare function sanitizeHtml(inputStr: string, options?: SanitizeHtmlOpt
|
|
|
50
50
|
* This API must not be used as a security boundary for untrusted HTML.
|
|
51
51
|
* For security-critical sanitization, use a dedicated, security-audited library.
|
|
52
52
|
*
|
|
53
|
-
* @param
|
|
54
|
-
* @param
|
|
55
|
-
* @returns
|
|
53
|
+
* @param element - The DOM element to sanitize.
|
|
54
|
+
* @param [options=defaultOptions] - Sanitization configuration.
|
|
55
|
+
* @returns
|
|
56
56
|
* - A sanitized clone of the original element with allowed attributes and children.
|
|
57
57
|
* - `null` if the element is forbidden or maximum recursion depth is reached.
|
|
58
58
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
1
2
|
import * as Window from '../../misc/crossenv/window/index.js';
|
|
2
3
|
/**
|
|
3
4
|
* Default sanitization options.
|
|
@@ -24,9 +25,9 @@ export const defaultOptions = { depth: 20 };
|
|
|
24
25
|
* This API must not be used as a security boundary for untrusted HTML.
|
|
25
26
|
* For security-critical sanitization, use a dedicated, security-audited library.
|
|
26
27
|
*
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @returns
|
|
28
|
+
* @param inputStr - The HTML string to sanitize.
|
|
29
|
+
* @param [options=defaultOptions] - Sanitization configuration.
|
|
30
|
+
* @returns The sanitized HTML string.
|
|
30
31
|
*
|
|
31
32
|
* @throws Will throw an error if no document object is available for creating elements.
|
|
32
33
|
*/
|
|
@@ -35,6 +36,7 @@ export function sanitizeHtml(inputStr, options = defaultOptions) {
|
|
|
35
36
|
const wrapperDiv = document.createElement('div');
|
|
36
37
|
const { inputFreeTransform } = options;
|
|
37
38
|
wrapperDiv.innerHTML = inputFreeTransform !== undefined ? inputFreeTransform(inputStr) : inputStr;
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
38
40
|
const sanitizedWrapper = sanitizeElement(wrapperDiv, options);
|
|
39
41
|
const returned = sanitizedWrapper?.innerHTML;
|
|
40
42
|
return returned ?? '';
|
|
@@ -58,9 +60,9 @@ export function sanitizeHtml(inputStr, options = defaultOptions) {
|
|
|
58
60
|
* This API must not be used as a security boundary for untrusted HTML.
|
|
59
61
|
* For security-critical sanitization, use a dedicated, security-audited library.
|
|
60
62
|
*
|
|
61
|
-
* @param
|
|
62
|
-
* @param
|
|
63
|
-
* @returns
|
|
63
|
+
* @param element - The DOM element to sanitize.
|
|
64
|
+
* @param [options=defaultOptions] - Sanitization configuration.
|
|
65
|
+
* @returns
|
|
64
66
|
* - A sanitized clone of the original element with allowed attributes and children.
|
|
65
67
|
* - `null` if the element is forbidden or maximum recursion depth is reached.
|
|
66
68
|
*
|
|
@@ -163,6 +165,7 @@ export function sanitizeElement(element, options = defaultOptions) {
|
|
|
163
165
|
// Element's children sanitization
|
|
164
166
|
const sanitizedChildNodes = Array.from(childNodes)
|
|
165
167
|
.map((node) => {
|
|
168
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated, @typescript-eslint/no-unsafe-type-assertion -- nodeType === ELEMENT_NODE just checked above
|
|
166
169
|
if (node.nodeType === Node.ELEMENT_NODE)
|
|
167
170
|
return sanitizeElement(node, { ...options, depth: depth - 1 });
|
|
168
171
|
else if (node.nodeType === Node.TEXT_NODE)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* - Sanitizes each segment using `sanitizeFileName`.
|
|
6
6
|
* - Ensures the returned path starts with a `/`.
|
|
7
7
|
*
|
|
8
|
-
* @param
|
|
9
|
-
* @returns
|
|
8
|
+
* @param targetPath - The path to sanitize.
|
|
9
|
+
* @returns Sanitized absolute path, or null if invalid/empty.
|
|
10
10
|
*/
|
|
11
11
|
export declare function sanitizePath(targetPath: string): string | null;
|
|
@@ -6,8 +6,8 @@ import { sanitizeFileName } from '../file-name/index.js';
|
|
|
6
6
|
* - Sanitizes each segment using `sanitizeFileName`.
|
|
7
7
|
* - Ensures the returned path starts with a `/`.
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
10
|
-
* @returns
|
|
9
|
+
* @param targetPath - The path to sanitize.
|
|
10
|
+
* @returns Sanitized absolute path, or null if invalid/empty.
|
|
11
11
|
*/
|
|
12
12
|
export function sanitizePath(targetPath) {
|
|
13
13
|
const sanitized = targetPath
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-type-assertion -- sanitizeUserInput always returns a value of the same shape as its generic input T, which TS can't verify through the recursive sanitization logic */
|
|
1
2
|
import xss from 'xss';
|
|
2
3
|
/**
|
|
3
4
|
* Recursively sanitizes user input to prevent XSS.
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
* @returns Base-36 encoded character code.
|
|
6
6
|
*/
|
|
7
7
|
export function charCodeToB36(charCode) {
|
|
8
|
-
if (charCode === null)
|
|
9
|
-
return '\x00';
|
|
10
8
|
return charCode.toString(36);
|
|
11
9
|
}
|
|
12
10
|
/**
|
|
@@ -15,8 +13,6 @@ export function charCodeToB36(charCode) {
|
|
|
15
13
|
* @returns Unicode character code.
|
|
16
14
|
*/
|
|
17
15
|
export function b36CharCodeToCharCode(b36CharCode) {
|
|
18
|
-
if (b36CharCode === null)
|
|
19
|
-
return 0;
|
|
20
16
|
const charCode = parseInt(b36CharCode, 36);
|
|
21
17
|
if (!Number.isInteger(charCode))
|
|
22
18
|
return 0;
|
|
@@ -91,7 +87,7 @@ export function toB36CharCodes(string) {
|
|
|
91
87
|
export function fromCharCodes(charCodes) {
|
|
92
88
|
return charCodes
|
|
93
89
|
.map(charFromCharCode)
|
|
94
|
-
.map(char => char
|
|
90
|
+
.map(char => char)
|
|
95
91
|
.join('');
|
|
96
92
|
}
|
|
97
93
|
/**
|
|
@@ -102,7 +98,7 @@ export function fromCharCodes(charCodes) {
|
|
|
102
98
|
export function fromB36CharCodes(b36CharCodes) {
|
|
103
99
|
return b36CharCodes
|
|
104
100
|
.map(charFromB36CharCode)
|
|
105
|
-
.map(char => char
|
|
101
|
+
.map(char => char)
|
|
106
102
|
.join('');
|
|
107
103
|
}
|
|
108
104
|
// Serialization
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * as charCodes from './char-codes/index.js'
|
|
2
2
|
export * as matches from './matches/index.js'
|
|
3
3
|
export * as normalizeIndent from './normalize-indent/index.js'
|
|
4
|
+
export * as parseTable from './parse-table/index.js'
|
|
4
5
|
export * as replaceAll from './replace-all/index.js'
|
|
5
6
|
export * as splitTrim from './split-trim/index.js'
|
|
6
|
-
export * as parseTable from './parse-table/index.js'
|
|
7
7
|
export * as toAlphanum from './to-alphanum/index.js'
|
|
8
8
|
export * as trim from './trim/index.js'
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export * as charCodes from './char-codes/index.js'
|
|
2
2
|
export * as matches from './matches/index.js'
|
|
3
3
|
export * as normalizeIndent from './normalize-indent/index.js'
|
|
4
|
+
export * as parseTable from './parse-table/index.js'
|
|
4
5
|
export * as replaceAll from './replace-all/index.js'
|
|
5
6
|
export * as splitTrim from './split-trim/index.js'
|
|
6
|
-
export * as parseTable from './parse-table/index.js'
|
|
7
7
|
export * as toAlphanum from './to-alphanum/index.js'
|
|
8
8
|
export * as trim from './trim/index.js'
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
export function normalizeIndent(input, indentLevel = 0) {
|
|
24
24
|
const indent = (' ').repeat(indentLevel);
|
|
25
25
|
const lines = input.split('\n');
|
|
26
|
-
const noIndentLines = lines.map(line => line.replace(/^\s*/
|
|
26
|
+
const noIndentLines = lines.map(line => line.replace(/^\s*/igmv, ''));
|
|
27
27
|
const pipeReplacedLines = noIndentLines.map(line => {
|
|
28
|
-
const nbPipeCharsOnLineStart = line.match(/^\|+/
|
|
28
|
+
const nbPipeCharsOnLineStart = line.match(/^\|+/igmv)?.[0].length ?? 0;
|
|
29
29
|
const noPipeLine = line.slice(nbPipeCharsOnLineStart);
|
|
30
30
|
const replacedPipes = (' ').repeat(nbPipeCharsOnLineStart);
|
|
31
31
|
return replacedPipes + noPipeLine;
|
|
@@ -90,24 +90,24 @@ export type ParseTableOptions<T extends Record<string, string>> = ParseTableLine
|
|
|
90
90
|
* 2. **Fixed-width columns** (`mode: 'column'` or when `columns` is provided): Slices text at fixed character positions
|
|
91
91
|
*
|
|
92
92
|
* @template T - The type of objects in the resulting array, extending `Record<string, string>`.
|
|
93
|
-
* @param
|
|
94
|
-
* @param
|
|
95
|
-
* @param
|
|
96
|
-
* @param
|
|
97
|
-
* @param
|
|
98
|
-
* @param
|
|
99
|
-
* @param
|
|
93
|
+
* @param table - The string representation of the table to parse.
|
|
94
|
+
* @param options - Configuration options.
|
|
95
|
+
* @param options.schema - **Required.** Validates and transforms each row. Return `undefined` to skip invalid rows.
|
|
96
|
+
* @param [options.mode] - Parsing mode. If omitted, inferred from presence of `columns` property.
|
|
97
|
+
* @param [options.splitLines] - How to split input into lines.
|
|
98
|
+
* @param [options.headerPos=0] - Index of the header line.
|
|
99
|
+
* @param [options.bodyBounds=[1, Infinity]] - Range of lines to parse as body rows `[start, end)`.
|
|
100
100
|
*
|
|
101
101
|
* **Delimiter-based mode options:**
|
|
102
|
-
* @param
|
|
103
|
-
* @param
|
|
102
|
+
* @param [options.splitHeaderCells] - How to split header line into column names.
|
|
103
|
+
* @param [options.splitBodyCells] - How to split body lines into cell values.
|
|
104
104
|
*
|
|
105
105
|
* **Fixed-width column mode options:**
|
|
106
|
-
* @param
|
|
107
|
-
* @param
|
|
108
|
-
* @param
|
|
106
|
+
* @param [options.columns] - Starting positions for each column.
|
|
107
|
+
* @param [options.headerCellRefine] - Clean/normalize header names.
|
|
108
|
+
* @param [options.bodyCellRefine] - Clean/normalize cell values.
|
|
109
109
|
*
|
|
110
|
-
* @returns
|
|
110
|
+
* @returns
|
|
111
111
|
* - On success: `{ success: true, payload: T[] }` containing parsed rows.
|
|
112
112
|
* - On failure: `{ success: false, payload: string }` containing error message.
|
|
113
113
|
*
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Outcome from '../../misc/outcome/index.js';
|
|
2
|
+
import { isRecord } from '../../objects/is-record/index.js';
|
|
2
3
|
const defaultLineModeOptions = {
|
|
3
4
|
mode: 'line',
|
|
4
5
|
splitLines: i => i.split('\n'),
|
|
@@ -6,7 +7,14 @@ const defaultLineModeOptions = {
|
|
|
6
7
|
splitHeaderCells: h => h.split('\t'),
|
|
7
8
|
bodyBounds: [1, Infinity],
|
|
8
9
|
splitBodyCells: i => i.split('\t'),
|
|
9
|
-
schema: i =>
|
|
10
|
+
schema: i => {
|
|
11
|
+
if (isRecord(i)
|
|
12
|
+
&& Object.values(i).every(v => typeof v === 'string')) {
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
14
|
+
return i;
|
|
15
|
+
}
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
10
18
|
};
|
|
11
19
|
const defaultColumnModeOptions = {
|
|
12
20
|
mode: 'column',
|
|
@@ -16,7 +24,14 @@ const defaultColumnModeOptions = {
|
|
|
16
24
|
columns: [],
|
|
17
25
|
headerCellRefine: h => h,
|
|
18
26
|
bodyCellRefine: v => v,
|
|
19
|
-
schema: i =>
|
|
27
|
+
schema: i => {
|
|
28
|
+
if (isRecord(i)
|
|
29
|
+
&& Object.values(i).every(v => typeof v === 'string')) {
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
31
|
+
return i;
|
|
32
|
+
}
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
20
35
|
};
|
|
21
36
|
/**
|
|
22
37
|
* Parses a tabular string input into an array of typed objects.
|
|
@@ -26,24 +41,24 @@ const defaultColumnModeOptions = {
|
|
|
26
41
|
* 2. **Fixed-width columns** (`mode: 'column'` or when `columns` is provided): Slices text at fixed character positions
|
|
27
42
|
*
|
|
28
43
|
* @template T - The type of objects in the resulting array, extending `Record<string, string>`.
|
|
29
|
-
* @param
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
35
|
-
* @param
|
|
44
|
+
* @param table - The string representation of the table to parse.
|
|
45
|
+
* @param options - Configuration options.
|
|
46
|
+
* @param options.schema - **Required.** Validates and transforms each row. Return `undefined` to skip invalid rows.
|
|
47
|
+
* @param [options.mode] - Parsing mode. If omitted, inferred from presence of `columns` property.
|
|
48
|
+
* @param [options.splitLines] - How to split input into lines.
|
|
49
|
+
* @param [options.headerPos=0] - Index of the header line.
|
|
50
|
+
* @param [options.bodyBounds=[1, Infinity]] - Range of lines to parse as body rows `[start, end)`.
|
|
36
51
|
*
|
|
37
52
|
* **Delimiter-based mode options:**
|
|
38
|
-
* @param
|
|
39
|
-
* @param
|
|
53
|
+
* @param [options.splitHeaderCells] - How to split header line into column names.
|
|
54
|
+
* @param [options.splitBodyCells] - How to split body lines into cell values.
|
|
40
55
|
*
|
|
41
56
|
* **Fixed-width column mode options:**
|
|
42
|
-
* @param
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
57
|
+
* @param [options.columns] - Starting positions for each column.
|
|
58
|
+
* @param [options.headerCellRefine] - Clean/normalize header names.
|
|
59
|
+
* @param [options.bodyCellRefine] - Clean/normalize cell values.
|
|
45
60
|
*
|
|
46
|
-
* @returns
|
|
61
|
+
* @returns
|
|
47
62
|
* - On success: `{ success: true, payload: T[] }` containing parsed rows.
|
|
48
63
|
* - On failure: `{ success: false, payload: string }` containing error message.
|
|
49
64
|
*
|
|
@@ -102,7 +117,7 @@ export function parseTable(table, _options) {
|
|
|
102
117
|
bodyLinesSplit.forEach(lineCells => {
|
|
103
118
|
const row = {};
|
|
104
119
|
const cellCount = Math.min(lineCells.length, headers.length);
|
|
105
|
-
for (let cellPos = 0; cellPos < cellCount; cellPos
|
|
120
|
+
for (let cellPos = 0; cellPos < cellCount; cellPos = cellPos + 1) {
|
|
106
121
|
const cellName = headers[cellPos];
|
|
107
122
|
const cellValue = lineCells[cellPos];
|
|
108
123
|
if (cellName !== undefined
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
* replaceAll('abc 123 abc', /abc/g, match => match.toUpperCase())
|
|
19
19
|
* // => 'ABC 123 ABC'
|
|
20
20
|
*/
|
|
21
|
-
export declare function replaceAll(input: string, pattern: string | RegExp, replacer: string | ((substring: string, ...args:
|
|
21
|
+
export declare function replaceAll(input: string, pattern: string | RegExp, replacer: string | ((substring: string, ...args: unknown[]) => string)): string;
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
* // => 'ABC 123 ABC'
|
|
22
22
|
*/
|
|
23
23
|
export function replaceAll(input, pattern, replacer) {
|
|
24
|
+
// eslint-disable-next-line no-console
|
|
24
25
|
console.warn('[DEPRECATED] Use String.replaceAll instead');
|
|
25
26
|
const found = Array.from(input.match(pattern) ?? []);
|
|
26
27
|
const foundReplaced = typeof replacer === 'string'
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
* // => "Hello-World"
|
|
18
18
|
*/
|
|
19
19
|
export function toAlphanum(string, replacer = '') {
|
|
20
|
-
const replaced = string.replace(/[^a-z0-9]/
|
|
20
|
+
const replaced = string.replace(/[^a-z0-9]/igmv, replacer);
|
|
21
21
|
if (replacer.length === 0)
|
|
22
22
|
return replaced;
|
|
23
|
-
return replaced.replace(new RegExp(`${replacer}+`, '
|
|
23
|
+
return replaced.replace(new RegExp(`${replacer}+`, 'igmv'), replacer);
|
|
24
24
|
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* trimStart(" hello") // => "hello"
|
|
9
9
|
*/
|
|
10
10
|
export function trimStart(string) {
|
|
11
|
-
return string.replace(/^\s
|
|
11
|
+
return string.replace(/^\s*/v, '');
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Removes all trailing whitespace characters from a string.
|
|
@@ -20,5 +20,5 @@ export function trimStart(string) {
|
|
|
20
20
|
* trimEnd("hello ") // => "hello"
|
|
21
21
|
*/
|
|
22
22
|
export function trimEnd(string) {
|
|
23
|
-
return string.replace(/\s
|
|
23
|
+
return string.replace(/\s*$/v, '');
|
|
24
24
|
}
|
|
@@ -52,6 +52,7 @@ export function formatDate(date, format, locale = 'en') {
|
|
|
52
52
|
if (Intl
|
|
53
53
|
.DateTimeFormat
|
|
54
54
|
.supportedLocalesOf(locale).length === 0) {
|
|
55
|
+
// eslint-disable-next-line no-param-reassign
|
|
55
56
|
locale = 'en';
|
|
56
57
|
}
|
|
57
58
|
const day = date.getDate();
|
|
@@ -109,7 +110,8 @@ export function formatDate(date, format, locale = 'en') {
|
|
|
109
110
|
return '';
|
|
110
111
|
}
|
|
111
112
|
};
|
|
112
|
-
const regexp =
|
|
113
|
+
const regexp = /\{\{(DD|D|dd|d|MM|M|MMMM|MMM|YYYY|YY|HH|H|hh|h|mm|m|ss|s|A|a|th|ms)\}\}/gv;
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
113
115
|
return format.replace(regexp, (match, token) => replacements[token]?.() ?? match);
|
|
114
116
|
}
|
|
115
117
|
// [WIP] this was removed since JavaScript's Date object don't hold timezone data
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FrenchRepublicanDate } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a `Date` to the French Republican calendar.
|
|
4
|
+
*
|
|
5
|
+
* @param date - The date to convert.
|
|
6
|
+
* @returns The equivalent {@link FrenchRepublicanDate}.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* The date's local calendar day (`getFullYear` / `getMonth` / `getDate`) is
|
|
10
|
+
* used as the Gregorian date, so the result reflects the runtime's local
|
|
11
|
+
* timezone. Build the `Date` in the timezone you care about if this matters.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* toFrenchRepublican(new Date(1799, 10, 9)).formatted // => '18 Brumaire an VIII'
|
|
15
|
+
*/
|
|
16
|
+
export declare function toFrenchRepublican(date: Date): FrenchRepublicanDate;
|