@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/parseURL.d.ts
CHANGED
package/parseURL.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseURL = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Solution without DOM or specific env native methods
|
|
6
|
-
*
|
|
7
|
-
* @category location
|
|
8
|
-
* @see https://stackoverflow.com/a/21553982/1938970
|
|
9
|
-
*/
|
|
10
|
-
function parseURL(url) {
|
|
1
|
+
export function parseURL(url) {
|
|
11
2
|
var match = url.match(/^(https?:)\/\/(([^:/?#]*)(?::([0-9]+))?)([/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/);
|
|
12
3
|
return (match && {
|
|
13
4
|
href: url,
|
|
@@ -20,5 +11,4 @@ function parseURL(url) {
|
|
|
20
11
|
hash: match[7],
|
|
21
12
|
});
|
|
22
13
|
}
|
|
23
|
-
|
|
24
|
-
exports.default = parseURL;
|
|
14
|
+
export default parseURL;
|
package/quaranteneProps.d.ts
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @category impl
|
|
3
|
-
* @usage
|
|
4
|
-
*
|
|
5
|
-
* ```ts
|
|
6
|
-
* const { _: { onKeyDown }, myOwnProp, ...rest } = quaranteneProps([
|
|
7
|
-
* "onPointerLeave",
|
|
8
|
-
* "onPointerMove",
|
|
9
|
-
* "onClick",
|
|
10
|
-
* "onPointerDown",
|
|
11
|
-
* "onPointerUp",
|
|
12
|
-
* "onKeyDown",
|
|
13
|
-
* ]);
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
1
|
export declare function quaranteneProps<TProps extends Record<never, never>, TSupectPropsKeys extends QuaranteneProps<TProps>>(props: TProps, propsKeysToQuarantene: TSupectPropsKeys): Omit<TProps, TSupectPropsKeys[number]> & {
|
|
17
2
|
_: Pick<TProps, TSupectPropsKeys[number]>;
|
|
18
3
|
};
|
package/quaranteneProps.js
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.quaranteneProps = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @category impl
|
|
6
|
-
* @usage
|
|
7
|
-
*
|
|
8
|
-
* ```ts
|
|
9
|
-
* const { _: { onKeyDown }, myOwnProp, ...rest } = quaranteneProps([
|
|
10
|
-
* "onPointerLeave",
|
|
11
|
-
* "onPointerMove",
|
|
12
|
-
* "onClick",
|
|
13
|
-
* "onPointerDown",
|
|
14
|
-
* "onPointerUp",
|
|
15
|
-
* "onKeyDown",
|
|
16
|
-
* ]);
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
function quaranteneProps(props, propsKeysToQuarantene) {
|
|
20
|
-
// approach 1)
|
|
1
|
+
export function quaranteneProps(props, propsKeysToQuarantene) {
|
|
21
2
|
var healthyProps = {
|
|
22
3
|
_: {},
|
|
23
4
|
};
|
|
@@ -27,11 +8,9 @@ function quaranteneProps(props, propsKeysToQuarantene) {
|
|
|
27
8
|
healthyProps._[key] = prop;
|
|
28
9
|
}
|
|
29
10
|
else {
|
|
30
|
-
// @ts-expect-error nevermind
|
|
31
11
|
healthyProps[key] = prop;
|
|
32
12
|
}
|
|
33
13
|
}
|
|
34
14
|
return healthyProps;
|
|
35
15
|
}
|
|
36
|
-
|
|
37
|
-
exports.default = quaranteneProps;
|
|
16
|
+
export default quaranteneProps;
|
package/randomInt.d.ts
CHANGED
package/randomInt.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.randomInt = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Get random int (min and max included)
|
|
6
|
-
*
|
|
7
|
-
* @category math
|
|
8
|
-
*/
|
|
9
|
-
function randomInt(min, max) {
|
|
1
|
+
export function randomInt(min, max) {
|
|
10
2
|
return Math.floor(Math.random() * (max - min + 1) + min);
|
|
11
3
|
}
|
|
12
|
-
|
|
13
|
-
exports.default = randomInt;
|
|
4
|
+
export default randomInt;
|
package/randomKey.d.ts
CHANGED
package/randomKey.js
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.randomKey = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Get random key from given object
|
|
6
|
-
*
|
|
7
|
-
* @category misc
|
|
8
|
-
* @see https://stackoverflow.com/a/15106541/1938970
|
|
9
|
-
*/
|
|
10
|
-
function randomKey(obj) {
|
|
1
|
+
export function randomKey(obj) {
|
|
11
2
|
var keys = Object.keys(obj);
|
|
12
3
|
return keys[(keys.length * Math.random()) << 0];
|
|
13
4
|
}
|
|
14
|
-
|
|
15
|
-
exports.default = randomKey;
|
|
5
|
+
export default randomKey;
|
package/readCookie.d.ts
CHANGED
|
File without changes
|
package/readCookie.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.readCookie = void 0;
|
|
4
1
|
function converterRead(value) {
|
|
5
2
|
if (value[0] === '"') {
|
|
6
3
|
value = value.slice(1, -1);
|
|
7
4
|
}
|
|
8
5
|
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
|
|
9
6
|
}
|
|
10
|
-
function readCookie(name) {
|
|
7
|
+
export function readCookie(name) {
|
|
11
8
|
if (typeof document === "undefined") {
|
|
12
|
-
if (process.env["NODE_ENV"]
|
|
9
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
13
10
|
console.warn("[@koine/utils:readCookie] document is undefined");
|
|
14
11
|
}
|
|
15
12
|
return name ? "" : {};
|
|
@@ -27,12 +24,11 @@ function readCookie(name) {
|
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
26
|
catch (e) {
|
|
30
|
-
if (process.env["NODE_ENV"]
|
|
27
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
31
28
|
console.warn("[@koine/utils:readCookie] failed to decode", value);
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
31
|
}
|
|
35
32
|
return name ? all[name] : all;
|
|
36
33
|
}
|
|
37
|
-
|
|
38
|
-
exports.default = readCookie;
|
|
34
|
+
export default readCookie;
|
package/removeAccents.d.ts
CHANGED
package/removeAccents.js
CHANGED
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var accentSets_1 = require("./accentSets");
|
|
5
|
-
/**
|
|
6
|
-
* @category text
|
|
7
|
-
*/
|
|
8
|
-
function removeAccents(text, sets) {
|
|
1
|
+
import { __read } from "tslib";
|
|
2
|
+
import { accentsSets } from "./accentSets.js";
|
|
3
|
+
export function removeAccents(text, sets) {
|
|
9
4
|
if (text === void 0) { text = ""; }
|
|
10
|
-
if (sets === void 0) { sets =
|
|
5
|
+
if (sets === void 0) { sets = accentsSets; }
|
|
11
6
|
var len = sets.length;
|
|
12
7
|
while (len--) {
|
|
13
|
-
var _a = sets[len], to = _a[0], from = _a[1];
|
|
8
|
+
var _a = __read(sets[len], 2), to = _a[0], from = _a[1];
|
|
14
9
|
text = text.replace(new RegExp("[".concat(from, "]"), "gi"), to);
|
|
15
10
|
}
|
|
16
11
|
return text;
|
|
17
12
|
}
|
|
18
|
-
|
|
19
|
-
exports.default = removeAccents;
|
|
13
|
+
export default removeAccents;
|
package/removeCookie.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
import { type CookieAttributesClient } from "./cookie";
|
|
2
|
-
/**
|
|
3
|
-
* @category cookie
|
|
4
|
-
*
|
|
5
|
-
* All cookie related code is inspired and adapted from:
|
|
6
|
-
* - [js-cookie](https://github.com/js-cookie/js-cookie)
|
|
7
|
-
* - [cookie](https://github.com/jshttp/cookie)
|
|
8
|
-
*/
|
|
1
|
+
import { type CookieAttributesClient } from "./cookie.js";
|
|
9
2
|
export declare function removeCookie(name: string, attributes?: CookieAttributesClient): void;
|
|
10
3
|
export default removeCookie;
|
package/removeCookie.js
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var cookie_1 = require("./cookie");
|
|
6
|
-
var setCookie_1 = require("./setCookie");
|
|
7
|
-
/**
|
|
8
|
-
* @category cookie
|
|
9
|
-
*
|
|
10
|
-
* All cookie related code is inspired and adapted from:
|
|
11
|
-
* - [js-cookie](https://github.com/js-cookie/js-cookie)
|
|
12
|
-
* - [cookie](https://github.com/jshttp/cookie)
|
|
13
|
-
*/
|
|
14
|
-
function removeCookie(name, attributes) {
|
|
1
|
+
import { __assign } from "tslib";
|
|
2
|
+
import { defaultAttributesClient } from "./cookie.js";
|
|
3
|
+
import { setCookie } from "./setCookie.js";
|
|
4
|
+
export function removeCookie(name, attributes) {
|
|
15
5
|
if (attributes === void 0) { attributes = {}; }
|
|
16
|
-
|
|
6
|
+
setCookie(name, "", __assign(__assign(__assign({}, defaultAttributesClient), attributes), { expires: -1 }));
|
|
17
7
|
}
|
|
18
|
-
|
|
19
|
-
exports.default = removeCookie;
|
|
8
|
+
export default removeCookie;
|
package/removeDuplicates.d.ts
CHANGED
|
File without changes
|
package/removeDuplicates.js
CHANGED
|
@@ -1,13 +1 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// /**
|
|
3
|
-
// * FIXME: Type 'Set<any>' can only be iterated through when using the
|
|
4
|
-
// * '--downlevelIteration' flag or with a '--target' of 'es2015' or higher.
|
|
5
|
-
// * I am not sure I want to use those ts options here. Let's keep it commented
|
|
6
|
-
// * for now
|
|
7
|
-
// *
|
|
8
|
-
// * @category array
|
|
9
|
-
// */
|
|
10
|
-
// export function removeDuplicates<T extends any[]>(arr: T) {
|
|
11
|
-
// return [...new Set(arr)];
|
|
12
|
-
// }
|
|
13
|
-
// export default removeDuplicates;
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Remove duplicated array objects, equality is determined by a strict (`===`)
|
|
3
|
-
* comparison of each object's given key
|
|
4
|
-
*
|
|
5
|
-
* @category array
|
|
6
|
-
*/
|
|
7
1
|
export declare function removeDuplicatesByKey<T extends Record<string | number | symbol, any>>(array: T[] | undefined, key: keyof T): T[];
|
|
8
2
|
export default removeDuplicatesByKey;
|
package/removeDuplicatesByKey.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeDuplicatesByKey = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Remove duplicated array objects, equality is determined by a strict (`===`)
|
|
6
|
-
* comparison of each object's given key
|
|
7
|
-
*
|
|
8
|
-
* @category array
|
|
9
|
-
*/
|
|
10
|
-
function removeDuplicatesByKey(array, key) {
|
|
1
|
+
export function removeDuplicatesByKey(array, key) {
|
|
11
2
|
if (array === void 0) { array = []; }
|
|
12
3
|
var keysMap = {};
|
|
13
4
|
var output = [];
|
|
@@ -20,5 +11,4 @@ function removeDuplicatesByKey(array, key) {
|
|
|
20
11
|
}
|
|
21
12
|
return output;
|
|
22
13
|
}
|
|
23
|
-
|
|
24
|
-
exports.default = removeDuplicatesByKey;
|
|
14
|
+
export default removeDuplicatesByKey;
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @category array
|
|
8
|
-
*/
|
|
9
|
-
function removeDuplicatesComparing(from, to) {
|
|
10
|
-
var indexes = (0, findDuplicatedIndexes_1.findDuplicatedIndexes)(from);
|
|
11
|
-
return (0, removeIndexesFromArray_1.removeIndexesFromArray)(to, indexes);
|
|
1
|
+
import { findDuplicatedIndexes } from "./findDuplicatedIndexes.js";
|
|
2
|
+
import { removeIndexesFromArray } from "./removeIndexesFromArray.js";
|
|
3
|
+
export function removeDuplicatesComparing(from, to) {
|
|
4
|
+
var indexes = findDuplicatedIndexes(from);
|
|
5
|
+
return removeIndexesFromArray(to, indexes);
|
|
12
6
|
}
|
|
13
|
-
|
|
14
|
-
exports.default = removeDuplicatesComparing;
|
|
7
|
+
export default removeDuplicatesComparing;
|
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeIndexesFromArray = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @category array
|
|
6
|
-
*/
|
|
7
|
-
function removeIndexesFromArray(arr, indexes) {
|
|
1
|
+
export function removeIndexesFromArray(arr, indexes) {
|
|
8
2
|
var output = [];
|
|
9
3
|
for (var i = 0; i < arr.length; i++) {
|
|
10
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
11
4
|
if (!indexes.hasOwnProperty(i)) {
|
|
12
5
|
output.push(arr[i]);
|
|
13
6
|
}
|
|
14
7
|
}
|
|
15
8
|
return output;
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
exports.default = removeIndexesFromArray;
|
|
10
|
+
export default removeIndexesFromArray;
|
package/removeTrailingSlash.d.ts
CHANGED
package/removeTrailingSlash.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.removeTralingSlash = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Strips out the trailing slash
|
|
6
|
-
*
|
|
7
|
-
* @category location
|
|
8
|
-
*/
|
|
9
|
-
function removeTralingSlash(urlLike) {
|
|
1
|
+
export function removeTralingSlash(urlLike) {
|
|
10
2
|
if (urlLike === void 0) { urlLike = ""; }
|
|
11
3
|
return urlLike.replace(/\/*$/, "");
|
|
12
4
|
}
|
|
13
|
-
|
|
14
|
-
exports.default = removeTralingSlash;
|
|
5
|
+
export default removeTralingSlash;
|
package/removeUrlQueryParams.js
CHANGED
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var buildUrlQueryString_1 = tslib_1.__importDefault(require("./buildUrlQueryString"));
|
|
6
|
-
var getUrlQueryParams_1 = tslib_1.__importDefault(require("./getUrlQueryParams"));
|
|
7
|
-
/**
|
|
8
|
-
* Remove the given keys from the given URL query parameters
|
|
9
|
-
*
|
|
10
|
-
* @category location
|
|
11
|
-
* @pure
|
|
12
|
-
*/
|
|
13
|
-
function removeUrlQueryParams(url, paramsToRemove) {
|
|
1
|
+
import buildUrlQueryString from "./buildUrlQueryString.js";
|
|
2
|
+
import getUrlQueryParams from "./getUrlQueryParams.js";
|
|
3
|
+
export function removeUrlQueryParams(url, paramsToRemove) {
|
|
14
4
|
if (paramsToRemove === void 0) { paramsToRemove = []; }
|
|
15
5
|
var parts = url.split("?");
|
|
16
|
-
var allParams = (
|
|
6
|
+
var allParams = getUrlQueryParams(url);
|
|
17
7
|
var params = {};
|
|
18
8
|
for (var key in allParams) {
|
|
19
9
|
if (!paramsToRemove.includes(key)) {
|
|
20
10
|
params[key] = allParams[key];
|
|
21
11
|
}
|
|
22
12
|
}
|
|
23
|
-
return parts[0] + (
|
|
13
|
+
return parts[0] + buildUrlQueryString(params);
|
|
24
14
|
}
|
|
25
|
-
|
|
26
|
-
exports.default = removeUrlQueryParams;
|
|
15
|
+
export default removeUrlQueryParams;
|
package/render.d.ts
CHANGED
|
@@ -8,45 +8,6 @@ type DefinitionExtended = {
|
|
|
8
8
|
type Definitions = {
|
|
9
9
|
[key: string]: DefinitionExtended;
|
|
10
10
|
} & DefinitionExtended;
|
|
11
|
-
/**
|
|
12
|
-
* Returned render function
|
|
13
|
-
*/
|
|
14
11
|
type RenderFunction = (data: object) => string;
|
|
15
|
-
/**
|
|
16
|
-
* Render template (adapted from doT.js)
|
|
17
|
-
*
|
|
18
|
-
* The data made available to the template is always on the `data` key, e.g.:
|
|
19
|
-
* `renderer({ myVal: "xx" })`
|
|
20
|
-
* ... will be accessible on
|
|
21
|
-
* `<%= data.myVal %>`
|
|
22
|
-
*
|
|
23
|
-
* The default delimiters are customised to work without conflicts with Blade and Twig:
|
|
24
|
-
* ```
|
|
25
|
-
* <% %> for evaluation
|
|
26
|
-
* <%= %> for interpolation
|
|
27
|
-
* <%? %> for conditionals
|
|
28
|
-
* <%~ %> for array iteration
|
|
29
|
-
* <%# %> for compile-time evaluation/includes and partials
|
|
30
|
-
* <%## #%> for compile-time defines
|
|
31
|
-
*
|
|
32
|
-
* Unsupported:
|
|
33
|
-
* <%! %> for interpolation with encoding
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
*
|
|
38
|
-
* ```js
|
|
39
|
-
* import { render } from "...";
|
|
40
|
-
*
|
|
41
|
-
* const data = { name: "XYZ" };
|
|
42
|
-
* const tpl = `Hello <%= data.name %>`;
|
|
43
|
-
* const renderer = render(tpl);
|
|
44
|
-
*
|
|
45
|
-
* console.log(renderer(data)); // outputs 'Hello XYZ'
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* @borrows [olado/doT by Laura Doktorova](https://github.com/olado/doT)
|
|
49
|
-
* @see https://olado.github.io/doT/index.html
|
|
50
|
-
*/
|
|
51
12
|
export declare const render: (tmpl: string, def?: Definitions) => RenderFunction;
|
|
52
13
|
export default render;
|
package/render.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.render = void 0;
|
|
4
1
|
var varname = "data";
|
|
5
2
|
var evaluate = /<%([\s\S]+?(\}?)+)%>/g;
|
|
6
3
|
var interpolate = /<%=([\s\S]+?)%>/g;
|
|
7
4
|
var conditional = /<%\?(\?)?\s*([\s\S]*?)\s*%>/g;
|
|
8
5
|
var iterate = /<%~\s*(?:%>|([\s\S]+?)\s*:\s*([\w$]+)\s*(?::\s*([\w$]+))?\s*%>)/g;
|
|
9
|
-
// const encode = /<%!([\s\S]+?)%>/g;
|
|
10
6
|
var use = /<%#([\s\S]+?)%>/g;
|
|
11
7
|
var useParams = /(^|[^\w$])def(?:\.|\[['"])([\w$.]+)(?:['"]\])?\s*:\s*([\w$.]+|"[^"]+"|'[^']+'|\{[^}]+\})/g;
|
|
12
8
|
var define = /<%##\s*([\w.$]+)\s*(:|=)([\s\S]+?)#%>/g;
|
|
13
9
|
var defineParams = /^\s*([\w$]+):([\s\S]+)/;
|
|
14
10
|
var start = "'+(";
|
|
15
11
|
var end = ")+'";
|
|
16
|
-
// const startencode = "'+encodeHTML(";
|
|
17
12
|
var skip = /$^/;
|
|
18
13
|
var resolveDefs = function (block, def) {
|
|
19
14
|
return (typeof block === "string" ? block : block.toString())
|
|
@@ -23,12 +18,9 @@ var resolveDefs = function (block, def) {
|
|
|
23
18
|
}
|
|
24
19
|
if (!(code in def)) {
|
|
25
20
|
if (assign === ":") {
|
|
26
|
-
value.replace(defineParams,
|
|
27
|
-
// @ts-expect-error nevermind
|
|
28
|
-
function (_, param, v) {
|
|
21
|
+
value.replace(defineParams, function (_, param, v) {
|
|
29
22
|
def[code] = { arg: param, text: v };
|
|
30
23
|
});
|
|
31
|
-
// @ts-expect-error nevermind
|
|
32
24
|
if (!(code in def))
|
|
33
25
|
def[code] = value;
|
|
34
26
|
}
|
|
@@ -55,43 +47,7 @@ var resolveDefs = function (block, def) {
|
|
|
55
47
|
var unescape = function (code) {
|
|
56
48
|
return code.replace(/\\('|\\)/g, "$1").replace(/[\r\t\n]/g, " ");
|
|
57
49
|
};
|
|
58
|
-
|
|
59
|
-
* Render template (adapted from doT.js)
|
|
60
|
-
*
|
|
61
|
-
* The data made available to the template is always on the `data` key, e.g.:
|
|
62
|
-
* `renderer({ myVal: "xx" })`
|
|
63
|
-
* ... will be accessible on
|
|
64
|
-
* `<%= data.myVal %>`
|
|
65
|
-
*
|
|
66
|
-
* The default delimiters are customised to work without conflicts with Blade and Twig:
|
|
67
|
-
* ```
|
|
68
|
-
* <% %> for evaluation
|
|
69
|
-
* <%= %> for interpolation
|
|
70
|
-
* <%? %> for conditionals
|
|
71
|
-
* <%~ %> for array iteration
|
|
72
|
-
* <%# %> for compile-time evaluation/includes and partials
|
|
73
|
-
* <%## #%> for compile-time defines
|
|
74
|
-
*
|
|
75
|
-
* Unsupported:
|
|
76
|
-
* <%! %> for interpolation with encoding
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
*
|
|
81
|
-
* ```js
|
|
82
|
-
* import { render } from "...";
|
|
83
|
-
*
|
|
84
|
-
* const data = { name: "XYZ" };
|
|
85
|
-
* const tpl = `Hello <%= data.name %>`;
|
|
86
|
-
* const renderer = render(tpl);
|
|
87
|
-
*
|
|
88
|
-
* console.log(renderer(data)); // outputs 'Hello XYZ'
|
|
89
|
-
* ```
|
|
90
|
-
*
|
|
91
|
-
* @borrows [olado/doT by Laura Doktorova](https://github.com/olado/doT)
|
|
92
|
-
* @see https://olado.github.io/doT/index.html
|
|
93
|
-
*/
|
|
94
|
-
var render = function (tmpl, def) {
|
|
50
|
+
export var render = function (tmpl, def) {
|
|
95
51
|
var sid = 0;
|
|
96
52
|
var indv;
|
|
97
53
|
var str = use || define ? resolveDefs(tmpl, def || {}) : tmpl;
|
|
@@ -101,10 +57,6 @@ var render = function (tmpl, def) {
|
|
|
101
57
|
.replace(/\r|\n|\t|\/\*[\s\S]*?\*\//g, "")
|
|
102
58
|
.replace(/'|\\/g, "\\$&")
|
|
103
59
|
.replace(interpolate || skip, function (_, code) { return start + unescape(code) + end; })
|
|
104
|
-
// .replace(
|
|
105
|
-
// encode || skip,
|
|
106
|
-
// (_, code) => cse.startencode + unescape(code) + cse.end
|
|
107
|
-
// )
|
|
108
60
|
.replace(conditional || skip, function (_, elseCase, code) {
|
|
109
61
|
return elseCase
|
|
110
62
|
? code
|
|
@@ -153,17 +105,15 @@ var render = function (tmpl, def) {
|
|
|
153
105
|
.replace(/\r/g, "\\r")
|
|
154
106
|
.replace(/(\s|;|\}|^|\{)X\+='';/g, "$1")
|
|
155
107
|
.replace(/\+''/g, "");
|
|
156
|
-
//.replace(/(\s|;|\}|^|\{)X\+=''\+/g,'$1X+=');
|
|
157
108
|
try {
|
|
158
109
|
return new Function(varname, str);
|
|
159
110
|
}
|
|
160
111
|
catch (e) {
|
|
161
|
-
if (process.env["NODE_ENV"]
|
|
112
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
162
113
|
console.log("Could not create a template function: " + str);
|
|
163
114
|
throw e;
|
|
164
115
|
}
|
|
165
116
|
}
|
|
166
117
|
return function () { return ""; };
|
|
167
118
|
};
|
|
168
|
-
|
|
169
|
-
exports.default = exports.render;
|
|
119
|
+
export default render;
|
package/round.d.ts
ADDED
package/round.js
ADDED
package/roundTo.d.ts
CHANGED
package/roundTo.js
CHANGED
|
@@ -1,38 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.roundTo = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Round to given number of the given number of decimals
|
|
6
|
-
*
|
|
7
|
-
* @category math
|
|
8
|
-
* @see https://stackoverflow.com/a/15762794/1938970
|
|
9
|
-
*/
|
|
10
|
-
function roundTo(num, decimals) {
|
|
1
|
+
export function roundTo(num, decimals) {
|
|
11
2
|
if (decimals === void 0) { decimals = 2; }
|
|
12
3
|
if (isFinite(num) && !isNaN(num)) {
|
|
13
|
-
// method 1
|
|
14
|
-
// return Number(num).toFixed(decimals);
|
|
15
|
-
// method 2: @see https://stackoverflow.com/a/43532829/1938970
|
|
16
4
|
var multiplicator = Math.pow(10, decimals);
|
|
17
5
|
return Math.round(num * multiplicator) / multiplicator + "";
|
|
18
|
-
// method 3: @see https://stackoverflow.com/a/15762794/1938970
|
|
19
|
-
// let negative = false;
|
|
20
|
-
// if (num < 0) {
|
|
21
|
-
// negative = true;
|
|
22
|
-
// num = num * -1;
|
|
23
|
-
// }
|
|
24
|
-
// const multiplicator = Math.pow(10, decimals);
|
|
25
|
-
// const outputStr = parseFloat((num * multiplicator).toFixed(11));
|
|
26
|
-
// let outputNum = (Math.round(outputStr) / multiplicator).toFixed(decimals);
|
|
27
|
-
// if (negative) {
|
|
28
|
-
// return (Number(outputNum) * -1).toFixed(decimals);
|
|
29
|
-
// }
|
|
30
|
-
// return outputNum;
|
|
31
6
|
}
|
|
32
|
-
if (process.env["NODE_ENV"]
|
|
7
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
33
8
|
console.warn("[@koine/utils] math:roundTo -> given not a finite number as first arg");
|
|
34
9
|
}
|
|
35
10
|
return "";
|
|
36
11
|
}
|
|
37
|
-
|
|
38
|
-
exports.default = roundTo;
|
|
12
|
+
export default roundTo;
|