@design-edito/tools 0.4.23 → 0.5.1
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/index.d.ts +1 -1
- package/agnostic/arrays/index.js +1 -1
- 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 +2 -2
- package/agnostic/css/index.js +2 -2
- 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 +12 -12
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +12 -12
- 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/index.d.ts +3 -3
- package/agnostic/index.js +3 -3
- 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 +3 -3
- package/agnostic/misc/index.js +3 -3
- 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 +3 -3
- package/agnostic/numbers/index.js +3 -3
- 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 +4 -4
- package/agnostic/objects/index.js +4 -4
- 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/index.d.ts +1 -1
- package/agnostic/random/index.js +1 -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 +3 -3
- package/agnostic/strings/index.js +3 -3
- 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 +5 -5
- package/components/index.js +5 -5
- 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 +2 -2
- package/node/@google-cloud/storage/directory/index.js +2 -2
- 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 +3 -3
- package/node/@google-cloud/storage/file/index.js +3 -3
- 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/@google-cloud/storage/index.d.ts +1 -1
- package/node/@google-cloud/storage/index.js +1 -1
- 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/index.d.ts +2 -2
- package/node/cloud-storage/operations/index.js +2 -2
- 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/get-size/index.d.ts +56 -0
- package/node/files/get-size/index.js +167 -0
- package/node/files/get-size/index.test.d.ts +1 -0
- package/node/files/get-size/index.test.js +143 -0
- package/node/files/index.d.ts +1 -0
- package/node/files/index.js +1 -0
- 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/index.d.ts +1 -1
- package/node/ftps/directory/index.js +1 -1
- 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/index.d.ts +2 -2
- package/node/ftps/file/index.js +2 -2
- 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/index.d.ts +1 -1
- package/node/images/index.js +1 -1
- 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/index.d.ts +2 -2
- package/node/index.js +2 -2
- 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/index.d.ts +1 -1
- package/node/sftp/directory/index.js +1 -1
- 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 +2 -2
- package/node/sftp/file/index.js +2 -2
- 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 +47 -39
|
@@ -6,8 +6,8 @@ import { isFalsy } from '../../booleans/is-falsy/index.js';
|
|
|
6
6
|
* - Strings equal to `"true"` (case-insensitive, trimmed) are `true`, others `false`.
|
|
7
7
|
* - Other values are coerced using `!isFalsy`.
|
|
8
8
|
*
|
|
9
|
-
* @param
|
|
10
|
-
* @returns
|
|
9
|
+
* @param value - The value to convert.
|
|
10
|
+
* @returns The boolean representation of the input.
|
|
11
11
|
*/
|
|
12
12
|
export function toBoolean(value) {
|
|
13
13
|
if (typeof value === 'boolean')
|
|
@@ -26,8 +26,8 @@ export function toBoolean(value) {
|
|
|
26
26
|
* - Strings are parsed as floats.
|
|
27
27
|
* - Other values return 0.
|
|
28
28
|
*
|
|
29
|
-
* @param
|
|
30
|
-
* @returns
|
|
29
|
+
* @param value - The value to convert.
|
|
30
|
+
* @returns The numeric representation of the input.
|
|
31
31
|
*/
|
|
32
32
|
export function toNumber(value) {
|
|
33
33
|
if (typeof value === 'number')
|
|
@@ -42,8 +42,8 @@ export function toNumber(value) {
|
|
|
42
42
|
* - Strings are returned as-is.
|
|
43
43
|
* - Other values are converted using `String()`.
|
|
44
44
|
*
|
|
45
|
-
* @param
|
|
46
|
-
* @returns
|
|
45
|
+
* @param value - The value to convert.
|
|
46
|
+
* @returns The string representation of the input.
|
|
47
47
|
*/
|
|
48
48
|
export function toString(value) {
|
|
49
49
|
if (typeof value === 'string')
|
|
@@ -53,8 +53,8 @@ export function toString(value) {
|
|
|
53
53
|
/**
|
|
54
54
|
* Converts any value to `null`.
|
|
55
55
|
*
|
|
56
|
-
* @param
|
|
57
|
-
* @returns
|
|
56
|
+
* @param _value - The input value (ignored).
|
|
57
|
+
* @returns Always returns `null`.
|
|
58
58
|
*/
|
|
59
59
|
export function toNull(_value) {
|
|
60
60
|
return null;
|
|
@@ -66,8 +66,8 @@ export function toNull(_value) {
|
|
|
66
66
|
* - Objects are converted to an array of `[key, value]` pairs.
|
|
67
67
|
* - Other values are wrapped in a single-element array.
|
|
68
68
|
*
|
|
69
|
-
* @param
|
|
70
|
-
* @returns
|
|
69
|
+
* @param value - The value to convert.
|
|
70
|
+
* @returns The array representation of the input.
|
|
71
71
|
*/
|
|
72
72
|
export function toArray(value) {
|
|
73
73
|
if (Array.isArray(value))
|
|
@@ -83,8 +83,8 @@ export function toArray(value) {
|
|
|
83
83
|
* - Uses `toArray` to ensure an array.
|
|
84
84
|
* - Each element is converted to a number using `toNumber`.
|
|
85
85
|
*
|
|
86
|
-
* @param
|
|
87
|
-
* @returns
|
|
86
|
+
* @param value - The value to convert.
|
|
87
|
+
* @returns Array of numeric values.
|
|
88
88
|
*/
|
|
89
89
|
export function toNumberArr(value) {
|
|
90
90
|
const arrValue = toArray(value);
|
|
@@ -96,16 +96,16 @@ export function toNumberArr(value) {
|
|
|
96
96
|
* - Keys and values of objects are copied.
|
|
97
97
|
* - Non-object values return an empty object.
|
|
98
98
|
*
|
|
99
|
-
* @param
|
|
100
|
-
* @returns
|
|
99
|
+
* @param value - The value to convert.
|
|
100
|
+
* @returns The object representation of the input.
|
|
101
101
|
*/
|
|
102
102
|
export function toRecord(value) {
|
|
103
103
|
const record = {};
|
|
104
104
|
try {
|
|
105
105
|
Object
|
|
106
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- no runtime guard here; safety comes from the surrounding try/catch below
|
|
107
107
|
.keys(value)
|
|
108
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- no runtime guard here; safety comes from the surrounding try/catch below
|
|
109
109
|
.forEach(key => { record[key] = value[key]; });
|
|
110
110
|
}
|
|
111
111
|
catch (err) {
|
|
@@ -120,8 +120,8 @@ export function toRecord(value) {
|
|
|
120
120
|
* - Strings are used as the error message.
|
|
121
121
|
* - Other values are converted to string and used as the error message.
|
|
122
122
|
*
|
|
123
|
-
* @param
|
|
124
|
-
* @returns
|
|
123
|
+
* @param value - The value to convert.
|
|
124
|
+
* @returns An `Error` instance representing the input.
|
|
125
125
|
*/
|
|
126
126
|
export function toError(value) {
|
|
127
127
|
if (value instanceof Error)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Represents a minimal network connection object.
|
|
3
3
|
*
|
|
4
|
-
* @property
|
|
5
|
-
* @property
|
|
6
|
-
* @property
|
|
4
|
+
* @property downlink - Estimated downlink speed in Mbps.
|
|
5
|
+
* @property type - Connection type.
|
|
6
|
+
* @property effectiveType - Effective connection type.
|
|
7
7
|
*/
|
|
8
8
|
export type MinimalConnection = {
|
|
9
9
|
downlink: number;
|
|
@@ -15,12 +15,12 @@ export type MinimalConnection = {
|
|
|
15
15
|
*
|
|
16
16
|
* Uses the `navigator.connection` API or vendor-prefixed alternatives.
|
|
17
17
|
*
|
|
18
|
-
* @returns
|
|
18
|
+
* @returns A minimal connection object if available, otherwise `undefined`.
|
|
19
19
|
*/
|
|
20
20
|
export declare function getConnection(): MinimalConnection | undefined;
|
|
21
21
|
/**
|
|
22
22
|
* Retrieves the estimated downlink speed of the current network connection.
|
|
23
23
|
*
|
|
24
|
-
* @returns
|
|
24
|
+
* @returns Downlink speed in Mbps, or `undefined` if not available.
|
|
25
25
|
*/
|
|
26
26
|
export declare function getCurrentDownlink(): number | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */
|
|
1
2
|
import * as Window from '../crossenv/window/index.js';
|
|
2
3
|
function isType(unk) {
|
|
3
4
|
return unk === 'bluetooth'
|
|
@@ -39,10 +40,11 @@ function isConnection(unk) {
|
|
|
39
40
|
*
|
|
40
41
|
* Uses the `navigator.connection` API or vendor-prefixed alternatives.
|
|
41
42
|
*
|
|
42
|
-
* @returns
|
|
43
|
+
* @returns A minimal connection object if available, otherwise `undefined`.
|
|
43
44
|
*/
|
|
44
45
|
export function getConnection() {
|
|
45
46
|
const window = Window.get();
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-type-assertion -- MinimalWindow deliberately doesn't declare `navigator`; this is browser-only feature detection, guarded by the typeof/null check below
|
|
46
48
|
const navigator = window.navigator;
|
|
47
49
|
if (typeof navigator !== 'object' || navigator === null)
|
|
48
50
|
return undefined;
|
|
@@ -56,7 +58,7 @@ export function getConnection() {
|
|
|
56
58
|
/**
|
|
57
59
|
* Retrieves the estimated downlink speed of the current network connection.
|
|
58
60
|
*
|
|
59
|
-
* @returns
|
|
61
|
+
* @returns Downlink speed in Mbps, or `undefined` if not available.
|
|
60
62
|
*/
|
|
61
63
|
export function getCurrentDownlink() {
|
|
62
64
|
return getConnection()?.downlink;
|
|
@@ -2,29 +2,29 @@
|
|
|
2
2
|
* Function that fetches content from a URL asynchronously.
|
|
3
3
|
*
|
|
4
4
|
* @template T - The type of content returned by the fetcher.
|
|
5
|
-
* @param
|
|
6
|
-
* @returns
|
|
5
|
+
* @param url - The URL to fetch.
|
|
6
|
+
* @returns A promise resolving to the fetched content.
|
|
7
7
|
*/
|
|
8
8
|
export type Fetcher<T> = (url: string) => Promise<T>;
|
|
9
9
|
/**
|
|
10
10
|
* Function that processes fetched content for a given URL.
|
|
11
11
|
*
|
|
12
12
|
* @template T - The type of content provided by the fetcher.
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @param
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @returns
|
|
13
|
+
* @param url - The URL of the content being processed.
|
|
14
|
+
* @param content - The content fetched from the URL.
|
|
15
|
+
* @param hooks - Hooks for accessing crawler state and controlling the crawl.
|
|
16
|
+
* @param hooks.push - Enqueue one or more URLs to be crawled.
|
|
17
|
+
* @param hooks.flush - Clear the waitlist of pending URLs.
|
|
18
|
+
* @param hooks.processed - Read-only snapshot of URLs already processed.
|
|
19
|
+
* @param hooks.waitlist - Read-only snapshot of the current waitlist of URLs.
|
|
20
|
+
* @returns The result of processing (ignored by the crawler).
|
|
21
21
|
*/
|
|
22
22
|
export type Processor<T> = (url: string, content: T, hooks: {
|
|
23
23
|
push: (...urls: string[]) => void;
|
|
24
24
|
flush: () => void;
|
|
25
25
|
processed: Set<string>;
|
|
26
26
|
waitlist: string[];
|
|
27
|
-
}) =>
|
|
27
|
+
}) => unknown;
|
|
28
28
|
/**
|
|
29
29
|
* Configuration options for the crawler.
|
|
30
30
|
*
|
|
@@ -61,13 +61,13 @@ export type Crawler = {
|
|
|
61
61
|
* Creates a sequential crawler with optional delay.
|
|
62
62
|
*
|
|
63
63
|
* @template T - The type of content returned by the fetcher.
|
|
64
|
-
* @param
|
|
65
|
-
* @param
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
68
|
-
* @param
|
|
69
|
-
* @param
|
|
70
|
-
* @returns
|
|
64
|
+
* @param options - Crawler configuration options.
|
|
65
|
+
* @param options.limit - Maximum number of URLs to process.
|
|
66
|
+
* @param [options.delayMs] - Optional delay between processing URLs, in milliseconds, or a function returning the delay.
|
|
67
|
+
* @param [options.allowDuplicates] - Optional, allows fetching and processing a URL that has already been seen.
|
|
68
|
+
* @param options.fetcher - Function that fetches content for each URL.
|
|
69
|
+
* @param options.processor - Function that processes fetched content.
|
|
70
|
+
* @returns An object with methods to start crawling, enqueue URLs, flush the waitlist, and access crawler state.
|
|
71
71
|
*
|
|
72
72
|
* @example
|
|
73
73
|
* ```typescript
|
|
@@ -3,13 +3,13 @@ import { wait } from '../../time/wait/index.js';
|
|
|
3
3
|
* Creates a sequential crawler with optional delay.
|
|
4
4
|
*
|
|
5
5
|
* @template T - The type of content returned by the fetcher.
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @returns
|
|
6
|
+
* @param options - Crawler configuration options.
|
|
7
|
+
* @param options.limit - Maximum number of URLs to process.
|
|
8
|
+
* @param [options.delayMs] - Optional delay between processing URLs, in milliseconds, or a function returning the delay.
|
|
9
|
+
* @param [options.allowDuplicates] - Optional, allows fetching and processing a URL that has already been seen.
|
|
10
|
+
* @param options.fetcher - Function that fetches content for each URL.
|
|
11
|
+
* @param options.processor - Function that processes fetched content.
|
|
12
|
+
* @returns An object with methods to start crawling, enqueue URLs, flush the waitlist, and access crawler state.
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```typescript
|
|
@@ -31,13 +31,14 @@ import { wait } from '../../time/wait/index.js';
|
|
|
31
31
|
export function create(options) {
|
|
32
32
|
let ops = 0;
|
|
33
33
|
const waitlist = [];
|
|
34
|
-
const push = (...urls) => waitlist.push(...urls);
|
|
34
|
+
const push = (...urls) => { waitlist.push(...urls); };
|
|
35
35
|
const flush = () => { waitlist.length = 0; };
|
|
36
36
|
const processed = new Set();
|
|
37
37
|
const crawl = async (startUrl) => {
|
|
38
38
|
push(startUrl);
|
|
39
39
|
while (waitlist.length > 0 && ops < options.limit) {
|
|
40
|
-
ops
|
|
40
|
+
ops = ops + 1;
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- waitlist.length > 0 is guaranteed by the while condition above
|
|
41
42
|
const currentUrl = waitlist[0];
|
|
42
43
|
if (!processed.has(currentUrl) || options.allowDuplicates === true) {
|
|
43
44
|
const content = await options.fetcher(currentUrl);
|
|
@@ -5,7 +5,7 @@ describe('create', () => {
|
|
|
5
5
|
const crawler = create({
|
|
6
6
|
limit: 10,
|
|
7
7
|
fetcher: async () => 'content',
|
|
8
|
-
processor: async () =>
|
|
8
|
+
processor: async () => undefined
|
|
9
9
|
});
|
|
10
10
|
expect(crawler).toHaveProperty('crawl');
|
|
11
11
|
expect(crawler).toHaveProperty('push');
|
|
@@ -36,7 +36,7 @@ describe('create', () => {
|
|
|
36
36
|
});
|
|
37
37
|
it('respects delay when provided', async () => {
|
|
38
38
|
const fetcher = vi.fn(async (url) => `content-${url}`);
|
|
39
|
-
const processor = vi.fn(async () =>
|
|
39
|
+
const processor = vi.fn(async () => undefined);
|
|
40
40
|
const startTime = Date.now();
|
|
41
41
|
const crawler = create({ limit: 2, delayMs: 20, fetcher, processor });
|
|
42
42
|
await crawler.crawl('url1');
|
|
@@ -5,7 +5,7 @@ import { RuntimeName } from '../types.js';
|
|
|
5
5
|
* Checks for Node.js, Browser, Deno, React Native, Electron,
|
|
6
6
|
* Cloudflare Workers, and AWS Lambda.
|
|
7
7
|
*
|
|
8
|
-
* @returns
|
|
8
|
+
* @returns
|
|
9
9
|
* - The detected runtime as a `RuntimeName` enum value.
|
|
10
10
|
* - `null` if the runtime cannot be determined.
|
|
11
11
|
*/
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-condition */
|
|
1
2
|
import { RuntimeName } from '../types.js';
|
|
2
3
|
/**
|
|
3
4
|
* Detects the current JavaScript runtime environment.
|
|
@@ -5,37 +6,35 @@ import { RuntimeName } from '../types.js';
|
|
|
5
6
|
* Checks for Node.js, Browser, Deno, React Native, Electron,
|
|
6
7
|
* Cloudflare Workers, and AWS Lambda.
|
|
7
8
|
*
|
|
8
|
-
* @returns
|
|
9
|
+
* @returns
|
|
9
10
|
* - The detected runtime as a `RuntimeName` enum value.
|
|
10
11
|
* - `null` if the runtime cannot be determined.
|
|
11
12
|
*/
|
|
12
13
|
export function detectRuntime() {
|
|
13
14
|
/* Node.js */
|
|
14
|
-
if (
|
|
15
|
+
if (process?.versions?.node !== undefined)
|
|
15
16
|
return RuntimeName.NODE;
|
|
16
17
|
/* Browser */
|
|
17
|
-
if (
|
|
18
|
+
if (window?.document !== undefined)
|
|
18
19
|
return RuntimeName.BROWSER;
|
|
19
20
|
/* Deno */
|
|
20
|
-
if (
|
|
21
|
+
if (Deno !== undefined)
|
|
21
22
|
return RuntimeName.DENO;
|
|
22
23
|
/* React Native */
|
|
23
|
-
if (
|
|
24
|
+
if (process !== undefined
|
|
24
25
|
&& typeof navigator.userAgent === 'string'
|
|
25
26
|
&& navigator.userAgent.includes('ReactNative'))
|
|
26
27
|
return RuntimeName.REACT_NATIVE;
|
|
27
28
|
/* Electron */
|
|
28
|
-
if (
|
|
29
|
-
&& typeof process.version.electron !== 'undefined')
|
|
29
|
+
if (process?.versions?.electron !== undefined)
|
|
30
30
|
return RuntimeName.ELECTRON;
|
|
31
31
|
/* Cloudflare Workers */
|
|
32
|
-
if (
|
|
32
|
+
if (self !== undefined
|
|
33
33
|
&& typeof self.addEventListener === 'function'
|
|
34
|
-
&&
|
|
34
|
+
&& Headers !== undefined)
|
|
35
35
|
return RuntimeName.CLOUDFLARE;
|
|
36
36
|
/* AWS Lambda */
|
|
37
|
-
if (
|
|
38
|
-
&& typeof AWS.Lambda !== 'undefined')
|
|
37
|
+
if (AWS !== undefined)
|
|
39
38
|
return RuntimeName.AWS_LAMBDA;
|
|
40
39
|
/* Other */
|
|
41
40
|
return null;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { MinimalWindow } from '../types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Checks whether a `window` object exists in the current environment.
|
|
4
4
|
*
|
|
5
|
-
* @returns
|
|
5
|
+
* @returns `true` if `window` is present, `false` otherwise.
|
|
6
6
|
*/
|
|
7
7
|
export declare function exists(): boolean;
|
|
8
8
|
/**
|
|
9
9
|
* Sets a custom `window` object to be used internally.
|
|
10
10
|
*
|
|
11
|
-
* @param
|
|
12
|
-
* @returns
|
|
11
|
+
* @param customWindow - The window object to set, or `null` to unset.
|
|
12
|
+
* @returns The window object that was set.
|
|
13
13
|
*/
|
|
14
14
|
export declare function set(customWindow: MinimalWindow | null): MinimalWindow | null;
|
|
15
15
|
/**
|
|
16
16
|
* Resets the internal window reference to the global `window` if it exists,
|
|
17
17
|
* or `null` if no global `window` is available.
|
|
18
18
|
*
|
|
19
|
-
* @returns
|
|
19
|
+
* @returns The current internal window object after reset.
|
|
20
20
|
*/
|
|
21
21
|
export declare function unset(): MinimalWindow | null;
|
|
22
22
|
/**
|
|
23
23
|
* Retrieves the currently set `window` object.
|
|
24
24
|
*
|
|
25
|
-
* @returns
|
|
25
|
+
* @returns The internal window object.
|
|
26
26
|
* @throws Will throw an error if no window has been set and none exists globally.
|
|
27
27
|
*/
|
|
28
28
|
export declare function get(): MinimalWindow;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Checks whether a `window` object exists in the current environment.
|
|
3
3
|
*
|
|
4
|
-
* @returns
|
|
4
|
+
* @returns `true` if `window` is present, `false` otherwise.
|
|
5
5
|
*/
|
|
6
6
|
export function exists() {
|
|
7
7
|
return typeof globalThis !== 'undefined'
|
|
8
8
|
&& 'window' in globalThis;
|
|
9
9
|
}
|
|
10
10
|
let _window = exists()
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
11
12
|
? (globalThis.window ?? null)
|
|
12
13
|
: null;
|
|
13
14
|
/**
|
|
14
15
|
* Sets a custom `window` object to be used internally.
|
|
15
16
|
*
|
|
16
|
-
* @param
|
|
17
|
-
* @returns
|
|
17
|
+
* @param customWindow - The window object to set, or `null` to unset.
|
|
18
|
+
* @returns The window object that was set.
|
|
18
19
|
*/
|
|
19
20
|
export function set(customWindow) {
|
|
20
21
|
_window = customWindow;
|
|
@@ -24,7 +25,7 @@ export function set(customWindow) {
|
|
|
24
25
|
* Resets the internal window reference to the global `window` if it exists,
|
|
25
26
|
* or `null` if no global `window` is available.
|
|
26
27
|
*
|
|
27
|
-
* @returns
|
|
28
|
+
* @returns The current internal window object after reset.
|
|
28
29
|
*/
|
|
29
30
|
export function unset() {
|
|
30
31
|
if (exists()) {
|
|
@@ -38,7 +39,7 @@ export function unset() {
|
|
|
38
39
|
/**
|
|
39
40
|
* Retrieves the currently set `window` object.
|
|
40
41
|
*
|
|
41
|
-
* @returns
|
|
42
|
+
* @returns The internal window object.
|
|
42
43
|
* @throws Will throw an error if no window has been set and none exists globally.
|
|
43
44
|
*/
|
|
44
45
|
export function get() {
|
|
@@ -42,6 +42,7 @@ export class DataSize {
|
|
|
42
42
|
else if (unit === 'PiB' || unit === 'pebibyte') {
|
|
43
43
|
this.unit = 'pebibyte';
|
|
44
44
|
}
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
45
46
|
else if (unit === 'EiB' || unit === 'exbibyte') {
|
|
46
47
|
this.unit = 'exbibyte';
|
|
47
48
|
}
|
|
@@ -90,6 +91,7 @@ export class DataSize {
|
|
|
90
91
|
return this.value * 8 * Math.pow(1024, 4);
|
|
91
92
|
if (this.unit === 'pebibyte')
|
|
92
93
|
return this.value * 8 * Math.pow(1024, 5);
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
93
95
|
if (this.unit === 'exbibyte')
|
|
94
96
|
return this.value * 8 * Math.pow(1024, 6);
|
|
95
97
|
return this.value; // defaults to bits
|
package/agnostic/misc/index.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ export * as connection from './connection/index.js'
|
|
|
4
4
|
export * as crawler from './crawler/index.js'
|
|
5
5
|
export * as crossenv from './crossenv/index.js'
|
|
6
6
|
export * as dataSize from './data-size/index.js'
|
|
7
|
-
export * as isNullish from './is-nullish/index.js'
|
|
8
7
|
export * as isConstructorFunction from './is-constructor-function/index.js'
|
|
9
|
-
export * as
|
|
10
|
-
export * as normalizeExtension from './normalize-extension/index.js'
|
|
8
|
+
export * as isNullish from './is-nullish/index.js'
|
|
11
9
|
export * as outcome from './outcome/index.js'
|
|
12
10
|
export * as logs from './logs/index.js'
|
|
11
|
+
export * as loremIpsum from './lorem-ipsum/index.js'
|
|
12
|
+
export * as normalizeExtension from './normalize-extension/index.js'
|
package/agnostic/misc/index.js
CHANGED
|
@@ -4,9 +4,9 @@ export * as connection from './connection/index.js'
|
|
|
4
4
|
export * as crawler from './crawler/index.js'
|
|
5
5
|
export * as crossenv from './crossenv/index.js'
|
|
6
6
|
export * as dataSize from './data-size/index.js'
|
|
7
|
-
export * as isNullish from './is-nullish/index.js'
|
|
8
7
|
export * as isConstructorFunction from './is-constructor-function/index.js'
|
|
9
|
-
export * as
|
|
10
|
-
export * as normalizeExtension from './normalize-extension/index.js'
|
|
8
|
+
export * as isNullish from './is-nullish/index.js'
|
|
11
9
|
export * as outcome from './outcome/index.js'
|
|
12
10
|
export * as logs from './logs/index.js'
|
|
11
|
+
export * as loremIpsum from './lorem-ipsum/index.js'
|
|
12
|
+
export * as normalizeExtension from './normalize-extension/index.js'
|
|
@@ -7,7 +7,7 @@ export type ConstructorFunction<T = any> = new (...args: any[]) => T;
|
|
|
7
7
|
/**
|
|
8
8
|
* Checks whether a given value is a constructor function (i.e., a class or function with a prototype).
|
|
9
9
|
*
|
|
10
|
-
* @param
|
|
11
|
-
* @returns
|
|
10
|
+
* @param input - The value to check.
|
|
11
|
+
* @returns `true` if the input is a constructor function, otherwise `false`.
|
|
12
12
|
*/
|
|
13
13
|
export declare function isConstructorFunction(input: unknown): input is ConstructorFunction;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access */
|
|
1
2
|
/**
|
|
2
3
|
* Checks whether a given value is a constructor function (i.e., a class or function with a prototype).
|
|
3
4
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @returns
|
|
5
|
+
* @param input - The value to check.
|
|
6
|
+
* @returns `true` if the input is a constructor function, otherwise `false`.
|
|
6
7
|
*/
|
|
7
8
|
export function isConstructorFunction(input) {
|
|
8
9
|
return typeof input === 'function'
|
|
@@ -14,11 +14,11 @@ describe('isConstructorFunction', () => {
|
|
|
14
14
|
expect(isConstructorFunction(MyClass)).toBe(true);
|
|
15
15
|
});
|
|
16
16
|
it('returns true for regular functions', () => {
|
|
17
|
-
function
|
|
17
|
+
const regularFunction = function () { return undefined; };
|
|
18
18
|
expect(isConstructorFunction(regularFunction)).toBe(true);
|
|
19
19
|
});
|
|
20
20
|
it('returns false for arrow functions', () => {
|
|
21
|
-
const arrowFunction = () =>
|
|
21
|
+
const arrowFunction = () => undefined;
|
|
22
22
|
expect(isConstructorFunction(arrowFunction)).toBe(false);
|
|
23
23
|
});
|
|
24
24
|
it('returns false for non-functions', () => {
|
|
@@ -12,15 +12,15 @@ export type Nullish = null | undefined;
|
|
|
12
12
|
* Checks whether a value is nullish (`null` or `undefined`).
|
|
13
13
|
*
|
|
14
14
|
* @template T
|
|
15
|
-
* @param
|
|
16
|
-
* @returns
|
|
15
|
+
* @param val - The value to check.
|
|
16
|
+
* @returns `true` if the value is nullish, otherwise `false`.
|
|
17
17
|
*/
|
|
18
|
-
export declare function isNullish
|
|
18
|
+
export declare function isNullish(val: unknown): val is Nullish;
|
|
19
19
|
/**
|
|
20
20
|
* Checks whether a value is not nullish (`null` or `undefined`).
|
|
21
21
|
*
|
|
22
22
|
* @template T
|
|
23
|
-
* @param
|
|
24
|
-
* @returns
|
|
23
|
+
* @param val - The value to check.
|
|
24
|
+
* @returns `true` if the value is not nullish, otherwise `false`.
|
|
25
25
|
*/
|
|
26
26
|
export declare function isNotNullish<T>(val: T): val is Exclude<T, Nullish>;
|
|
@@ -8,18 +8,19 @@ export const nullishValues = [null, undefined];
|
|
|
8
8
|
* Checks whether a value is nullish (`null` or `undefined`).
|
|
9
9
|
*
|
|
10
10
|
* @template T
|
|
11
|
-
* @param
|
|
12
|
-
* @returns
|
|
11
|
+
* @param val - The value to check.
|
|
12
|
+
* @returns `true` if the value is nullish, otherwise `false`.
|
|
13
13
|
*/
|
|
14
14
|
export function isNullish(val) {
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Array.includes() does a strict equality check regardless of this cast; safe for any T
|
|
15
16
|
return nullishValues.includes(val);
|
|
16
17
|
}
|
|
17
18
|
/**
|
|
18
19
|
* Checks whether a value is not nullish (`null` or `undefined`).
|
|
19
20
|
*
|
|
20
21
|
* @template T
|
|
21
|
-
* @param
|
|
22
|
-
* @returns
|
|
22
|
+
* @param val - The value to check.
|
|
23
|
+
* @returns `true` if the value is not nullish, otherwise `false`.
|
|
23
24
|
*/
|
|
24
25
|
export function isNotNullish(val) {
|
|
25
26
|
return !isNullish(val);
|
|
@@ -12,7 +12,7 @@ class Log {
|
|
|
12
12
|
this.stack = (new Error().stack ?? '');
|
|
13
13
|
}
|
|
14
14
|
get displayTime() {
|
|
15
|
-
return this.time.toLocaleDateString('en-US', {
|
|
15
|
+
return `${this.time.toLocaleDateString('en-US', {
|
|
16
16
|
year: 'numeric',
|
|
17
17
|
month: 'short',
|
|
18
18
|
day: 'numeric',
|
|
@@ -20,7 +20,7 @@ class Log {
|
|
|
20
20
|
hour: 'numeric',
|
|
21
21
|
minute: 'numeric',
|
|
22
22
|
second: 'numeric'
|
|
23
|
-
})
|
|
23
|
+
})}:${this.time.getMilliseconds()}`;
|
|
24
24
|
}
|
|
25
25
|
get elapsedTimeMs() {
|
|
26
26
|
return (this.time.getTime() - logsTimeOrigin.getTime()) / 1000;
|
|
@@ -26,7 +26,7 @@ export const words = [
|
|
|
26
26
|
export const generateSentence = (wordCount) => {
|
|
27
27
|
const resultArr = [];
|
|
28
28
|
let currentWordCound = wordCount;
|
|
29
|
-
for (let i = 0; i < currentWordCound; i
|
|
29
|
+
for (let i = 0; i < currentWordCound; i = i + 1) {
|
|
30
30
|
const picked = randomPick(words);
|
|
31
31
|
if (typeof picked === 'string')
|
|
32
32
|
resultArr.push(picked);
|
|
@@ -37,8 +37,8 @@ export const generateSentence = (wordCount) => {
|
|
|
37
37
|
const [firstWord, ...otherWords] = resultArr;
|
|
38
38
|
if (firstWord === undefined)
|
|
39
39
|
return '';
|
|
40
|
-
const capFirstLetter = firstWord
|
|
41
|
-
const restOfFirstWord = firstWord
|
|
40
|
+
const capFirstLetter = firstWord.charAt(0).toUpperCase();
|
|
41
|
+
const restOfFirstWord = firstWord.slice(1);
|
|
42
42
|
const sentence = [
|
|
43
43
|
`${capFirstLetter}${restOfFirstWord}`,
|
|
44
44
|
...otherWords
|
|
@@ -47,7 +47,7 @@ export const generateSentence = (wordCount) => {
|
|
|
47
47
|
};
|
|
48
48
|
export const generateSentences = (sentencesCount, maxSentenceLength = 12, minSentenceLength = 4) => {
|
|
49
49
|
const sentences = [];
|
|
50
|
-
for (let i = 0; i < sentencesCount; i
|
|
50
|
+
for (let i = 0; i < sentencesCount; i = i + 1) {
|
|
51
51
|
const length = randomInt(maxSentenceLength, minSentenceLength) ?? 8;
|
|
52
52
|
sentences.push(generateSentence(length));
|
|
53
53
|
}
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Converts the extension to lowercase, removes a leading dot if present,
|
|
5
5
|
* and applies alias mapping if defined.
|
|
6
6
|
*
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @returns
|
|
7
|
+
* @param extWithoutDot - File extension to normalize (may include or omit leading dot).
|
|
8
|
+
* @param [aliasesWithoutDot=defaultAliases] - Optional mapping of aliases to canonical extensions.
|
|
9
|
+
* @returns The normalized file extension, without leading dot.
|
|
10
10
|
*/
|
|
11
11
|
export declare function normalizeExtension(extWithoutDot: string, aliasesWithoutDot?: Record<string, string>): string;
|
|
@@ -91,11 +91,11 @@ const defaultAliases = {
|
|
|
91
91
|
* Converts the extension to lowercase, removes a leading dot if present,
|
|
92
92
|
* and applies alias mapping if defined.
|
|
93
93
|
*
|
|
94
|
-
* @param
|
|
95
|
-
* @param
|
|
96
|
-
* @returns
|
|
94
|
+
* @param extWithoutDot - File extension to normalize (may include or omit leading dot).
|
|
95
|
+
* @param [aliasesWithoutDot=defaultAliases] - Optional mapping of aliases to canonical extensions.
|
|
96
|
+
* @returns The normalized file extension, without leading dot.
|
|
97
97
|
*/
|
|
98
98
|
export function normalizeExtension(extWithoutDot, aliasesWithoutDot = defaultAliases) {
|
|
99
|
-
const cleaned = extWithoutDot.toLowerCase().replace(
|
|
99
|
+
const cleaned = extWithoutDot.toLowerCase().replace(/^\./v, '');
|
|
100
100
|
return aliasesWithoutDot[cleaned] ?? cleaned;
|
|
101
101
|
}
|