@koine/utils 2.0.0-beta.2 → 2.0.0-beta.21
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/Defer.d.ts +0 -14
- package/Defer.js +2 -21
- package/Emitter.d.ts +0 -18
- package/Emitter.js +2 -24
- package/accentSets.d.ts +0 -13
- package/accentSets.js +2 -13
- package/addOrReplaceAtIdx.d.ts +0 -3
- package/addOrReplaceAtIdx.js +4 -11
- package/areEqual.d.ts +0 -15
- package/areEqual.js +24 -39
- package/arrayOfAll.d.ts +0 -26
- package/arrayOfAll.js +2 -32
- package/arraySum.d.ts +0 -5
- package/arraySum.js +2 -11
- package/arrayToLookup.d.ts +0 -5
- package/arrayToLookup.js +2 -11
- package/arrayUniqueByProperties.d.ts +2 -0
- package/arrayUniqueByProperties.js +8 -0
- package/buildUrlQueryString.d.ts +1 -10
- package/buildUrlQueryString.js +7 -22
- package/capitalize.d.ts +0 -6
- package/capitalize.js +2 -12
- package/changeUrlPath.d.ts +0 -8
- package/changeUrlPath.js +6 -19
- package/chunkByChunks.d.ts +0 -5
- package/chunkByChunks.js +2 -11
- package/chunkBySize.d.ts +0 -4
- package/chunkBySize.js +2 -10
- package/cjs/Defer.d.ts +6 -0
- package/cjs/Defer.js +15 -0
- package/cjs/Emitter.d.ts +7 -0
- package/{Emitter.mjs → cjs/Emitter.js} +6 -20
- package/cjs/accentSets.d.ts +3 -0
- package/{accentSets.mjs → cjs/accentSets.js} +5 -10
- package/cjs/addOrReplaceAtIdx.d.ts +2 -0
- package/cjs/addOrReplaceAtIdx.js +20 -0
- package/cjs/areEqual.d.ts +4 -0
- package/cjs/areEqual.js +70 -0
- package/cjs/arrayOfAll.d.ts +2 -0
- package/cjs/arrayOfAll.js +10 -0
- package/cjs/arraySum.d.ts +2 -0
- package/cjs/arraySum.js +8 -0
- package/cjs/arrayToLookup.d.ts +2 -0
- package/cjs/arrayToLookup.js +12 -0
- package/cjs/arrayUniqueByProperties.d.ts +2 -0
- package/cjs/arrayUniqueByProperties.js +12 -0
- package/cjs/buildUrlQueryString.d.ts +3 -0
- package/cjs/buildUrlQueryString.js +25 -0
- package/cjs/capitalize.d.ts +2 -0
- package/cjs/capitalize.js +10 -0
- package/cjs/changeUrlPath.d.ts +2 -0
- package/cjs/changeUrlPath.js +14 -0
- package/cjs/chunkByChunks.d.ts +2 -0
- package/{chunkByChunks.mjs → cjs/chunkByChunks.js} +6 -7
- package/cjs/chunkBySize.d.ts +2 -0
- package/cjs/chunkBySize.js +12 -0
- package/cjs/clamp.d.ts +2 -0
- package/cjs/clamp.js +8 -0
- package/cjs/clsx.d.ts +6 -0
- package/{clsx.mjs → cjs/clsx.js} +6 -11
- package/cjs/convertRange.d.ts +2 -0
- package/cjs/convertRange.js +8 -0
- package/cjs/cookie.d.ts +18 -0
- package/cjs/cookie.js +4 -0
- package/cjs/createPalette.d.ts +10 -0
- package/cjs/createPalette.js +16 -0
- package/cjs/debounce.d.ts +2 -0
- package/{debounce.mjs → cjs/debounce.js} +6 -9
- package/cjs/debouncePromise.d.ts +11 -0
- package/cjs/debouncePromise.js +69 -0
- package/cjs/debounceRaf.d.ts +2 -0
- package/cjs/debounceRaf.js +21 -0
- package/cjs/decode.d.ts +2 -0
- package/cjs/decode.js +10 -0
- package/cjs/encode.d.ts +2 -0
- package/cjs/encode.js +10 -0
- package/cjs/ensureInt.d.ts +2 -0
- package/cjs/ensureInt.js +8 -0
- package/cjs/env.d.ts +0 -0
- package/cjs/env.js +1 -0
- package/cjs/errorToString.d.ts +2 -0
- package/cjs/errorToString.js +9 -0
- package/cjs/findDuplicatedIndexes.d.ts +2 -0
- package/cjs/findDuplicatedIndexes.js +15 -0
- package/cjs/forin.d.ts +2 -0
- package/cjs/forin.js +10 -0
- package/cjs/gbToBytes.d.ts +2 -0
- package/cjs/gbToBytes.js +6 -0
- package/cjs/getEmptyArray.d.ts +2 -0
- package/cjs/getEmptyArray.js +12 -0
- package/cjs/getKeys.d.ts +2 -0
- package/cjs/getKeys.js +5 -0
- package/cjs/getMediaQueryWidthResolvers.d.ts +10 -0
- package/{getMediaQueryWidthResolvers.mjs → cjs/getMediaQueryWidthResolvers.js} +8 -32
- package/cjs/getMediaQueryWidthTailwindScreens.d.ts +5 -0
- package/{getMediaQueryWidthTailwindScreens.mjs → cjs/getMediaQueryWidthTailwindScreens.js} +8 -6
- package/cjs/getNonce.d.ts +2 -0
- package/cjs/getNonce.js +9 -0
- package/cjs/getParamAmong.d.ts +2 -0
- package/cjs/getParamAmong.js +11 -0
- package/cjs/getParamAsInt.d.ts +2 -0
- package/cjs/getParamAsInt.js +14 -0
- package/cjs/getParamAsString.d.ts +2 -0
- package/cjs/getParamAsString.js +9 -0
- package/cjs/getType.d.ts +7 -0
- package/cjs/getType.js +8 -0
- package/cjs/getUrlHashParams.d.ts +3 -0
- package/cjs/getUrlHashParams.js +14 -0
- package/cjs/getUrlHashPathname.d.ts +2 -0
- package/cjs/getUrlHashPathname.js +10 -0
- package/cjs/getUrlPathnameParts.d.ts +2 -0
- package/cjs/getUrlPathnameParts.js +14 -0
- package/cjs/getUrlQueryParams.d.ts +3 -0
- package/cjs/getUrlQueryParams.js +29 -0
- package/cjs/imgEmptyPixel.d.ts +2 -0
- package/cjs/imgEmptyPixel.js +5 -0
- package/{index.mjs → cjs/index.d.ts} +15 -8
- package/cjs/index.js +275 -0
- package/cjs/invariant.d.ts +2 -0
- package/cjs/invariant.js +21 -0
- package/cjs/isAnyObject.d.ts +3 -0
- package/cjs/isAnyObject.js +9 -0
- package/cjs/isArray.d.ts +2 -0
- package/cjs/isArray.js +9 -0
- package/cjs/isBlob.d.ts +2 -0
- package/cjs/isBlob.js +9 -0
- package/cjs/isBoolean.d.ts +2 -0
- package/cjs/isBoolean.js +9 -0
- package/cjs/isBrowser.d.ts +2 -0
- package/cjs/isBrowser.js +5 -0
- package/cjs/isBrowserNow.d.ts +2 -0
- package/cjs/isBrowserNow.js +7 -0
- package/cjs/isDate.d.ts +2 -0
- package/cjs/isDate.js +9 -0
- package/cjs/isEmptyArray.d.ts +2 -0
- package/cjs/isEmptyArray.js +9 -0
- package/cjs/isEmptyObject.d.ts +4 -0
- package/cjs/isEmptyObject.js +9 -0
- package/cjs/isEmptyString.d.ts +2 -0
- package/cjs/isEmptyString.js +8 -0
- package/cjs/isError.d.ts +2 -0
- package/cjs/isError.js +9 -0
- package/cjs/isExternalUrl.d.ts +2 -0
- package/cjs/isExternalUrl.js +16 -0
- package/cjs/isFile.d.ts +2 -0
- package/cjs/isFile.js +9 -0
- package/cjs/isFloat.d.ts +2 -0
- package/cjs/isFloat.js +9 -0
- package/cjs/isFormData.d.ts +2 -0
- package/cjs/isFormData.js +9 -0
- package/cjs/isFullArray.d.ts +2 -0
- package/cjs/isFullArray.js +9 -0
- package/cjs/isFullObject.d.ts +3 -0
- package/cjs/isFullObject.js +9 -0
- package/cjs/isFullString.d.ts +2 -0
- package/cjs/isFullString.js +9 -0
- package/cjs/isFunction.d.ts +3 -0
- package/cjs/isFunction.js +8 -0
- package/cjs/isInt.d.ts +2 -0
- package/cjs/isInt.js +9 -0
- package/cjs/isMap.d.ts +2 -0
- package/cjs/isMap.js +9 -0
- package/cjs/isNaNValue.d.ts +2 -0
- package/cjs/isNaNValue.js +9 -0
- package/cjs/isNegativeNumber.d.ts +2 -0
- package/cjs/isNegativeNumber.js +9 -0
- package/cjs/isNull.d.ts +2 -0
- package/cjs/isNull.js +9 -0
- package/cjs/isNullOrUndefined.d.ts +2 -0
- package/cjs/isNullOrUndefined.js +8 -0
- package/cjs/isNumber.d.ts +2 -0
- package/cjs/isNumber.js +9 -0
- package/cjs/isObject.d.ts +3 -0
- package/cjs/isObject.js +9 -0
- package/cjs/isObjectLike.d.ts +3 -0
- package/cjs/isObjectLike.js +9 -0
- package/cjs/isOneOf.d.ts +6 -0
- package/cjs/isOneOf.js +14 -0
- package/cjs/isPlainObject.d.ts +3 -0
- package/cjs/isPlainObject.js +12 -0
- package/cjs/isPositiveNumber.d.ts +2 -0
- package/cjs/isPositiveNumber.js +9 -0
- package/cjs/isPrimitive.d.ts +2 -0
- package/cjs/isPrimitive.js +19 -0
- package/cjs/isPromise.d.ts +2 -0
- package/cjs/isPromise.js +9 -0
- package/cjs/isRegExp.d.ts +2 -0
- package/cjs/isRegExp.js +9 -0
- package/cjs/isServer.d.ts +2 -0
- package/cjs/isServer.js +6 -0
- package/cjs/isServerNow.d.ts +2 -0
- package/cjs/isServerNow.js +7 -0
- package/cjs/isSet.d.ts +2 -0
- package/cjs/isSet.js +9 -0
- package/cjs/isString.d.ts +2 -0
- package/cjs/isString.js +9 -0
- package/cjs/isSymbol.d.ts +2 -0
- package/cjs/isSymbol.js +9 -0
- package/cjs/isType.d.ts +3 -0
- package/cjs/isType.js +17 -0
- package/cjs/isUndefined.d.ts +2 -0
- package/cjs/isUndefined.js +9 -0
- package/cjs/isWeakMap.d.ts +2 -0
- package/cjs/isWeakMap.js +9 -0
- package/cjs/isWeakSet.d.ts +2 -0
- package/cjs/isWeakSet.js +9 -0
- package/cjs/kbToBytes.d.ts +2 -0
- package/cjs/kbToBytes.js +6 -0
- package/cjs/location.d.ts +1 -0
- package/cjs/location.js +2 -0
- package/cjs/lowercase.d.ts +2 -0
- package/cjs/lowercase.js +8 -0
- package/cjs/mapListBy.d.ts +2 -0
- package/cjs/mapListBy.js +13 -0
- package/cjs/matchSorter.d.ts +54 -0
- package/{matchSorter.mjs → cjs/matchSorter.js} +13 -124
- package/cjs/mbToBytes.d.ts +2 -0
- package/cjs/mbToBytes.js +6 -0
- package/cjs/mergeObjects.d.ts +1 -0
- package/cjs/mergeObjects.js +37 -0
- package/cjs/mergeUrlQueryParams.d.ts +3 -0
- package/cjs/mergeUrlQueryParams.js +20 -0
- package/cjs/moveSortableArrayItemByKey.d.ts +2 -0
- package/cjs/moveSortableArrayItemByKey.js +14 -0
- package/cjs/noop.d.ts +2 -0
- package/cjs/noop.js +6 -0
- package/cjs/normaliseUrl.d.ts +2 -0
- package/cjs/normaliseUrl.js +10 -0
- package/cjs/normaliseUrlPathname.d.ts +2 -0
- package/cjs/normaliseUrlPathname.js +10 -0
- package/cjs/objectFlip.d.ts +2 -0
- package/cjs/objectFlip.js +15 -0
- package/cjs/objectOmit.d.ts +2 -0
- package/cjs/objectOmit.js +14 -0
- package/cjs/objectPick.d.ts +2 -0
- package/cjs/objectPick.js +13 -0
- package/cjs/objectToArray.d.ts +2 -0
- package/cjs/objectToArray.js +8 -0
- package/cjs/package.json +6 -0
- package/cjs/parseCookie.d.ts +3 -0
- package/{parseCookie.mjs → cjs/parseCookie.js} +6 -16
- package/cjs/parseURL.d.ts +11 -0
- package/{parseURL.mjs → cjs/parseURL.js} +6 -8
- package/cjs/quaranteneProps.d.ts +7 -0
- package/cjs/quaranteneProps.js +20 -0
- package/cjs/randomInt.d.ts +2 -0
- package/cjs/randomInt.js +8 -0
- package/cjs/randomKey.d.ts +2 -0
- package/cjs/randomKey.js +9 -0
- package/cjs/readCookie.d.ts +3 -0
- package/{readCookie.mjs → cjs/readCookie.js} +8 -4
- package/cjs/removeAccents.d.ts +3 -0
- package/cjs/removeAccents.js +17 -0
- package/cjs/removeCookie.d.ts +3 -0
- package/cjs/removeCookie.js +12 -0
- package/cjs/removeDuplicates.d.ts +0 -0
- package/cjs/removeDuplicates.js +1 -0
- package/cjs/removeDuplicatesByKey.d.ts +2 -0
- package/{removeDuplicatesByKey.mjs → cjs/removeDuplicatesByKey.js} +6 -8
- package/cjs/removeDuplicatesComparing.d.ts +2 -0
- package/cjs/removeDuplicatesComparing.js +11 -0
- package/cjs/removeIndexesFromArray.d.ts +2 -0
- package/cjs/removeIndexesFromArray.js +14 -0
- package/cjs/removeTrailingSlash.d.ts +2 -0
- package/cjs/removeTrailingSlash.js +9 -0
- package/cjs/removeUrlQueryParams.d.ts +2 -0
- package/cjs/removeUrlQueryParams.js +19 -0
- package/cjs/render.d.ts +13 -0
- package/{render.mjs → cjs/render.js} +8 -50
- package/cjs/round.d.ts +3 -0
- package/cjs/round.js +10 -0
- package/cjs/roundTo.d.ts +2 -0
- package/cjs/roundTo.js +16 -0
- package/cjs/serializeCookie.d.ts +3 -0
- package/{serializeCookie.mjs → cjs/serializeCookie.js} +11 -41
- package/cjs/setCookie.d.ts +3 -0
- package/{setCookie.mjs → cjs/setCookie.js} +15 -26
- package/cjs/shuffle.d.ts +2 -0
- package/cjs/shuffle.js +22 -0
- package/cjs/slugify.d.ts +2 -0
- package/cjs/slugify.js +18 -0
- package/cjs/split.d.ts +3 -0
- package/cjs/split.js +6 -0
- package/cjs/swapMap.d.ts +2 -0
- package/cjs/swapMap.js +13 -0
- package/cjs/throttle.d.ts +2 -0
- package/{throttle.mjs → cjs/throttle.js} +8 -10
- package/cjs/titleCase.d.ts +2 -0
- package/cjs/titleCase.js +10 -0
- package/cjs/toNumber.d.ts +2 -0
- package/cjs/toNumber.js +9 -0
- package/cjs/toRgba.d.ts +2 -0
- package/cjs/toRgba.js +13 -0
- package/cjs/transformToUrlPathname.d.ts +2 -0
- package/cjs/transformToUrlPathname.js +11 -0
- package/cjs/truncate.d.ts +2 -0
- package/cjs/truncate.js +12 -0
- package/cjs/tryUntil.d.ts +2 -0
- package/cjs/tryUntil.js +19 -0
- package/cjs/types.d.ts +10 -0
- package/cjs/types.js +2 -0
- package/cjs/uid.d.ts +2 -0
- package/cjs/uid.js +11 -0
- package/cjs/updateLinkParams.d.ts +3 -0
- package/cjs/updateLinkParams.js +11 -0
- package/cjs/updateUrlQueryParams.d.ts +3 -0
- package/cjs/updateUrlQueryParams.js +16 -0
- package/cjs/uppercase.d.ts +2 -0
- package/cjs/uppercase.js +8 -0
- package/cjs/uuid.d.ts +2 -0
- package/{uuid.mjs → cjs/uuid.js} +6 -8
- package/cjs/uuidNumeric.d.ts +2 -0
- package/cjs/uuidNumeric.js +6 -0
- package/cjs/wait.d.ts +2 -0
- package/cjs/wait.js +8 -0
- package/cjs/without.d.ts +0 -0
- package/cjs/without.js +1 -0
- package/clamp.d.ts +0 -6
- package/clamp.js +2 -12
- package/clsx.d.ts +4 -7
- package/clsx.js +2 -15
- package/convertRange.d.ts +0 -12
- package/convertRange.js +2 -18
- package/cookie.d.ts +0 -36
- package/cookie.js +1 -13
- package/createPalette.d.ts +0 -10
- package/createPalette.js +2 -16
- package/debounce.d.ts +0 -6
- package/debounce.js +2 -13
- package/debouncePromise.d.ts +10 -10
- package/debouncePromise.js +65 -12
- package/debounceRaf.d.ts +0 -7
- package/debounceRaf.js +2 -16
- package/decode.d.ts +0 -4
- package/decode.js +2 -10
- package/encode.d.ts +0 -4
- package/encode.js +2 -10
- package/ensureInt.d.ts +0 -5
- package/ensureInt.js +2 -11
- package/env.d.ts +0 -0
- package/env.js +0 -2
- package/errorToString.d.ts +0 -5
- package/errorToString.js +4 -14
- package/findDuplicatedIndexes.d.ts +0 -3
- package/findDuplicatedIndexes.js +2 -9
- package/forin.d.ts +0 -5
- package/forin.js +2 -11
- package/gbToBytes.d.ts +0 -5
- package/gbToBytes.js +2 -11
- package/getEmptyArray.d.ts +0 -7
- package/getEmptyArray.js +4 -16
- package/getKeys.d.ts +0 -7
- package/getKeys.js +2 -12
- package/getMediaQueryWidthResolvers.d.ts +0 -0
- package/getMediaQueryWidthResolvers.js +4 -36
- package/getMediaQueryWidthTailwindScreens.d.ts +1 -1
- package/getMediaQueryWidthTailwindScreens.js +4 -10
- package/getNonce.d.ts +0 -4
- package/getNonce.js +4 -12
- package/getParamAmong.d.ts +0 -10
- package/getParamAmong.js +4 -19
- package/getParamAsInt.d.ts +0 -10
- package/getParamAsInt.js +4 -19
- package/getParamAsString.d.ts +0 -9
- package/getParamAsString.js +4 -18
- package/getType.d.ts +0 -15
- package/getType.js +2 -21
- package/getUrlHashParams.d.ts +1 -7
- package/getUrlHashParams.js +2 -12
- package/getUrlHashPathname.d.ts +0 -7
- package/getUrlHashPathname.js +2 -13
- package/getUrlPathnameParts.d.ts +0 -10
- package/getUrlPathnameParts.js +4 -19
- package/getUrlQueryParams.d.ts +1 -12
- package/getUrlQueryParams.js +4 -22
- package/imgEmptyPixel.d.ts +0 -5
- package/imgEmptyPixel.js +2 -10
- package/index.d.ts +139 -134
- package/index.js +135 -267
- package/invariant.d.ts +0 -17
- package/invariant.js +3 -24
- package/isAnyObject.d.ts +1 -6
- package/isAnyObject.js +4 -14
- package/isArray.d.ts +0 -5
- package/isArray.js +4 -14
- package/isBlob.d.ts +0 -5
- package/isBlob.js +4 -14
- package/isBoolean.d.ts +0 -5
- package/isBoolean.js +4 -14
- package/isBrowser.d.ts +0 -4
- package/isBrowser.js +2 -9
- package/isBrowserNow.d.ts +0 -4
- package/isBrowserNow.js +3 -12
- package/isDate.d.ts +0 -5
- package/isDate.js +4 -14
- package/isEmptyArray.d.ts +0 -5
- package/isEmptyArray.js +4 -14
- package/isEmptyObject.d.ts +0 -5
- package/isEmptyObject.js +4 -14
- package/isEmptyString.d.ts +0 -5
- package/isEmptyString.js +2 -11
- package/isError.d.ts +0 -5
- package/isError.js +4 -14
- package/isExternalUrl.d.ts +0 -7
- package/isExternalUrl.js +4 -18
- package/isFile.d.ts +0 -5
- package/isFile.js +4 -14
- package/isFloat.d.ts +0 -5
- package/isFloat.js +4 -14
- package/isFormData.d.ts +0 -5
- package/isFormData.js +4 -14
- package/isFullArray.d.ts +0 -5
- package/isFullArray.js +4 -14
- package/isFullObject.d.ts +1 -6
- package/isFullObject.js +4 -14
- package/isFullString.d.ts +0 -5
- package/isFullString.js +4 -14
- package/isFunction.d.ts +1 -6
- package/isFunction.js +2 -11
- package/isInt.d.ts +0 -5
- package/isInt.js +4 -14
- package/isMap.d.ts +0 -5
- package/isMap.js +4 -14
- package/isNaNValue.d.ts +0 -5
- package/isNaNValue.js +4 -14
- package/isNegativeNumber.d.ts +0 -5
- package/isNegativeNumber.js +4 -14
- package/isNull.d.ts +0 -5
- package/isNull.js +4 -14
- package/isNullOrUndefined.d.ts +0 -5
- package/isNullOrUndefined.js +5 -14
- package/isNumber.d.ts +0 -7
- package/isNumber.js +4 -16
- package/isObject.d.ts +1 -6
- package/isObject.js +4 -14
- package/isObjectLike.d.ts +1 -8
- package/isObjectLike.js +4 -16
- package/isOneOf.d.ts +1 -4
- package/isOneOf.js +2 -6
- package/isPlainObject.d.ts +1 -6
- package/isPlainObject.js +4 -14
- package/isPositiveNumber.d.ts +0 -5
- package/isPositiveNumber.js +4 -14
- package/isPrimitive.d.ts +0 -5
- package/isPrimitive.js +14 -24
- package/isPromise.d.ts +0 -5
- package/isPromise.js +4 -14
- package/isRegExp.d.ts +0 -5
- package/isRegExp.js +4 -14
- package/isServer.d.ts +0 -4
- package/isServer.js +3 -12
- package/isServerNow.d.ts +0 -4
- package/isServerNow.js +3 -12
- package/isSet.d.ts +0 -5
- package/isSet.js +4 -14
- package/isString.d.ts +0 -5
- package/isString.js +4 -14
- package/isSymbol.d.ts +0 -5
- package/isSymbol.js +4 -14
- package/isType.d.ts +1 -9
- package/isType.js +4 -18
- package/isUndefined.d.ts +0 -5
- package/isUndefined.js +4 -14
- package/isWeakMap.d.ts +0 -5
- package/isWeakMap.js +4 -14
- package/isWeakSet.d.ts +0 -5
- package/isWeakSet.js +4 -14
- package/kbToBytes.d.ts +0 -5
- package/kbToBytes.js +2 -11
- package/location.d.ts +0 -3
- package/location.js +1 -2
- package/lowercase.d.ts +0 -5
- package/lowercase.js +2 -11
- package/mapListBy.d.ts +0 -5
- package/mapListBy.js +2 -11
- package/matchSorter.d.ts +0 -7
- package/matchSorter.js +9 -128
- package/mbToBytes.d.ts +0 -5
- package/mbToBytes.js +2 -11
- package/mergeObjects.d.ts +1 -7
- package/mergeObjects.js +11 -19
- package/mergeUrlQueryParams.d.ts +1 -7
- package/mergeUrlQueryParams.js +4 -15
- package/moveSortableArrayItemByKey.d.ts +0 -7
- package/moveSortableArrayItemByKey.js +5 -16
- package/noop.d.ts +0 -5
- package/noop.js +2 -11
- package/normaliseUrl.d.ts +0 -9
- package/normaliseUrl.js +4 -18
- package/normaliseUrlPathname.d.ts +0 -8
- package/normaliseUrlPathname.js +4 -17
- package/objectFlip.d.ts +2 -0
- package/objectFlip.js +11 -0
- package/objectOmit.d.ts +0 -9
- package/objectOmit.js +2 -15
- package/objectPick.d.ts +0 -6
- package/objectPick.js +2 -12
- package/objectToArray.d.ts +2 -0
- package/objectToArray.js +4 -0
- package/package.json +583 -11
- package/parseCookie.d.ts +1 -9
- package/parseCookie.js +2 -20
- package/parseURL.d.ts +0 -6
- package/parseURL.js +2 -12
- package/quaranteneProps.d.ts +0 -15
- package/quaranteneProps.js +2 -23
- package/randomInt.d.ts +0 -5
- package/randomInt.js +2 -11
- package/randomKey.d.ts +0 -6
- package/randomKey.js +2 -12
- package/readCookie.d.ts +0 -0
- package/readCookie.js +4 -8
- package/removeAccents.d.ts +1 -4
- package/removeAccents.js +6 -12
- package/removeCookie.d.ts +1 -8
- package/removeCookie.js +6 -17
- package/removeDuplicates.d.ts +0 -0
- package/removeDuplicates.js +0 -12
- package/removeDuplicatesByKey.d.ts +0 -6
- package/removeDuplicatesByKey.js +2 -12
- package/removeDuplicatesComparing.d.ts +0 -3
- package/removeDuplicatesComparing.js +6 -13
- package/removeIndexesFromArray.d.ts +0 -3
- package/removeIndexesFromArray.js +2 -10
- package/removeTrailingSlash.d.ts +0 -5
- package/removeTrailingSlash.js +2 -11
- package/removeUrlQueryParams.d.ts +0 -6
- package/removeUrlQueryParams.js +6 -17
- package/render.d.ts +0 -39
- package/render.js +4 -54
- package/round.d.ts +3 -0
- package/round.js +6 -0
- package/roundTo.d.ts +0 -6
- package/roundTo.js +3 -29
- package/serializeCookie.d.ts +1 -25
- package/serializeCookie.js +7 -45
- package/setCookie.d.ts +1 -8
- package/setCookie.js +11 -30
- package/shuffle.d.ts +0 -14
- package/shuffle.js +4 -22
- package/slugify.d.ts +0 -9
- package/slugify.js +11 -24
- package/split.d.ts +1 -1
- package/split.js +2 -8
- package/swapMap.d.ts +0 -5
- package/swapMap.js +2 -11
- package/throttle.d.ts +0 -6
- package/throttle.js +4 -14
- package/titleCase.d.ts +0 -5
- package/titleCase.js +2 -11
- package/toNumber.d.ts +0 -3
- package/toNumber.js +4 -11
- package/toRgba.d.ts +0 -3
- package/toRgba.js +2 -13
- package/transformToUrlPathname.d.ts +0 -9
- package/transformToUrlPathname.js +4 -18
- package/truncate.d.ts +0 -5
- package/truncate.js +2 -11
- package/tryUntil.d.ts +0 -6
- package/tryUntil.js +2 -18
- package/types.d.ts +0 -18
- package/types.js +1 -2
- package/typings.d.ts +1 -6
- package/uid.d.ts +0 -5
- package/uid.js +2 -11
- package/updateLinkParams.d.ts +1 -8
- package/updateLinkParams.js +4 -16
- package/updateUrlQueryParams.d.ts +1 -7
- package/updateUrlQueryParams.js +7 -18
- package/uppercase.d.ts +0 -5
- package/uppercase.js +2 -11
- package/uuid.d.ts +0 -6
- package/uuid.js +2 -12
- package/uuidNumeric.d.ts +0 -4
- package/uuidNumeric.js +2 -10
- package/wait.d.ts +0 -5
- package/wait.js +2 -11
- package/without.d.ts +0 -0
- package/without.js +0 -55
- package/Defer.mjs +0 -26
- package/README.md +0 -42
- package/addOrReplaceAtIdx.mjs +0 -19
- package/areEqual.mjs +0 -77
- package/arrayOfAll.mjs +0 -32
- package/arraySum.mjs +0 -9
- package/arrayToLookup.mjs +0 -13
- package/buildUrlQueryString.mjs +0 -31
- package/capitalize.mjs +0 -12
- package/changeUrlPath.mjs +0 -18
- package/chunkBySize.mjs +0 -12
- package/clamp.mjs +0 -10
- package/convertRange.mjs +0 -16
- package/cookie.mjs +0 -10
- package/createPalette.mjs +0 -22
- package/debouncePromise.mjs +0 -9
- package/debounceRaf.mjs +0 -27
- package/decode.mjs +0 -10
- package/encode.mjs +0 -10
- package/ensureInt.mjs +0 -9
- package/env.mjs +0 -3
- package/errorToString.mjs +0 -10
- package/findDuplicatedIndexes.mjs +0 -14
- package/forin.mjs +0 -11
- package/gbToBytes.mjs +0 -7
- package/getEmptyArray.mjs +0 -15
- package/getKeys.mjs +0 -9
- package/getNonce.mjs +0 -9
- package/getParamAmong.mjs +0 -17
- package/getParamAsInt.mjs +0 -20
- package/getParamAsString.mjs +0 -14
- package/getType.mjs +0 -19
- package/getUrlHashParams.mjs +0 -16
- package/getUrlHashPathname.mjs +0 -13
- package/getUrlPathnameParts.mjs +0 -20
- package/getUrlQueryParams.mjs +0 -38
- package/imgEmptyPixel.mjs +0 -7
- package/invariant.mjs +0 -34
- package/isAnyObject.mjs +0 -10
- package/isArray.mjs +0 -10
- package/isBlob.mjs +0 -10
- package/isBoolean.mjs +0 -10
- package/isBrowser.mjs +0 -6
- package/isBrowserNow.mjs +0 -7
- package/isDate.mjs +0 -10
- package/isEmptyArray.mjs +0 -10
- package/isEmptyObject.mjs +0 -10
- package/isEmptyString.mjs +0 -9
- package/isError.mjs +0 -10
- package/isExternalUrl.mjs +0 -21
- package/isFile.mjs +0 -10
- package/isFloat.mjs +0 -10
- package/isFormData.mjs +0 -10
- package/isFullArray.mjs +0 -10
- package/isFullObject.mjs +0 -10
- package/isFullString.mjs +0 -10
- package/isFunction.mjs +0 -9
- package/isInt.mjs +0 -10
- package/isMap.mjs +0 -10
- package/isNaNValue.mjs +0 -10
- package/isNegativeNumber.mjs +0 -10
- package/isNull.mjs +0 -10
- package/isNullOrUndefined.mjs +0 -10
- package/isNumber.mjs +0 -12
- package/isObject.mjs +0 -10
- package/isObjectLike.mjs +0 -12
- package/isOneOf.mjs +0 -10
- package/isPlainObject.mjs +0 -13
- package/isPositiveNumber.mjs +0 -10
- package/isPrimitive.mjs +0 -20
- package/isPromise.mjs +0 -10
- package/isRegExp.mjs +0 -10
- package/isServer.mjs +0 -8
- package/isServerNow.mjs +0 -7
- package/isSet.mjs +0 -10
- package/isString.mjs +0 -10
- package/isSymbol.mjs +0 -10
- package/isType.mjs +0 -22
- package/isUndefined.mjs +0 -10
- package/isWeakMap.mjs +0 -10
- package/isWeakSet.mjs +0 -10
- package/kbToBytes.mjs +0 -7
- package/location.mjs +0 -1
- package/lowercase.mjs +0 -9
- package/mapListBy.mjs +0 -14
- package/mbToBytes.mjs +0 -7
- package/mergeObjects.mjs +0 -37
- package/mergeUrlQueryParams.mjs +0 -22
- package/moveSortableArrayItemByKey.mjs +0 -17
- package/noop.mjs +0 -7
- package/normaliseUrl.mjs +0 -15
- package/normaliseUrlPathname.mjs +0 -14
- package/objectOmit.mjs +0 -19
- package/objectPick.mjs +0 -15
- package/quaranteneProps.mjs +0 -33
- package/randomInt.mjs +0 -9
- package/randomKey.mjs +0 -11
- package/removeAccents.mjs +0 -15
- package/removeCookie.mjs +0 -15
- package/removeDuplicates.mjs +0 -13
- package/removeDuplicatesComparing.mjs +0 -10
- package/removeIndexesFromArray.mjs +0 -14
- package/removeTrailingSlash.mjs +0 -10
- package/removeUrlQueryParams.mjs +0 -21
- package/roundTo.mjs +0 -34
- package/shuffle.mjs +0 -32
- package/slugify.mjs +0 -23
- package/split.mjs +0 -4
- package/swapMap.mjs +0 -14
- package/titleCase.mjs +0 -11
- package/toNumber.mjs +0 -8
- package/toRgba.mjs +0 -16
- package/transformToUrlPathname.mjs +0 -16
- package/truncate.mjs +0 -13
- package/tryUntil.mjs +0 -27
- package/types.mjs +0 -1
- package/uid.mjs +0 -12
- package/updateLinkParams.mjs +0 -14
- package/updateUrlQueryParams.mjs +0 -18
- package/uppercase.mjs +0 -9
- package/uuidNumeric.mjs +0 -6
- package/wait.mjs +0 -9
- package/without.mjs +0 -56
package/uid.js
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uid = void 0;
|
|
4
1
|
var lastId = 0;
|
|
5
|
-
|
|
6
|
-
* Super basic UID increment-based generator
|
|
7
|
-
*
|
|
8
|
-
* @category uid
|
|
9
|
-
*/
|
|
10
|
-
var uid = function (prefix) {
|
|
2
|
+
export var uid = function (prefix) {
|
|
11
3
|
if (prefix === void 0) { prefix = "id"; }
|
|
12
4
|
lastId++;
|
|
13
5
|
return "".concat(prefix, "-").concat(lastId);
|
|
14
6
|
};
|
|
15
|
-
|
|
16
|
-
exports.default = exports.uid;
|
|
7
|
+
export default uid;
|
package/updateLinkParams.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import { type AnyQueryParams } from "./location";
|
|
2
|
-
/**
|
|
3
|
-
* Update link `<a href="">` merging the given new query parameters.
|
|
4
|
-
* it returns the newly created `href` URL value
|
|
5
|
-
*
|
|
6
|
-
* @category location
|
|
7
|
-
* @pure
|
|
8
|
-
*/
|
|
1
|
+
import { type AnyQueryParams } from "./location.js";
|
|
9
2
|
export declare function updateLinkParams($anchor: HTMLAnchorElement, newParams: NonNullable<AnyQueryParams>): string;
|
|
10
3
|
export default updateLinkParams;
|
package/updateLinkParams.js
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var updateUrlQueryParams_1 = tslib_1.__importDefault(require("./updateUrlQueryParams"));
|
|
6
|
-
/**
|
|
7
|
-
* Update link `<a href="">` merging the given new query parameters.
|
|
8
|
-
* it returns the newly created `href` URL value
|
|
9
|
-
*
|
|
10
|
-
* @category location
|
|
11
|
-
* @pure
|
|
12
|
-
*/
|
|
13
|
-
function updateLinkParams($anchor, newParams) {
|
|
14
|
-
var href = (0, updateUrlQueryParams_1.default)($anchor.href, newParams);
|
|
1
|
+
import updateUrlQueryParams from "./updateUrlQueryParams.js";
|
|
2
|
+
export function updateLinkParams($anchor, newParams) {
|
|
3
|
+
var href = updateUrlQueryParams($anchor.href, newParams);
|
|
15
4
|
$anchor.href = href;
|
|
16
5
|
return href;
|
|
17
6
|
}
|
|
18
|
-
|
|
19
|
-
exports.default = updateLinkParams;
|
|
7
|
+
export default updateLinkParams;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { type AnyQueryParams } from "./location";
|
|
2
|
-
/**
|
|
3
|
-
* Update a URL string query parameters merging the given new query parameters
|
|
4
|
-
*
|
|
5
|
-
* @category location
|
|
6
|
-
* @pure
|
|
7
|
-
*/
|
|
1
|
+
import { type AnyQueryParams } from "./location.js";
|
|
8
2
|
export declare function updateUrlQueryParams(url: string, newParams?: NonNullable<AnyQueryParams>): string;
|
|
9
3
|
export default updateUrlQueryParams;
|
package/updateUrlQueryParams.js
CHANGED
|
@@ -1,23 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var buildUrlQueryString_1 = tslib_1.__importDefault(require("./buildUrlQueryString"));
|
|
6
|
-
var getUrlQueryParams_1 = tslib_1.__importDefault(require("./getUrlQueryParams"));
|
|
7
|
-
var mergeUrlQueryParams_1 = tslib_1.__importDefault(require("./mergeUrlQueryParams"));
|
|
8
|
-
/**
|
|
9
|
-
* Update a URL string query parameters merging the given new query parameters
|
|
10
|
-
*
|
|
11
|
-
* @category location
|
|
12
|
-
* @pure
|
|
13
|
-
*/
|
|
14
|
-
function updateUrlQueryParams(url, newParams) {
|
|
1
|
+
import buildUrlQueryString from "./buildUrlQueryString.js";
|
|
2
|
+
import getUrlQueryParams from "./getUrlQueryParams.js";
|
|
3
|
+
import mergeUrlQueryParams from "./mergeUrlQueryParams.js";
|
|
4
|
+
export function updateUrlQueryParams(url, newParams) {
|
|
15
5
|
if (newParams === void 0) { newParams = {}; }
|
|
16
6
|
var parts = url.split("?");
|
|
17
7
|
var allParams = parts[1]
|
|
18
|
-
? (
|
|
8
|
+
? mergeUrlQueryParams(getUrlQueryParams(url), newParams)
|
|
19
9
|
: newParams;
|
|
20
|
-
return parts[0] + (
|
|
10
|
+
return parts[0] + buildUrlQueryString(allParams);
|
|
21
11
|
}
|
|
22
|
-
|
|
23
|
-
exports.default = updateUrlQueryParams;
|
|
12
|
+
export default updateUrlQueryParams;
|
package/uppercase.d.ts
CHANGED
package/uppercase.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uppercase = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Replacement for native `toUpperCase` tyescript ready (type narrowing ready)
|
|
6
|
-
*
|
|
7
|
-
* @category native
|
|
8
|
-
*/
|
|
9
|
-
var uppercase = function (str) {
|
|
1
|
+
export var uppercase = function (str) {
|
|
10
2
|
return (str || "").toUpperCase();
|
|
11
3
|
};
|
|
12
|
-
|
|
13
|
-
exports.default = exports.uppercase;
|
|
4
|
+
export default uppercase;
|
package/uuid.d.ts
CHANGED
package/uuid.js
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.uuid = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Uuid, tiny custom helper instead of node's uuid/v4
|
|
6
|
-
*
|
|
7
|
-
* @category uid
|
|
8
|
-
* @see https://stackoverflow.com/a/2117523/1938970
|
|
9
|
-
*/
|
|
10
|
-
var uuid = function () {
|
|
1
|
+
export var uuid = function () {
|
|
11
2
|
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
|
12
3
|
var r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8;
|
|
13
4
|
return v.toString(16);
|
|
14
5
|
});
|
|
15
6
|
};
|
|
16
|
-
|
|
17
|
-
exports.default = exports.uuid;
|
|
7
|
+
export default uuid;
|
package/uuidNumeric.d.ts
CHANGED
package/uuidNumeric.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.uuidNumeric = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @category uid
|
|
6
|
-
* @see https://stackoverflow.com/a/18048162/1938970
|
|
7
|
-
*/
|
|
8
|
-
var uuidNumeric = function () { return new Date().valueOf(); };
|
|
9
|
-
exports.uuidNumeric = uuidNumeric;
|
|
10
|
-
exports.default = exports.uuidNumeric;
|
|
1
|
+
export var uuidNumeric = function () { return new Date().valueOf(); };
|
|
2
|
+
export default uuidNumeric;
|
package/wait.d.ts
CHANGED
package/wait.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.wait = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* A promisified `setTimeout`
|
|
6
|
-
*
|
|
7
|
-
* @category async
|
|
8
|
-
*/
|
|
9
|
-
var wait = function (milliseconds) {
|
|
1
|
+
export var wait = function (milliseconds) {
|
|
10
2
|
return new Promise(function (resolve) { return setTimeout(resolve, milliseconds); });
|
|
11
3
|
};
|
|
12
|
-
|
|
13
|
-
exports.default = exports.wait;
|
|
4
|
+
export default wait;
|
package/without.d.ts
CHANGED
|
File without changes
|
package/without.js
CHANGED
|
@@ -1,56 +1 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
3
|
-
// TODO: finish this up, this is not exported yet
|
|
4
|
-
// ready to copy-paste to https://www.typescriptlang.org/play
|
|
5
|
-
// type EmptyObject = Record<string, never>;
|
|
6
|
-
// type EmptyArray = never[];
|
|
7
|
-
// type EmptyString = "";
|
|
8
|
-
// type WithoutEmptyObject<T> = T extends EmptyObject ? never : T;
|
|
9
|
-
// type WithoutEmptyArray<T> = T extends EmptyArray ? never : T;
|
|
10
|
-
// type WithoutEmptyString<T> = T extends EmptyString ? never : T;
|
|
11
|
-
// type WithoutEmpty<T> = T extends EmptyObject | EmptyArray | EmptyString | null | undefined ? never : T;
|
|
12
|
-
// function withoutEmptyObject<T>(arg: WithoutEmptyObject<T>) {
|
|
13
|
-
// return arg;
|
|
14
|
-
// }
|
|
15
|
-
// function withoutEmptyArray<T>(arg: WithoutEmptyArray<T>) {
|
|
16
|
-
// return arg;
|
|
17
|
-
// }
|
|
18
|
-
// function withoutEmptyString<T>(arg: WithoutEmptyString<T>) {
|
|
19
|
-
// return arg;
|
|
20
|
-
// }
|
|
21
|
-
// function withoutEmpty<T>(arg: WithoutEmpty<T>) {
|
|
22
|
-
// return arg;
|
|
23
|
-
// }
|
|
24
|
-
// // @ts-expect-error
|
|
25
|
-
// const o1 = withoutEmptyObject({});
|
|
26
|
-
// // ^?
|
|
27
|
-
// const o2 = withoutEmptyObject({ accepted: 1 });
|
|
28
|
-
// // @ts-expect-error
|
|
29
|
-
// const a1 = withoutEmptyArray([]);
|
|
30
|
-
// // ^?
|
|
31
|
-
// const a2 = withoutEmptyArray(["accepted"]);
|
|
32
|
-
// // ^?
|
|
33
|
-
// const a3 = withoutEmptyArray("accepted");
|
|
34
|
-
// // ^?
|
|
35
|
-
// const a4 = withoutEmptyArray("accepted" === "accepted");
|
|
36
|
-
// // ^?
|
|
37
|
-
// // @ts-expect-error
|
|
38
|
-
// const s1 = withoutEmptyString("");
|
|
39
|
-
// // ^?
|
|
40
|
-
// const s2 = withoutEmptyString("accepted");
|
|
41
|
-
// // ^?
|
|
42
|
-
// // @ts-expect-error
|
|
43
|
-
// const w1 = withoutEmpty("");
|
|
44
|
-
// // ^?
|
|
45
|
-
// // @ts-expect-error
|
|
46
|
-
// const w2 = withoutEmpty(undefined);
|
|
47
|
-
// // ^?
|
|
48
|
-
// // @ts-expect-error
|
|
49
|
-
// const w3 = withoutEmpty(null);
|
|
50
|
-
// // ^?
|
|
51
|
-
// // @ts-expect-error
|
|
52
|
-
// const w4 = withoutEmpty({});
|
|
53
|
-
// // ^?
|
|
54
|
-
// // @ts-expect-error
|
|
55
|
-
// const w5 = withoutEmpty([]);
|
|
56
|
-
// // ^?
|
package/Defer.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @category async
|
|
3
|
-
* @see https://stackoverflow.com/a/37673534/1938970
|
|
4
|
-
* @example
|
|
5
|
-
*
|
|
6
|
-
* ```ts
|
|
7
|
-
* const deferred = Defer();
|
|
8
|
-
* deferred.resolve();
|
|
9
|
-
* deferred.then(handleSuccess, handleError);
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
export function Defer() {
|
|
13
|
-
// @ts-expect-error nevermind
|
|
14
|
-
var self = this || {};
|
|
15
|
-
var p = (self.promise = new Promise(function (resolve, reject) {
|
|
16
|
-
self.resolve = resolve;
|
|
17
|
-
self.reject = reject;
|
|
18
|
-
}));
|
|
19
|
-
self.then = p.then.bind(p);
|
|
20
|
-
self.catch = p.catch.bind(p);
|
|
21
|
-
// if (p.finally) {
|
|
22
|
-
// self.finally = p.finally.bind(p);
|
|
23
|
-
// }
|
|
24
|
-
return self;
|
|
25
|
-
}
|
|
26
|
-
export default Defer;
|
package/README.md
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# @koine/utils
|
|
2
|
-
|
|
3
|
-
Libraries to encapsulate and re-export from here, the selection is based on:
|
|
4
|
-
|
|
5
|
-
- [x] full typescript support
|
|
6
|
-
- [x] treeshake-ability
|
|
7
|
-
- [x] docs in source comments
|
|
8
|
-
|
|
9
|
-
- [dhmk-utils](https://github.com/dhmk083/dhmk-utils)
|
|
10
|
-
- [mesqueeb/merge-anything](https://github.com/mesqueeb/merge-anything)
|
|
11
|
-
- [mesqueeb/filter-anything](https://github.com/mesqueeb/filter-anything)
|
|
12
|
-
- [mesqueeb/case-anything](https://github.com/mesqueeb/case-anything)
|
|
13
|
-
- [mesqueeb/nestify-anything](https://github.com/mesqueeb/nestify-anything)
|
|
14
|
-
- [mesqueeb/fast-sort (fork)](https://github.com/mesqueeb/fast-sort (fork))
|
|
15
|
-
- [mesqueeb/compare-anything](https://github.com/mesqueeb/compare-anything)
|
|
16
|
-
- [mesqueeb/copy-anything](https://github.com/mesqueeb/copy-anything)
|
|
17
|
-
- [mesqueeb/flatten-anything](https://github.com/mesqueeb/flatten-anything)
|
|
18
|
-
|
|
19
|
-
About ts utilities types @see:
|
|
20
|
-
|
|
21
|
-
- [sindresorhus/type-fest](https://github.com/sindresorhus/type-fest)
|
|
22
|
-
- [millsp/ts-toolbelt](https://github.com/millsp/ts-toolbelt)
|
|
23
|
-
- [ts-essentials](https://github.com/ts-essentials/ts-essentials)
|
|
24
|
-
|
|
25
|
-
For inspiration look at [1loc.dev](https://1loc.dev).
|
|
26
|
-
|
|
27
|
-
About utilities useful examples @see:
|
|
28
|
-
|
|
29
|
-
- [chakra-ui](https://github.com/chakra-ui/chakra-ui/blob/main/packages/utils/src)
|
|
30
|
-
|
|
31
|
-
TODO: We could also re-exports direct dependencies of packages that we often use
|
|
32
|
-
anyway like [those of `yup`](https://github.com/jquense/yup/blob/master/package.json#L103):
|
|
33
|
-
|
|
34
|
-
- [tiny-case](https://github.com/jquense/tiny-case)
|
|
35
|
-
- [property-expr](https://github.com/jquense/expr/blob/master/index.js)
|
|
36
|
-
- [toposort](https://github.com/marcelklehr/toposort)
|
|
37
|
-
|
|
38
|
-
TODO: check typescript utilities in [TypeScript core](https://github.com/microsoft/TypeScript/blob/main/src/compiler/core.ts)
|
|
39
|
-
|
|
40
|
-
## Code
|
|
41
|
-
|
|
42
|
-
- Transformative functions like `truncate` or `titleCase` should allow for nullable inputs as much as possible, acceptin both `undefined` and `null`.
|
package/addOrReplaceAtIdx.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { __spreadArray } from "tslib";
|
|
2
|
-
/**
|
|
3
|
-
* @category array
|
|
4
|
-
*/
|
|
5
|
-
export function addOrReplaceAtIdx(list, newItem, newIdx) {
|
|
6
|
-
if (list.length === 0) {
|
|
7
|
-
return [newItem];
|
|
8
|
-
}
|
|
9
|
-
if (typeof newIdx === "undefined" || list.length - 1 < newIdx) {
|
|
10
|
-
return __spreadArray(__spreadArray([], list, true), [newItem], false);
|
|
11
|
-
}
|
|
12
|
-
return list.map(function (item, idx) {
|
|
13
|
-
if (idx === newIdx) {
|
|
14
|
-
return newItem;
|
|
15
|
-
}
|
|
16
|
-
return item;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
export default addOrReplaceAtIdx;
|
package/areEqual.mjs
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { isArray } from "./isArray";
|
|
2
|
-
import { isObject } from "./isObject";
|
|
3
|
-
function areEqualArrays(a, b) {
|
|
4
|
-
if (!b)
|
|
5
|
-
return false;
|
|
6
|
-
if (a.length !== b.length)
|
|
7
|
-
return false;
|
|
8
|
-
for (var i = 0; i < a.length; i++) {
|
|
9
|
-
var aValue = a[i];
|
|
10
|
-
var bValue = b[i];
|
|
11
|
-
if (!areEqual(aValue, bValue))
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
return true;
|
|
15
|
-
}
|
|
16
|
-
function areEqualObjects(a, b) {
|
|
17
|
-
if (!b)
|
|
18
|
-
return false;
|
|
19
|
-
var aKeys = Object.keys(a);
|
|
20
|
-
var bKeys = Object.keys(b);
|
|
21
|
-
if (aKeys.length !== bKeys.length) {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
for (var _i = 0, aKeys_1 = aKeys; _i < aKeys_1.length; _i++) {
|
|
25
|
-
var _key = aKeys_1[_i];
|
|
26
|
-
var key = _key;
|
|
27
|
-
var aValue = a[key];
|
|
28
|
-
var bValue = b[key];
|
|
29
|
-
if (!areEqual(aValue, bValue)) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* A simple and quick deep equal objects utility. This is meant to be used
|
|
37
|
-
* solely to deduplicate requests payload and perform comparison on JSON ready
|
|
38
|
-
* objects made of primitives `string`, `number` and `boolean`s.
|
|
39
|
-
*
|
|
40
|
-
* It support nested `object`s and `array`s only.
|
|
41
|
-
*
|
|
42
|
-
* NB: `undefined` and `null` values do not count in the comparison as they are
|
|
43
|
-
* usually meant to be ignored in JSON requestBody payloads.
|
|
44
|
-
*
|
|
45
|
-
* According to very rudimentary tests this function takes on average between
|
|
46
|
-
* 0.15 ms and 2ms to compare two averaged sizes requet body payloads.
|
|
47
|
-
*
|
|
48
|
-
* @category objects
|
|
49
|
-
*/
|
|
50
|
-
export function areEqual(a, b) {
|
|
51
|
-
if (!a && !b) {
|
|
52
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
// const t0 = performance.now();
|
|
56
|
-
if (!b && a !== b) {
|
|
57
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
var areObjects = isObject(a) && isObject(b);
|
|
61
|
-
if (areObjects && !areEqualObjects(a, b)) {
|
|
62
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
var areArrays = isArray(a) && isArray(b);
|
|
66
|
-
if (areArrays && !areEqualArrays(a, b)) {
|
|
67
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
if (!areObjects && !areArrays && a !== b) {
|
|
71
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
// console.log(`areEqual took ${performance.now() - t0} ms`);
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
77
|
-
export default areEqual;
|
package/arrayOfAll.mjs
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ensure an array contains all desired values
|
|
3
|
-
*
|
|
4
|
-
* @category array
|
|
5
|
-
* @borrows [SO comment by `CertainPerformance`](https://stackoverflow.com/a/60132060/1938970)
|
|
6
|
-
*
|
|
7
|
-
* @usage
|
|
8
|
-
*
|
|
9
|
-
* ```
|
|
10
|
-
* type Fruit = "pear" | "apple" | "orange";
|
|
11
|
-
*
|
|
12
|
-
* const arrayOfAllFruits = arrayOfAll<Fruit>();
|
|
13
|
-
*
|
|
14
|
-
* const allFruits = arrayOfAllFruits([
|
|
15
|
-
* "pear",
|
|
16
|
-
* "apple",
|
|
17
|
-
* "orange"
|
|
18
|
-
* ]); // ts compiler ok
|
|
19
|
-
*
|
|
20
|
-
* const allFruits = arrayOfAllFruits([
|
|
21
|
-
* "pear",
|
|
22
|
-
* "apple",
|
|
23
|
-
* ]); // ts compiler fails
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
*/
|
|
27
|
-
export var arrayOfAll = function () {
|
|
28
|
-
return function (array) {
|
|
29
|
-
return array;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export default arrayOfAll;
|
package/arraySum.mjs
DELETED
package/arrayToLookup.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maps a simple flat array to a lookup dictionary object
|
|
3
|
-
*
|
|
4
|
-
* @category array
|
|
5
|
-
*/
|
|
6
|
-
export function arrayToLookup(array) {
|
|
7
|
-
if (array === void 0) { array = []; }
|
|
8
|
-
return array.reduce(function (obj, item) {
|
|
9
|
-
obj[item] = 1;
|
|
10
|
-
return obj;
|
|
11
|
-
}, {});
|
|
12
|
-
}
|
|
13
|
-
export default arrayToLookup;
|
package/buildUrlQueryString.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import isNull from "./isNull";
|
|
2
|
-
import isUndefined from "./isUndefined";
|
|
3
|
-
import isArray from "./isArray";
|
|
4
|
-
/**
|
|
5
|
-
* Get clean query string for URL
|
|
6
|
-
*
|
|
7
|
-
* It returns the query string **with** the initial `?`
|
|
8
|
-
*
|
|
9
|
-
* TODO: at some point replace with `URLSearchParams`, @see [caniuse](https://caniuse.com/?search=URLSearchParams)
|
|
10
|
-
*
|
|
11
|
-
* @category location
|
|
12
|
-
*/
|
|
13
|
-
export function buildUrlQueryString(params) {
|
|
14
|
-
var output = "";
|
|
15
|
-
if (!params)
|
|
16
|
-
return output;
|
|
17
|
-
for (var key in params) {
|
|
18
|
-
var value = params[key];
|
|
19
|
-
if (isArray(value)) {
|
|
20
|
-
for (var i = 0; i < value.length; i++) {
|
|
21
|
-
output += "".concat(key, "=").concat(encodeURIComponent(value[i] + ""), "&");
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
else if (!isNull(value) && !isUndefined(value)) {
|
|
25
|
-
output += "".concat(key, "=").concat(encodeURIComponent(value + ""), "&");
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
// removes the last &
|
|
29
|
-
return output ? "?".concat(output.replace(/&+$/, "")) : "";
|
|
30
|
-
}
|
|
31
|
-
export default buildUrlQueryString;
|
package/capitalize.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Capitalize first letter of the given string.
|
|
3
|
-
*
|
|
4
|
-
* @category text
|
|
5
|
-
* @see https://stackoverflow.com/a/11409944/1938970
|
|
6
|
-
*/
|
|
7
|
-
export function capitalize(string) {
|
|
8
|
-
var ensuredString = string || "";
|
|
9
|
-
return (ensuredString.charAt(0).toUpperCase() +
|
|
10
|
-
ensuredString.slice(1));
|
|
11
|
-
}
|
|
12
|
-
export default capitalize;
|
package/changeUrlPath.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import isBrowser from "./isBrowser";
|
|
2
|
-
import normaliseUrlPathname from "./normaliseUrlPathname";
|
|
3
|
-
/**
|
|
4
|
-
* Change URL path, ensures initial and ending slashes and normalise eventual
|
|
5
|
-
* consecutive slashes, it uses `history`.
|
|
6
|
-
*
|
|
7
|
-
* @category location
|
|
8
|
-
* @param replace Replace URL instead of pushing it in the history stack. By default it pushes it.
|
|
9
|
-
* @returns {string} The new cleaned pathname
|
|
10
|
-
*/
|
|
11
|
-
export function changeUrlPath(pathname, state, replace) {
|
|
12
|
-
var path = normaliseUrlPathname("/".concat(pathname, "/"));
|
|
13
|
-
if (isBrowser) {
|
|
14
|
-
history[replace ? "replaceState" : "pushState"](state, "", path);
|
|
15
|
-
}
|
|
16
|
-
return path;
|
|
17
|
-
}
|
|
18
|
-
export default changeUrlPath;
|
package/chunkBySize.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @category array
|
|
3
|
-
* @see https://stackoverflow.com/a/40682136/1938970
|
|
4
|
-
*/
|
|
5
|
-
export function chunkBySize(arr, size) {
|
|
6
|
-
var output = [];
|
|
7
|
-
for (var i = 0; i < arr.length; i += size) {
|
|
8
|
-
output.push(arr.slice(i, i + size));
|
|
9
|
-
}
|
|
10
|
-
return output;
|
|
11
|
-
}
|
|
12
|
-
export default chunkBySize;
|
package/clamp.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a number whose value is limited to the given range.
|
|
3
|
-
*
|
|
4
|
-
* @category math
|
|
5
|
-
* @see https://stackoverflow.com/a/11409944/1938970
|
|
6
|
-
*/
|
|
7
|
-
export function clamp(num, min, max) {
|
|
8
|
-
return Math.min(Math.max(num, min), max);
|
|
9
|
-
}
|
|
10
|
-
export default clamp;
|
package/convertRange.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Convert range of a number
|
|
3
|
-
*
|
|
4
|
-
* e.g. converting number 5 in a scale/range from 0 10 to a scale/range from 50
|
|
5
|
-
* to 100 would return 75
|
|
6
|
-
* ```
|
|
7
|
-
* convertRange(5, [0, 10], [50, 100]);
|
|
8
|
-
* ```
|
|
9
|
-
*
|
|
10
|
-
* @category math
|
|
11
|
-
* @see https://stackoverflow.com/a/14224813
|
|
12
|
-
*/
|
|
13
|
-
export function convertRange(num, r1, r2) {
|
|
14
|
-
return ((num - r1[0]) * (r2[1] - r2[0])) / (r1[1] - r1[0]) + r2[0];
|
|
15
|
-
}
|
|
16
|
-
export default convertRange;
|
package/cookie.mjs
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file
|
|
3
|
-
*
|
|
4
|
-
* @category cookie
|
|
5
|
-
*
|
|
6
|
-
* All cookie related code is inspired and adapted from:
|
|
7
|
-
* - [js-cookie](https://github.com/js-cookie/js-cookie)
|
|
8
|
-
* - [cookie](https://github.com/jshttp/cookie)
|
|
9
|
-
*/
|
|
10
|
-
export var defaultAttributesClient = { path: "/" };
|
package/createPalette.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Create palette, this is primarily thought to improve the reuse of a palette
|
|
3
|
-
* definition between TailwindCSS and straight ES imports
|
|
4
|
-
*
|
|
5
|
-
* @category styling|tailwind|colours
|
|
6
|
-
*
|
|
7
|
-
* @returns An array with: 1) A flat palette map 2) A TailwindCSS ready palette
|
|
8
|
-
* object 3) A flat array of colors (no special sorting, same order as the `shades`
|
|
9
|
-
* given as argument)
|
|
10
|
-
*/
|
|
11
|
-
export var createPalette = function (name, shades) {
|
|
12
|
-
var map = shades.reduce(function (map, def) {
|
|
13
|
-
map[def[0]] = def[1];
|
|
14
|
-
return map;
|
|
15
|
-
}, {});
|
|
16
|
-
var tailwindPalette = shades.reduce(function (map, def) {
|
|
17
|
-
map["".concat(name, "-").concat(def[0])] = def[1];
|
|
18
|
-
return map;
|
|
19
|
-
}, {});
|
|
20
|
-
return [map, tailwindPalette, Object.values(map)];
|
|
21
|
-
};
|
|
22
|
-
export default createPalette;
|
package/debouncePromise.mjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { debounce as tsDebounce } from "ts-debounce";
|
|
2
|
-
/**
|
|
3
|
-
* Debounce function (with `Promise`)
|
|
4
|
-
*
|
|
5
|
-
* @category function
|
|
6
|
-
* @borrows [chodorowicz/ts-debounce](https://github.com/chodorowicz/ts-debounce)
|
|
7
|
-
*/
|
|
8
|
-
export var debouncePromise = tsDebounce;
|
|
9
|
-
export default debouncePromise;
|