@design-edito/tools 0.3.9 → 0.3.10
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/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 +2 -2
- package/agnostic/booleans/is-falsy/index.d.ts +1 -1
- package/agnostic/colors/channels/index.d.ts +1 -1
- package/agnostic/colors/contrast/index.d.ts +1 -1
- package/agnostic/colors/convert/index.d.ts +1 -1
- package/agnostic/colors/convert/index.js +14 -17
- package/agnostic/colors/cssColorsMap.d.ts +9 -0
- package/agnostic/colors/distance/index.d.ts +1 -1
- package/agnostic/colors/index.d.ts +3 -3
- package/agnostic/colors/index.js +3 -3
- package/agnostic/colors/invert/index.d.ts +1 -1
- package/agnostic/colors/luminance/index.d.ts +1 -1
- package/agnostic/colors/palette/index.js +2 -0
- package/agnostic/colors/tidy/index.js +2 -1
- package/agnostic/colors/typechecks/index.d.ts +1 -1
- package/agnostic/colors/typechecks/index.js +1 -3
- package/agnostic/colors/types.d.ts +0 -7
- package/agnostic/colors/types.js +0 -154
- package/agnostic/css/bem/index.d.ts +3 -3
- package/agnostic/css/bem/index.js +6 -5
- package/agnostic/css/clss/index.d.ts +2 -1
- package/agnostic/css/clss/index.js +2 -2
- package/agnostic/css/generate-nice-color/index.js +1 -0
- package/agnostic/css/index.d.ts +2 -2
- package/agnostic/css/index.js +2 -2
- package/agnostic/css/styles-set/index.d.ts +4 -4
- package/agnostic/css/styles-set/index.js +1 -1
- package/agnostic/errors/register/index.js +4 -2
- package/agnostic/html/get-node-ancestors/index.js +1 -1
- package/agnostic/html/get-position-inside-parent/index.js +1 -1
- package/agnostic/html/hyper-json/cast/index.d.ts +1 -1
- 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 +1 -1
- 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/at/index.d.ts +1 -1
- 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 +5 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/equals/index.d.ts +1 -1
- 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 +5 -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/if/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.d.ts +16 -16
- package/agnostic/html/hyper-json/smart-tags/coalesced/index.js +16 -16
- package/agnostic/html/hyper-json/smart-tags/coalesced/initialize/index.d.ts +1 -1
- 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 +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/map/index.js +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/print/index.d.ts +1 -1
- 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 +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/recordtoarray/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/removeattribute/index.js +7 -4
- package/agnostic/html/hyper-json/smart-tags/coalesced/renameproperty/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/replace/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/set/index.d.ts +1 -1
- package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/setattribute/index.js +7 -4
- 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 +9 -9
- package/agnostic/html/hyper-json/smart-tags/coalesced/sorton/index.d.ts +2 -2
- package/agnostic/html/hyper-json/smart-tags/coalesced/spread/index.d.ts +1 -1
- 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/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/transformselected/index.js +0 -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/global/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 +1 -1
- package/agnostic/html/hyper-json/smart-tags/isolated/index.d.ts +4 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/index.js +4 -4
- package/agnostic/html/hyper-json/smart-tags/isolated/nodelist/index.d.ts +1 -1
- 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/text/index.js +3 -1
- package/agnostic/html/hyper-json/transformer/index.d.ts +2 -2
- package/agnostic/html/hyper-json/transformer/index.js +6 -9
- package/agnostic/html/hyper-json/tree/index.d.ts +1 -1
- package/agnostic/html/hyper-json/tree/index.js +14 -10
- package/agnostic/html/hyper-json/types/index.d.ts +9 -13
- package/agnostic/html/hyper-json/utils/index.d.ts +7 -7
- package/agnostic/html/hyper-json/utils/index.js +1 -1
- package/agnostic/html/index.d.ts +1 -1
- package/agnostic/html/index.js +1 -1
- package/agnostic/html/placeholders/index.d.ts +1 -1
- package/agnostic/html/selector-to-element/index.js +1 -1
- package/agnostic/index.d.ts +6 -6
- package/agnostic/index.js +6 -6
- package/agnostic/misc/assert/index.d.ts +2 -2
- package/agnostic/misc/assert/index.js +4 -4
- package/agnostic/misc/cast/index.d.ts +1 -1
- package/agnostic/misc/connection/index.js +0 -1
- package/agnostic/misc/crawler/index.d.ts +2 -2
- package/agnostic/misc/crossenv/detect-runtime/index.js +4 -4
- package/agnostic/misc/crossenv/window/index.d.ts +1 -1
- package/agnostic/misc/crossenv/window/index.js +2 -2
- package/agnostic/misc/data-size/index.js +2 -2
- package/agnostic/misc/index.d.ts +5 -5
- package/agnostic/misc/index.js +5 -5
- package/agnostic/misc/is-constructor-function/index.d.ts +1 -1
- package/agnostic/misc/logs/index.d.ts +1 -1
- package/agnostic/misc/logs/index.js +1 -1
- package/agnostic/misc/logs/logger/index.d.ts +1 -1
- package/agnostic/misc/outcome/index.d.ts +7 -7
- package/agnostic/numbers/approximate-rational/index.js +4 -2
- package/agnostic/numbers/index.d.ts +3 -3
- package/agnostic/numbers/index.js +3 -3
- package/agnostic/objects/deep-get-property/index.js +2 -2
- package/agnostic/objects/flatten-getters/index.js +2 -1
- package/agnostic/objects/index.d.ts +4 -3
- package/agnostic/objects/index.js +4 -3
- package/agnostic/objects/record-format/index.js +1 -0
- package/agnostic/objects/sort-keys/index.d.ts +11 -0
- package/agnostic/objects/sort-keys/index.js +12 -0
- package/agnostic/objects/sort-keys/index.test.d.ts +1 -0
- package/agnostic/optim/memoize/index.js +1 -1
- package/agnostic/optim/throttle-debounce/index.d.ts +12 -10
- package/agnostic/optim/throttle-debounce/index.js +2 -2
- package/agnostic/optim/throttle-debounce/types.d.ts +1 -1
- package/agnostic/random/index.d.ts +1 -1
- package/agnostic/random/index.js +1 -1
- package/agnostic/random/random/index.js +1 -1
- package/agnostic/sanitization/html/index.js +7 -7
- package/agnostic/sanitization/index.d.ts +2 -2
- package/agnostic/sanitization/index.js +2 -2
- package/agnostic/sanitization/types.d.ts +2 -6
- package/agnostic/strings/char-codes/index.d.ts +5 -5
- package/agnostic/strings/char-codes/index.js +2 -2
- package/agnostic/strings/index.d.ts +2 -2
- package/agnostic/strings/index.js +2 -2
- package/agnostic/strings/matches/index.d.ts +2 -2
- package/agnostic/time/dates/format-date/index.js +23 -9
- package/agnostic/time/duration/index.d.ts +23 -2
- package/agnostic/time/duration/index.js +36 -4
- package/agnostic/time/index.d.ts +2 -2
- package/agnostic/time/index.js +2 -2
- package/agnostic/time/timeout/index.js +2 -2
- package/agnostic/time/wait/index.d.ts +2 -2
- package/agnostic/time/wait/index.js +1 -1
- package/components/EventListener/index.d.ts +2 -2
- package/components/EventListener/index.js +8 -8
- package/components/Input/index.d.ts +2 -2
- package/components/IntersectionObserver/index.d.ts +2 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/node/@aws-s3/storage/directory/copy-dir/index.d.ts +2 -2
- package/node/@aws-s3/storage/directory/copy-dir/index.js +3 -3
- package/node/@aws-s3/storage/directory/list/index.d.ts +2 -2
- package/node/@aws-s3/storage/directory/list/index.js +1 -1
- package/node/@aws-s3/storage/directory/move-dir/index.d.ts +3 -3
- package/node/@aws-s3/storage/directory/move-dir/index.js +3 -3
- package/node/@aws-s3/storage/directory/remove-dir/index.d.ts +2 -2
- package/node/@aws-s3/storage/directory/remove-dir/index.js +4 -4
- package/node/@aws-s3/storage/file/copy/index.d.ts +1 -1
- package/node/@aws-s3/storage/file/download/index.d.ts +3 -3
- package/node/@aws-s3/storage/file/exists/index.d.ts +2 -2
- package/node/@aws-s3/storage/file/exists/index.js +1 -2
- package/node/@aws-s3/storage/file/index.d.ts +3 -3
- package/node/@aws-s3/storage/file/index.js +3 -3
- package/node/@aws-s3/storage/file/move/index.d.ts +2 -2
- package/node/@aws-s3/storage/file/remove/index.d.ts +1 -1
- package/node/@aws-s3/storage/file/stat/index.d.ts +1 -1
- package/node/@aws-s3/storage/file/upload/index.d.ts +2 -2
- package/node/@aws-s3/storage/index.d.ts +1 -1
- package/node/@aws-s3/storage/index.js +1 -1
- package/node/@express/@multer/index.d.ts +1 -1
- package/node/@google-cloud/storage/bucket/get-metadata/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/copy-dir/index.d.ts +1 -1
- 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 +1 -1
- package/node/@google-cloud/storage/directory/move-dir/index.d.ts +1 -1
- package/node/@google-cloud/storage/directory/remove-dir/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/copy/index.d.ts +2 -2
- package/node/@google-cloud/storage/file/download/index.d.ts +2 -2
- package/node/@google-cloud/storage/file/exists/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/generate-signed-url/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/get-metadata/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/get-permissions/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/index.d.ts +4 -4
- package/node/@google-cloud/storage/file/index.js +4 -4
- package/node/@google-cloud/storage/file/move/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/remove/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/revoke-signed-urls/index.d.ts +4 -4
- package/node/@google-cloud/storage/file/stat/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/stat/index.js +2 -2
- package/node/@google-cloud/storage/file/update-metadata/index.d.ts +1 -1
- package/node/@google-cloud/storage/file/upload/index.d.ts +2 -2
- package/node/@google-cloud/storage/index.d.ts +1 -1
- package/node/@google-cloud/storage/index.js +1 -1
- package/node/cloud-storage/operations/copy-dir/index.d.ts +8 -8
- package/node/cloud-storage/operations/copy-dir/index.js +4 -4
- package/node/cloud-storage/operations/copy-file/index.d.ts +8 -8
- package/node/cloud-storage/operations/copy-file/index.js +4 -4
- package/node/cloud-storage/operations/download-file/index.d.ts +9 -9
- package/node/cloud-storage/operations/download-file/index.js +4 -4
- package/node/cloud-storage/operations/exists-file/index.d.ts +6 -6
- 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 +6 -6
- package/node/cloud-storage/operations/list-dir/index.js +4 -4
- package/node/cloud-storage/operations/move-dir/index.d.ts +8 -8
- package/node/cloud-storage/operations/move-dir/index.js +4 -4
- package/node/cloud-storage/operations/move-file/index.d.ts +8 -8
- package/node/cloud-storage/operations/move-file/index.js +4 -4
- package/node/cloud-storage/operations/remove-dir/index.d.ts +8 -8
- package/node/cloud-storage/operations/remove-dir/index.js +4 -4
- package/node/cloud-storage/operations/remove-file/index.d.ts +8 -8
- package/node/cloud-storage/operations/remove-file/index.js +4 -4
- package/node/cloud-storage/operations/stat-file/index.d.ts +8 -8
- package/node/cloud-storage/operations/stat-file/index.js +4 -4
- package/node/cloud-storage/operations/upload-file/index.d.ts +9 -9
- package/node/cloud-storage/operations/upload-file/index.js +4 -4
- package/node/files/index.d.ts +1 -1
- package/node/files/index.js +1 -1
- package/node/files/read-write/index.js +1 -1
- package/node/files/subpaths/index.d.ts +3 -3
- package/node/files/subpaths/index.js +6 -6
- package/node/ftps/directory/copy-dir/index.d.ts +1 -1
- package/node/ftps/directory/copy-dir/index.js +1 -1
- package/node/ftps/directory/list/index.d.ts +1 -1
- package/node/ftps/directory/move-dir/index.d.ts +1 -1
- package/node/ftps/directory/move-dir/index.js +1 -3
- package/node/ftps/directory/remove-dir/index.d.ts +2 -2
- package/node/ftps/file/copy/index.d.ts +1 -1
- package/node/ftps/file/copy/index.js +1 -1
- package/node/ftps/file/download/index.d.ts +2 -2
- package/node/ftps/file/exists/index.d.ts +2 -2
- package/node/ftps/file/exists/index.js +1 -1
- 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 +3 -3
- package/node/ftps/file/move/index.js +1 -1
- package/node/ftps/file/remove/index.d.ts +1 -1
- package/node/ftps/file/stat/index.d.ts +1 -1
- package/node/ftps/file/stat/index.js +2 -2
- package/node/ftps/file/upload/index.d.ts +2 -2
- package/node/images/format/index.d.ts +1 -1
- package/node/images/format/index.js +9 -9
- package/node/images/index.d.ts +2 -2
- package/node/images/index.js +2 -2
- package/node/images/metadata/index.d.ts +1 -1
- package/node/images/metadata/index.js +1 -1
- package/node/images/transform/index.d.ts +2 -2
- package/node/images/transform/index.js +26 -21
- package/node/images/transform/operations/blur/index.d.ts +1 -1
- package/node/images/transform/operations/brighten/index.d.ts +1 -1
- package/node/images/transform/operations/extend/index.d.ts +1 -1
- package/node/images/transform/operations/extract/index.d.ts +1 -1
- package/node/images/transform/operations/flatten/index.d.ts +1 -1
- package/node/images/transform/operations/flatten/index.js +1 -1
- package/node/images/transform/operations/flip/index.d.ts +1 -1
- package/node/images/transform/operations/flop/index.d.ts +1 -1
- package/node/images/transform/operations/hue/index.d.ts +1 -1
- package/node/images/transform/operations/index.d.ts +5 -5
- package/node/images/transform/operations/index.js +5 -5
- package/node/images/transform/operations/level/index.d.ts +1 -1
- package/node/images/transform/operations/lighten/index.d.ts +1 -1
- package/node/images/transform/operations/normalize/index.d.ts +1 -1
- package/node/images/transform/operations/overlay/index.js +1 -1
- package/node/images/transform/operations/resize/index.d.ts +1 -1
- package/node/images/transform/operations/rotate/index.d.ts +1 -1
- package/node/images/transform/operations/saturate/index.d.ts +1 -1
- package/node/index.d.ts +3 -3
- package/node/index.js +3 -3
- package/node/process/prompt-continue/index.js +1 -1
- package/node/process/spawner/index.d.ts +1 -9
- package/node/process/spawner/index.js +10 -8
- package/node/sftp/directory/copy-dir/index.d.ts +2 -1
- package/node/sftp/directory/copy-dir/index.js +2 -2
- 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 +1 -1
- package/node/sftp/directory/move-dir/index.d.ts +1 -1
- package/node/sftp/directory/move-dir/index.js +2 -4
- package/node/sftp/directory/remove-dir/index.d.ts +2 -2
- package/node/sftp/file/copy/index.d.ts +2 -1
- package/node/sftp/file/copy/index.js +2 -2
- package/node/sftp/file/download/index.d.ts +3 -3
- package/node/sftp/file/exists/index.d.ts +1 -1
- package/node/sftp/file/index.d.ts +3 -3
- package/node/sftp/file/index.js +3 -3
- package/node/sftp/file/move/index.d.ts +3 -3
- package/node/sftp/file/move/index.js +3 -5
- package/node/sftp/file/remove/index.d.ts +1 -1
- package/node/sftp/file/remove/index.js +1 -1
- package/node/sftp/file/stat/index.d.ts +1 -1
- package/node/sftp/file/stat/index.js +1 -1
- package/node/sftp/file/upload/index.d.ts +3 -2
- package/node/sftp/file/upload/index.js +1 -1
- package/package.json +1244 -10
|
@@ -67,7 +67,7 @@ var DataSize = class {
|
|
|
67
67
|
if (this.unit === "exbibyte") return this.value * 8 * Math.pow(1024, 6);
|
|
68
68
|
return this.value;
|
|
69
69
|
}
|
|
70
|
-
/* * * * * * * * * * * * * * * * * *
|
|
70
|
+
/* * * * * * * * * * * * * * * * * *
|
|
71
71
|
* Decimal unit converters
|
|
72
72
|
* * * * * * * * * * * * * * * * * */
|
|
73
73
|
toBytes() {
|
|
@@ -98,7 +98,7 @@ var DataSize = class {
|
|
|
98
98
|
return this.toBytes() / 1e18;
|
|
99
99
|
}
|
|
100
100
|
toEB = this.toExabytes.bind(this);
|
|
101
|
-
/* * * * * * * * * * * * * * * * * *
|
|
101
|
+
/* * * * * * * * * * * * * * * * * *
|
|
102
102
|
* Binary unit converters
|
|
103
103
|
* * * * * * * * * * * * * * * * * */
|
|
104
104
|
toKibibytes() {
|
package/agnostic/misc/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * as connection from './connection/index.js'
|
|
2
|
-
export * as cast from './cast/index.js'
|
|
3
1
|
export * as assert from './assert/index.js'
|
|
2
|
+
export * as cast from './cast/index.js'
|
|
3
|
+
export * as connection from './connection/index.js'
|
|
4
4
|
export * as crawler from './crawler/index.js'
|
|
5
5
|
export * as dataSize from './data-size/index.js'
|
|
6
|
-
export * as isNullish from './is-nullish/index.js'
|
|
7
6
|
export * as isConstructorFunction from './is-constructor-function/index.js'
|
|
8
|
-
export * as logs from './logs/index.js'
|
|
9
|
-
export * as loremIpsum from './lorem-ipsum/index.js'
|
|
10
7
|
export * as crossenv from './crossenv/index.js'
|
|
8
|
+
export * as isNullish from './is-nullish/index.js'
|
|
9
|
+
export * as logs from './logs/index.js'
|
|
11
10
|
export * as outcome from './outcome/index.js'
|
|
11
|
+
export * as loremIpsum from './lorem-ipsum/index.js'
|
|
12
12
|
export * as normalizeExtension from './normalize-extension/index.js'
|
package/agnostic/misc/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * as connection from './connection/index.js'
|
|
2
|
-
export * as cast from './cast/index.js'
|
|
3
1
|
export * as assert from './assert/index.js'
|
|
2
|
+
export * as cast from './cast/index.js'
|
|
3
|
+
export * as connection from './connection/index.js'
|
|
4
4
|
export * as crawler from './crawler/index.js'
|
|
5
5
|
export * as dataSize from './data-size/index.js'
|
|
6
|
-
export * as isNullish from './is-nullish/index.js'
|
|
7
6
|
export * as isConstructorFunction from './is-constructor-function/index.js'
|
|
8
|
-
export * as logs from './logs/index.js'
|
|
9
|
-
export * as loremIpsum from './lorem-ipsum/index.js'
|
|
10
7
|
export * as crossenv from './crossenv/index.js'
|
|
8
|
+
export * as isNullish from './is-nullish/index.js'
|
|
9
|
+
export * as logs from './logs/index.js'
|
|
11
10
|
export * as outcome from './outcome/index.js'
|
|
11
|
+
export * as loremIpsum from './lorem-ipsum/index.js'
|
|
12
12
|
export * as normalizeExtension from './normalize-extension/index.js'
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @template T - The type of object constructed by the function.
|
|
5
5
|
*/
|
|
6
|
-
export type ConstructorFunction<T
|
|
6
|
+
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
|
*
|
|
@@ -29,7 +29,7 @@ declare class Log<T extends ConsoleMethod = ConsoleMethod> {
|
|
|
29
29
|
get displayStack(): string;
|
|
30
30
|
}
|
|
31
31
|
export declare class Logger {
|
|
32
|
-
_private_threads: Map<string, Log[]>;
|
|
32
|
+
_private_threads: Map<string, Log<ConsoleMethod>[]>;
|
|
33
33
|
constructor();
|
|
34
34
|
dir(thread?: string, ...args: ConsoleMethodsParams['dir']): void;
|
|
35
35
|
error(thread?: string, ...args: ConsoleMethodsParams['error']): void;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @property {true} success - Always `true`.
|
|
6
6
|
* @property {Payload} payload - The success value.
|
|
7
7
|
*/
|
|
8
|
-
export type Success<Payload
|
|
8
|
+
export type Success<Payload = any> = {
|
|
9
9
|
success: true;
|
|
10
10
|
payload: Payload;
|
|
11
11
|
};
|
|
@@ -16,7 +16,7 @@ export type Success<Payload extends any = any> = {
|
|
|
16
16
|
* @property {false} success - Always `false`.
|
|
17
17
|
* @property {Error} error - The error value.
|
|
18
18
|
*/
|
|
19
|
-
export type Failure<Error
|
|
19
|
+
export type Failure<Error = any> = {
|
|
20
20
|
success: false;
|
|
21
21
|
error: Error;
|
|
22
22
|
};
|
|
@@ -26,7 +26,7 @@ export type Failure<Error extends any = any> = {
|
|
|
26
26
|
* @template Payload - Type of success payload.
|
|
27
27
|
* @template Error - Type of error.
|
|
28
28
|
*/
|
|
29
|
-
export type Either<Payload
|
|
29
|
+
export type Either<Payload = any, Error = any> = Success<Payload> | Failure<Error>;
|
|
30
30
|
/**
|
|
31
31
|
* Creates a success outcome with the given payload.
|
|
32
32
|
*
|
|
@@ -34,7 +34,7 @@ export type Either<Payload extends any = any, Error extends any = any> = Success
|
|
|
34
34
|
* @param {Payload} payload - The success value.
|
|
35
35
|
* @returns {Success<Payload>} A success outcome object.
|
|
36
36
|
*/
|
|
37
|
-
export declare function makeSuccess<Payload
|
|
37
|
+
export declare function makeSuccess<Payload>(payload: Payload): Success<Payload>;
|
|
38
38
|
/**
|
|
39
39
|
* Creates a failure outcome with the given error.
|
|
40
40
|
*
|
|
@@ -42,7 +42,7 @@ export declare function makeSuccess<Payload extends any>(payload: Payload): Succ
|
|
|
42
42
|
* @param {Error} error - The error value.
|
|
43
43
|
* @returns {Failure<Error>} A failure outcome object.
|
|
44
44
|
*/
|
|
45
|
-
export declare function makeFailure<Error
|
|
45
|
+
export declare function makeFailure<Error>(error: Error): Failure<Error>;
|
|
46
46
|
/**
|
|
47
47
|
* Creates either a success or failure outcome based on a boolean flag.
|
|
48
48
|
*
|
|
@@ -52,5 +52,5 @@ export declare function makeFailure<Error extends any>(error: Error): Failure<Er
|
|
|
52
52
|
* @param {Payload | Error} payloadOrError - The payload if success, or the error if failure.
|
|
53
53
|
* @returns {Either<Payload, Error>} The resulting outcome.
|
|
54
54
|
*/
|
|
55
|
-
export declare function make<Payload
|
|
56
|
-
export declare function make<Error
|
|
55
|
+
export declare function make<Payload>(success: true, payload: Payload): Success<Payload>;
|
|
56
|
+
export declare function make<Error>(success: false, error: Error): Failure<Error>;
|
|
@@ -44,8 +44,10 @@ function approximateRationalDumb(target, maxRounds) {
|
|
|
44
44
|
function approximateRational(target, maxDenominator = 1e3) {
|
|
45
45
|
const sign = target < 0 ? -1 : 1;
|
|
46
46
|
const absTarget = Math.abs(target);
|
|
47
|
-
let h1 = 1
|
|
48
|
-
let
|
|
47
|
+
let h1 = 1;
|
|
48
|
+
let h2 = 0;
|
|
49
|
+
let k1 = 0;
|
|
50
|
+
let k2 = 1;
|
|
49
51
|
let b = absTarget;
|
|
50
52
|
do {
|
|
51
53
|
const a = Math.floor(b);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as
|
|
1
|
+
export * as approximateRational from './approximate-rational/index.js'
|
|
2
2
|
export * as clamp from './clamp/index.js'
|
|
3
|
+
export * as absoluteModulo from './absolute-modulo/index.js'
|
|
4
|
+
export * as interpolate from './interpolate/index.js'
|
|
3
5
|
export * as geometricProgressions from './geometric-progressions/index.js'
|
|
4
|
-
export * as approximateRational from './approximate-rational/index.js'
|
|
5
6
|
export * as round from './round/index.js'
|
|
6
|
-
export * as interpolate from './interpolate/index.js'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * as
|
|
1
|
+
export * as approximateRational from './approximate-rational/index.js'
|
|
2
2
|
export * as clamp from './clamp/index.js'
|
|
3
|
+
export * as absoluteModulo from './absolute-modulo/index.js'
|
|
4
|
+
export * as interpolate from './interpolate/index.js'
|
|
3
5
|
export * as geometricProgressions from './geometric-progressions/index.js'
|
|
4
|
-
export * as approximateRational from './approximate-rational/index.js'
|
|
5
6
|
export * as round from './round/index.js'
|
|
6
|
-
export * as interpolate from './interpolate/index.js'
|
|
@@ -6,14 +6,14 @@ function deepGetProperty(anythingThatHasProperties, pathString) {
|
|
|
6
6
|
let returned = currentObject;
|
|
7
7
|
pathChunks.forEach((chunk, pos) => {
|
|
8
8
|
const isLast = pos === pathChunks.length - 1;
|
|
9
|
-
if (!isRecord(currentObject)) throw "PROPERTY_UNREACHABLE";
|
|
9
|
+
if (!isRecord(currentObject)) throw new Error("PROPERTY_UNREACHABLE");
|
|
10
10
|
if (isLast) {
|
|
11
11
|
const val = currentObject[chunk];
|
|
12
12
|
returned = val;
|
|
13
13
|
} else {
|
|
14
14
|
const found = currentObject[chunk];
|
|
15
15
|
if (isRecord(found)) currentObject = found;
|
|
16
|
-
else throw "PROPERTY_UNREACHABLE";
|
|
16
|
+
else throw new Error("PROPERTY_UNREACHABLE");
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
return returned;
|
|
@@ -5,7 +5,8 @@ function flattenGetters(obj) {
|
|
|
5
5
|
).filter(([_, desc]) => typeof desc.get === "function").map(([key]) => key);
|
|
6
6
|
const returned = { ...obj };
|
|
7
7
|
getters.forEach((getter) => {
|
|
8
|
-
|
|
8
|
+
const key = getter;
|
|
9
|
+
returned[getter] = obj[key];
|
|
9
10
|
});
|
|
10
11
|
return returned;
|
|
11
12
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export * as
|
|
1
|
+
export * as enums from './enums/index.js'
|
|
2
2
|
export * as flattenGetters from './flatten-getters/index.js'
|
|
3
3
|
export * as isObject from './is-object/index.js'
|
|
4
4
|
export * as isRecord from './is-record/index.js'
|
|
5
|
+
export * as deepGetProperty from './deep-get-property/index.js'
|
|
6
|
+
export * as recordMap from './record-map/index.js'
|
|
7
|
+
export * as sortKeys from './sort-keys/index.js'
|
|
5
8
|
export * as recordFormat from './record-format/index.js'
|
|
6
9
|
export * as validation from './validation/index.js'
|
|
7
|
-
export * as recordMap from './record-map/index.js'
|
|
8
|
-
export * as enums from './enums/index.js'
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export * as
|
|
1
|
+
export * as enums from './enums/index.js'
|
|
2
2
|
export * as flattenGetters from './flatten-getters/index.js'
|
|
3
3
|
export * as isObject from './is-object/index.js'
|
|
4
4
|
export * as isRecord from './is-record/index.js'
|
|
5
|
+
export * as deepGetProperty from './deep-get-property/index.js'
|
|
6
|
+
export * as recordMap from './record-map/index.js'
|
|
7
|
+
export * as sortKeys from './sort-keys/index.js'
|
|
5
8
|
export * as recordFormat from './record-format/index.js'
|
|
6
9
|
export * as validation from './validation/index.js'
|
|
7
|
-
export * as recordMap from './record-map/index.js'
|
|
8
|
-
export * as enums from './enums/index.js'
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a new object with the keys sorted according to the provided sorter.
|
|
3
|
+
*
|
|
4
|
+
* @template T - The type of the input object.
|
|
5
|
+
* @param {T} obj - The object whose keys should be sorted.
|
|
6
|
+
* @param {(a: keyof T, b: keyof T) => number} [sorter] - Optional function used to compare keys for sorting. Defaults to alphabetical order.
|
|
7
|
+
* @returns {{ [K in keyof T]: T[K] }} A new object with the same keys and values as the input, but sorted by key.
|
|
8
|
+
*/
|
|
9
|
+
export declare function sortKeys<T extends Record<string, unknown>>(obj: T, sorter?: (a: keyof T, b: keyof T) => number): {
|
|
10
|
+
[K in keyof T]: T[K];
|
|
11
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/agnostic/objects/sort-keys/index.ts
|
|
2
|
+
function sortKeys(obj, sorter = (a, b) => String(a).localeCompare(String(b))) {
|
|
3
|
+
const out = {};
|
|
4
|
+
const keys = Object.keys(obj);
|
|
5
|
+
for (const key of keys.sort(sorter)) {
|
|
6
|
+
out[key] = obj[key];
|
|
7
|
+
}
|
|
8
|
+
return out;
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
sortKeys
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,7 @@ function memoize(toMemoizeFunc) {
|
|
|
3
3
|
let cachedArgs;
|
|
4
4
|
let cachedResult;
|
|
5
5
|
const memoizedFunc = (...args) => {
|
|
6
|
-
const argsMatch = cachedArgs !== void 0 && args.length === cachedArgs.length && args.every((arg, i) => arg === cachedArgs[i]);
|
|
6
|
+
const argsMatch = cachedArgs !== void 0 && args.length === cachedArgs.length && args.every((arg, i) => arg === cachedArgs?.[i]);
|
|
7
7
|
if (argsMatch && cachedResult !== void 0) return cachedResult.value;
|
|
8
8
|
const result = toMemoizeFunc(...args);
|
|
9
9
|
cachedArgs = args;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
type BasicFunction = (...args: any[]) => any;
|
|
2
|
-
|
|
3
|
-
* Returns a throttled version of the function passed as an argument
|
|
4
|
-
* @param toThrottleFunc - The function that has to be throttled
|
|
5
|
-
* @param delayMs - The throttle delay in ms
|
|
6
|
-
*/
|
|
7
|
-
export declare function throttle<T extends BasicFunction = BasicFunction>(toThrottleFunc: T, delayMs: number): {
|
|
2
|
+
type ThrottledResult<T extends BasicFunction> = {
|
|
8
3
|
throttled: (...args: any[]) => {
|
|
9
4
|
returnValue: ReturnType<T> | undefined;
|
|
10
5
|
lastExecutedOn: number;
|
|
@@ -14,11 +9,12 @@ export declare function throttle<T extends BasicFunction = BasicFunction>(toThro
|
|
|
14
9
|
setDelay: (delayMs: number) => void;
|
|
15
10
|
};
|
|
16
11
|
/**
|
|
17
|
-
* Returns a
|
|
18
|
-
* @param
|
|
19
|
-
* @param delayMs - The
|
|
12
|
+
* Returns a throttled version of the function passed as an argument
|
|
13
|
+
* @param toThrottleFunc - The function that has to be throttled
|
|
14
|
+
* @param delayMs - The throttle delay in ms
|
|
20
15
|
*/
|
|
21
|
-
export declare function
|
|
16
|
+
export declare function throttle<T extends BasicFunction = BasicFunction>(toThrottleFunc: T, delayMs: number): ThrottledResult<T>;
|
|
17
|
+
type DebounceResult<T extends BasicFunction> = {
|
|
22
18
|
debounced: (...args: any[]) => {
|
|
23
19
|
returnValue: ReturnType<T> | undefined;
|
|
24
20
|
lastExecutedOn: number;
|
|
@@ -27,4 +23,10 @@ export declare function debounce<T extends BasicFunction = BasicFunction>(toDebo
|
|
|
27
23
|
};
|
|
28
24
|
setDelay: (delayMs: number) => void;
|
|
29
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Returns a debounced version of the function passed as an argument
|
|
28
|
+
* @param toDebounceFunc - The function that has to be debounced
|
|
29
|
+
* @param delayMs - The debounce delay in ms
|
|
30
|
+
*/
|
|
31
|
+
export declare function debounce<T extends BasicFunction = BasicFunction>(toDebounceFunc: T, delayMs: number): DebounceResult<T>;
|
|
30
32
|
export {};
|
|
@@ -3,7 +3,7 @@ function throttle(toThrottleFunc, delayMs) {
|
|
|
3
3
|
let currentDelayMs = delayMs;
|
|
4
4
|
let lastArgs = [];
|
|
5
5
|
let lastExecutedOn = 0;
|
|
6
|
-
let lastReturnValue
|
|
6
|
+
let lastReturnValue;
|
|
7
7
|
let nextExecutionTimeout = null;
|
|
8
8
|
function scheduleNextCall() {
|
|
9
9
|
if (nextExecutionTimeout !== null) {
|
|
@@ -56,7 +56,7 @@ function debounce(toDebounceFunc, delayMs) {
|
|
|
56
56
|
let lastArgs = [];
|
|
57
57
|
let lastCalledOn = 0;
|
|
58
58
|
let lastExecutedOn = 0;
|
|
59
|
-
let lastReturnValue
|
|
59
|
+
let lastReturnValue;
|
|
60
60
|
let nextExecutionTimeout = null;
|
|
61
61
|
function scheduleNextCall() {
|
|
62
62
|
if (nextExecutionTimeout !== null) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { setTimeout } from 'node:timers';
|
|
1
|
+
import { type setTimeout } from 'node:timers';
|
|
2
2
|
export type NodeTimeout = ReturnType<typeof setTimeout>;
|
package/agnostic/random/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/agnostic/random/random/index.ts
|
|
2
2
|
function random(bound1 = 1, bound2) {
|
|
3
3
|
const min = bound2 === void 0 ? 0 : bound1;
|
|
4
|
-
const max = bound2
|
|
4
|
+
const max = bound2 ?? bound1;
|
|
5
5
|
if (min === max || min > max) return void 0;
|
|
6
6
|
const range = max - min;
|
|
7
7
|
return Math.random() * range + min;
|
|
@@ -27,12 +27,12 @@ function sanitizeElement(element, options = defaultOptions) {
|
|
|
27
27
|
const normalizedTagName = tagName.toLowerCase().trim();
|
|
28
28
|
const tagIsInForbidden = forbiddenTags.includes("*") || forbiddenTags.includes(normalizedTagName);
|
|
29
29
|
if (tagIsInForbidden) {
|
|
30
|
-
if (verbose
|
|
30
|
+
if (verbose) console.warn(tagName, "tag is forbidden");
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
33
|
const tagIsInAllowed = allowedTags.includes("*") || allowedTags.includes(normalizedTagName);
|
|
34
34
|
if (!tagIsInAllowed) {
|
|
35
|
-
if (verbose
|
|
35
|
+
if (verbose) console.warn(tagName, "tag is not allowed");
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
38
|
const returnedElement = Window.get().document.createElement(tagName);
|
|
@@ -47,20 +47,20 @@ function sanitizeElement(element, options = defaultOptions) {
|
|
|
47
47
|
if (typeof nameTester === "string" && nameTester !== "*" && attributeName !== nameTester) return false;
|
|
48
48
|
if (typeof nameTester !== "string" && !nameTester.test(attributeName)) return false;
|
|
49
49
|
if (valTesters === void 0) {
|
|
50
|
-
if (verbose
|
|
50
|
+
if (verbose) console.warn(attributeName, "attribute on", tagName, "tag is forbidden");
|
|
51
51
|
return true;
|
|
52
52
|
}
|
|
53
53
|
if (valTesters.includes("*")) {
|
|
54
|
-
if (verbose
|
|
54
|
+
if (verbose) console.warn(attributeName, "attribute on", tagName, "tag is forbidden");
|
|
55
55
|
return true;
|
|
56
56
|
}
|
|
57
57
|
return valTesters.some((valTester) => {
|
|
58
58
|
if (typeof valTester === "string" && attributeValue === valTester) {
|
|
59
|
-
if (verbose
|
|
59
|
+
if (verbose) console.warn(attributeValue, "value for", attributeName, "attribute on", tagName, "tag is forbidden. Rule:", valTester);
|
|
60
60
|
return true;
|
|
61
61
|
}
|
|
62
62
|
if (typeof valTester !== "string" && valTester.test(attributeValue)) {
|
|
63
|
-
if (verbose
|
|
63
|
+
if (verbose) console.warn(attributeValue, "value for", attributeName, "attribute on", tagName, "tag is forbidden. Rule:", valTester);
|
|
64
64
|
return true;
|
|
65
65
|
}
|
|
66
66
|
return false;
|
|
@@ -93,7 +93,7 @@ function sanitizeElement(element, options = defaultOptions) {
|
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
95
|
if (!isInAllowed) {
|
|
96
|
-
if (verbose
|
|
96
|
+
if (verbose) console.warn(...latestNotAllowedReason);
|
|
97
97
|
return false;
|
|
98
98
|
}
|
|
99
99
|
return true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * as fileName from './file-name/index.js'
|
|
2
|
-
export * as html from './html/index.js'
|
|
3
1
|
export * as path from './path/index.js'
|
|
2
|
+
export * as html from './html/index.js'
|
|
3
|
+
export * as fileName from './file-name/index.js'
|
|
4
4
|
export * as userInput from './user-input/index.js'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * as fileName from './file-name/index.js'
|
|
2
|
-
export * as html from './html/index.js'
|
|
3
1
|
export * as path from './path/index.js'
|
|
2
|
+
export * as html from './html/index.js'
|
|
3
|
+
export * as fileName from './file-name/index.js'
|
|
4
4
|
export * as userInput from './user-input/index.js'
|
|
@@ -26,12 +26,8 @@ export type SanitizeHtmlOptions = {
|
|
|
26
26
|
keepComments?: boolean;
|
|
27
27
|
allowedTags?: string[];
|
|
28
28
|
forbiddenTags?: string[];
|
|
29
|
-
allowedAttributes?:
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
forbiddenAttributes?: {
|
|
33
|
-
[tagName: string]: AttributeNameValPair[];
|
|
34
|
-
};
|
|
29
|
+
allowedAttributes?: Record<string, AttributeNameValPair[]>;
|
|
30
|
+
forbiddenAttributes?: Record<string, AttributeNameValPair[]>;
|
|
35
31
|
depth?: number;
|
|
36
32
|
verbose?: boolean;
|
|
37
33
|
};
|
|
@@ -43,25 +43,25 @@ export declare function charFromB36CharCode(b36CharCode: B36CharCode): string;
|
|
|
43
43
|
* @param string - Input string.
|
|
44
44
|
* @returns Array of character codes.
|
|
45
45
|
*/
|
|
46
|
-
export declare function toCharCodes(string: string):
|
|
46
|
+
export declare function toCharCodes(string: string): CharCode[];
|
|
47
47
|
/**
|
|
48
48
|
* Converts a string into an array of base-36 encoded character codes.
|
|
49
49
|
* @param string - Input string.
|
|
50
50
|
* @returns Array of base-36 character codes.
|
|
51
51
|
*/
|
|
52
|
-
export declare function toB36CharCodes(string: string):
|
|
52
|
+
export declare function toB36CharCodes(string: string): B36CharCode[];
|
|
53
53
|
/**
|
|
54
54
|
* Converts an array of Unicode character codes back to a string.
|
|
55
55
|
* @param charCodes - Array of character codes.
|
|
56
56
|
* @returns Reconstructed string.
|
|
57
57
|
*/
|
|
58
|
-
export declare function fromCharCodes(charCodes:
|
|
58
|
+
export declare function fromCharCodes(charCodes: CharCode[]): string;
|
|
59
59
|
/**
|
|
60
60
|
* Converts an array of base-36 encoded character codes back to a string.
|
|
61
61
|
* @param b36CharCodes - Array of base-36 character codes.
|
|
62
62
|
* @returns Reconstructed string.
|
|
63
63
|
*/
|
|
64
|
-
export declare function fromB36CharCodes(b36CharCodes:
|
|
64
|
+
export declare function fromB36CharCodes(b36CharCodes: B36CharCode[]): string;
|
|
65
65
|
/**
|
|
66
66
|
* Serializes an array of character codes (Unicode or base-36) into a string.
|
|
67
67
|
* @param charCodes - Array of character codes to serialize.
|
|
@@ -73,7 +73,7 @@ export declare function serialize(charCodes: Array<CharCode | B36CharCode>): str
|
|
|
73
73
|
* @param serializedCharCodes - Serialized string.
|
|
74
74
|
* @returns Array of Unicode character codes.
|
|
75
75
|
*/
|
|
76
|
-
export declare function deserialize(serializedCharCodes: string):
|
|
76
|
+
export declare function deserialize(serializedCharCodes: string): CharCode[];
|
|
77
77
|
/**
|
|
78
78
|
* Deserializes a string of base-36 character codes and reconstructs the original string.
|
|
79
79
|
* @param serializedCharCodes - Serialized string.
|
|
@@ -35,10 +35,10 @@ function toB36CharCodes(string) {
|
|
|
35
35
|
return chars.map(charToB36CharCode);
|
|
36
36
|
}
|
|
37
37
|
function fromCharCodes(charCodes) {
|
|
38
|
-
return charCodes.map(charFromCharCode).map((char) => char
|
|
38
|
+
return charCodes.map(charFromCharCode).map((char) => char ?? "\0").join("");
|
|
39
39
|
}
|
|
40
40
|
function fromB36CharCodes(b36CharCodes) {
|
|
41
|
-
return b36CharCodes.map(charFromB36CharCode).map((char) => char
|
|
41
|
+
return b36CharCodes.map(charFromB36CharCode).map((char) => char ?? "\0").join("");
|
|
42
42
|
}
|
|
43
43
|
function serialize(charCodes) {
|
|
44
44
|
return charCodes.map((c) => typeof c === "string" ? c : charCodeToB36(c)).join(",");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * as charCodes from './char-codes/index.js'
|
|
2
2
|
export * as matches from './matches/index.js'
|
|
3
|
+
export * as normalizeIndent from './normalize-indent/index.js'
|
|
4
|
+
export * as parseTable from './parse-table/index.js'
|
|
3
5
|
export * as replaceAll from './replace-all/index.js'
|
|
4
6
|
export * as toAlphanum from './to-alphanum/index.js'
|
|
5
7
|
export * as trim from './trim/index.js'
|
|
6
|
-
export * as normalizeIndent from './normalize-indent/index.js'
|
|
7
|
-
export * as parseTable from './parse-table/index.js'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * as charCodes from './char-codes/index.js'
|
|
2
2
|
export * as matches from './matches/index.js'
|
|
3
|
+
export * as normalizeIndent from './normalize-indent/index.js'
|
|
4
|
+
export * as parseTable from './parse-table/index.js'
|
|
3
5
|
export * as replaceAll from './replace-all/index.js'
|
|
4
6
|
export * as toAlphanum from './to-alphanum/index.js'
|
|
5
7
|
export * as trim from './trim/index.js'
|
|
6
|
-
export * as normalizeIndent from './normalize-indent/index.js'
|
|
7
|
-
export * as parseTable from './parse-table/index.js'
|
|
@@ -17,7 +17,7 @@ export declare function matches(input: string, matcher: Matcher): boolean;
|
|
|
17
17
|
* @param matchers - A matcher or array of matchers.
|
|
18
18
|
* @returns `true` if the input matches at least one matcher, otherwise `false`.
|
|
19
19
|
*/
|
|
20
|
-
export declare function matchesSome(input: string, matchers: Matcher |
|
|
20
|
+
export declare function matchesSome(input: string, matchers: Matcher | Matcher[]): boolean;
|
|
21
21
|
/**
|
|
22
22
|
* Checks whether a string matches every matcher in a list (or a single matcher).
|
|
23
23
|
*
|
|
@@ -25,4 +25,4 @@ export declare function matchesSome(input: string, matchers: Matcher | Array<Mat
|
|
|
25
25
|
* @param matchers - A matcher or array of matchers.
|
|
26
26
|
* @returns `true` if the input matches all matchers, otherwise `false`.
|
|
27
27
|
*/
|
|
28
|
-
export declare function matchesEvery(input: string, matchers: Matcher |
|
|
28
|
+
export declare function matchesEvery(input: string, matchers: Matcher | Matcher[]): boolean;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// src/agnostic/time/dates/format-date/index.ts
|
|
2
2
|
function formatDate(date, format, locale = "en") {
|
|
3
|
-
|
|
4
|
-
new Intl.DateTimeFormat(locale);
|
|
5
|
-
} catch {
|
|
3
|
+
if (Intl.DateTimeFormat.supportedLocalesOf(locale).length === 0) {
|
|
6
4
|
locale = "en";
|
|
7
5
|
}
|
|
8
6
|
const day = date.getDate();
|
|
@@ -13,23 +11,39 @@ function formatDate(date, format, locale = "en") {
|
|
|
13
11
|
const minutes = date.getMinutes();
|
|
14
12
|
const seconds = date.getSeconds();
|
|
15
13
|
const isPM = hours >= 12;
|
|
16
|
-
const shortDateNames = [...Array(7)].map((_, i) => new Intl.DateTimeFormat(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const shortDateNames = [...Array(7)].map((_, i) => new Intl.DateTimeFormat(
|
|
15
|
+
locale,
|
|
16
|
+
{ weekday: "short" }
|
|
17
|
+
).format(new Date(2023, 0, i + 1)));
|
|
18
|
+
const dateNames = [...Array(7)].map((_, i) => new Intl.DateTimeFormat(
|
|
19
|
+
locale,
|
|
20
|
+
{ weekday: "long" }
|
|
21
|
+
).format(new Date(2023, 0, i + 1)));
|
|
22
|
+
const shortMonthNames = [...Array(12)].map((_, i) => new Intl.DateTimeFormat(
|
|
23
|
+
locale,
|
|
24
|
+
{ month: "short" }
|
|
25
|
+
).format(new Date(2023, i, 1)));
|
|
26
|
+
const monthNames = [...Array(12)].map((_, i) => new Intl.DateTimeFormat(
|
|
27
|
+
locale,
|
|
28
|
+
{ month: "long" }
|
|
29
|
+
).format(new Date(2023, i, 1)));
|
|
20
30
|
const replacements = {
|
|
21
31
|
"DD": () => String(day).padStart(2, "0"),
|
|
22
32
|
"D": () => String(day),
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
23
34
|
"dd": () => dateNames[dayOfWeek],
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
24
36
|
"d": () => shortDateNames[dayOfWeek],
|
|
25
37
|
"MM": () => String(month + 1).padStart(2, "0"),
|
|
26
38
|
"M": () => String(month + 1),
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
40
|
"MMMM": () => monthNames[month],
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
28
42
|
"MMM": () => shortMonthNames[month],
|
|
29
43
|
"YYYY": () => String(year),
|
|
30
44
|
"YY": () => String(year).slice(-2),
|
|
31
|
-
"hh": () => String(hours % 12
|
|
32
|
-
"h": () => String(hours % 12
|
|
45
|
+
"hh": () => String(hours % 12 !== 0 ? hours % 12 : 12).padStart(2, "0"),
|
|
46
|
+
"h": () => String(hours % 12 !== 0 ? hours % 12 : 12),
|
|
33
47
|
"HH": () => String(hours).padStart(2, "0"),
|
|
34
48
|
"H": () => String(hours),
|
|
35
49
|
"mm": () => String(minutes).padStart(2, "0"),
|