@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/serializeCookie.d.ts
CHANGED
|
@@ -1,27 +1,3 @@
|
|
|
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
|
-
import { type CookieAttributesServer } from "./cookie";
|
|
11
|
-
/**
|
|
12
|
-
* Serialize data into a cookie header.
|
|
13
|
-
*
|
|
14
|
-
* Serialize the a name value pair into a cookie string suitable for
|
|
15
|
-
* http headers. An optional attributes object specified cookie parameters.
|
|
16
|
-
*
|
|
17
|
-
* serialize('foo', 'bar', { httpOnly: true })
|
|
18
|
-
* => "foo=bar; httpOnly"
|
|
19
|
-
*
|
|
20
|
-
* @category cookie
|
|
21
|
-
*
|
|
22
|
-
* All cookie related code is inspired and adapted from:
|
|
23
|
-
* - [js-cookie](https://github.com/js-cookie/js-cookie)
|
|
24
|
-
* - [cookie](https://github.com/jshttp/cookie)
|
|
25
|
-
*/
|
|
1
|
+
import { type CookieAttributesServer } from "./cookie.js";
|
|
26
2
|
export declare function serializeCookie(name: string, val: string, attributes?: CookieAttributesServer): string;
|
|
27
3
|
export default serializeCookie;
|
package/serializeCookie.js
CHANGED
|
@@ -1,46 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @file
|
|
4
|
-
*
|
|
5
|
-
* @category cookie
|
|
6
|
-
*
|
|
7
|
-
* All cookie related code is inspired and adapted from:
|
|
8
|
-
* - [js-cookie](https://github.com/js-cookie/js-cookie)
|
|
9
|
-
* - [cookie](https://github.com/jshttp/cookie)
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.serializeCookie = void 0;
|
|
13
|
-
var isNumber_1 = require("./isNumber");
|
|
14
|
-
/**
|
|
15
|
-
* RegExp to match field-content in RFC 7230 sec 3.2
|
|
16
|
-
*
|
|
17
|
-
* field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ]
|
|
18
|
-
* field-vchar = VCHAR / obs-text
|
|
19
|
-
* obs-text = %x80-FF
|
|
20
|
-
*/
|
|
21
|
-
// eslint-disable-next-line no-control-regex
|
|
1
|
+
import { isNumber } from "./isNumber.js";
|
|
22
2
|
var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
|
|
23
|
-
|
|
24
|
-
* Serialize data into a cookie header.
|
|
25
|
-
*
|
|
26
|
-
* Serialize the a name value pair into a cookie string suitable for
|
|
27
|
-
* http headers. An optional attributes object specified cookie parameters.
|
|
28
|
-
*
|
|
29
|
-
* serialize('foo', 'bar', { httpOnly: true })
|
|
30
|
-
* => "foo=bar; httpOnly"
|
|
31
|
-
*
|
|
32
|
-
* @category cookie
|
|
33
|
-
*
|
|
34
|
-
* All cookie related code is inspired and adapted from:
|
|
35
|
-
* - [js-cookie](https://github.com/js-cookie/js-cookie)
|
|
36
|
-
* - [cookie](https://github.com/jshttp/cookie)
|
|
37
|
-
*/
|
|
38
|
-
function serializeCookie(name, val, attributes) {
|
|
3
|
+
export function serializeCookie(name, val, attributes) {
|
|
39
4
|
if (attributes === void 0) { attributes = {}; }
|
|
40
5
|
var _a = attributes.encode, encode = _a === void 0 ? encodeURIComponent : _a, domain = attributes.domain, path = attributes.path, httpOnly = attributes.httpOnly, secure = attributes.secure, sameSite = attributes.sameSite;
|
|
41
6
|
var maxAge = attributes.maxAge, expires = attributes.expires;
|
|
42
7
|
var value = encode(val);
|
|
43
|
-
if (process.env["NODE_ENV"]
|
|
8
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
44
9
|
if (!fieldContentRegExp.test(name)) {
|
|
45
10
|
throw new TypeError("argument name is invalid");
|
|
46
11
|
}
|
|
@@ -60,7 +25,7 @@ function serializeCookie(name, val, attributes) {
|
|
|
60
25
|
str += "; Max-Age=" + Math.floor(maxAge);
|
|
61
26
|
}
|
|
62
27
|
if (domain) {
|
|
63
|
-
if (process.env["NODE_ENV"]
|
|
28
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
64
29
|
if (!fieldContentRegExp.test(domain)) {
|
|
65
30
|
throw new TypeError("option domain is invalid");
|
|
66
31
|
}
|
|
@@ -68,7 +33,7 @@ function serializeCookie(name, val, attributes) {
|
|
|
68
33
|
str += "; Domain=" + domain;
|
|
69
34
|
}
|
|
70
35
|
if (path) {
|
|
71
|
-
if (process.env["NODE_ENV"]
|
|
36
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
72
37
|
if (!fieldContentRegExp.test(path)) {
|
|
73
38
|
throw new TypeError("option path is invalid");
|
|
74
39
|
}
|
|
@@ -76,7 +41,7 @@ function serializeCookie(name, val, attributes) {
|
|
|
76
41
|
str += "; Path=" + path;
|
|
77
42
|
}
|
|
78
43
|
if (expires) {
|
|
79
|
-
if (
|
|
44
|
+
if (isNumber(expires)) {
|
|
80
45
|
expires = new Date(Date.now() + expires * 864e5);
|
|
81
46
|
}
|
|
82
47
|
str += "; Expires=" + expires.toUTCString();
|
|
@@ -98,11 +63,8 @@ function serializeCookie(name, val, attributes) {
|
|
|
98
63
|
case "none":
|
|
99
64
|
str += "; SameSite=None";
|
|
100
65
|
break;
|
|
101
|
-
// default:
|
|
102
|
-
// throw new TypeError('option sameSite is invalid');
|
|
103
66
|
}
|
|
104
67
|
}
|
|
105
68
|
return str;
|
|
106
69
|
}
|
|
107
|
-
|
|
108
|
-
exports.default = serializeCookie;
|
|
70
|
+
export default serializeCookie;
|
package/setCookie.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 setCookie<T extends string = string>(name: string, value: string | T, attributes?: CookieAttributesClient): string | undefined;
|
|
10
3
|
export default setCookie;
|
package/setCookie.js
CHANGED
|
@@ -1,32 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var cookie_1 = require("./cookie");
|
|
6
|
-
var isNumber_1 = tslib_1.__importDefault(require("./isNumber"));
|
|
7
|
-
var isUndefined_1 = tslib_1.__importDefault(require("./isUndefined"));
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import { defaultAttributesClient } from "./cookie.js";
|
|
3
|
+
import isNumber from "./isNumber.js";
|
|
4
|
+
import isUndefined from "./isUndefined.js";
|
|
8
5
|
function converterWrite(value) {
|
|
9
6
|
return encodeURIComponent(value).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
|
|
10
7
|
}
|
|
11
|
-
|
|
12
|
-
* @category cookie
|
|
13
|
-
*
|
|
14
|
-
* All cookie related code is inspired and adapted from:
|
|
15
|
-
* - [js-cookie](https://github.com/js-cookie/js-cookie)
|
|
16
|
-
* - [cookie](https://github.com/jshttp/cookie)
|
|
17
|
-
*/
|
|
18
|
-
function setCookie(name, value, attributes) {
|
|
8
|
+
export function setCookie(name, value, attributes) {
|
|
19
9
|
if (attributes === void 0) { attributes = {}; }
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (process.env["NODE_ENV"] !== "production") {
|
|
10
|
+
var expires = attributes.expires, restAttrs = __rest(attributes, ["expires"]);
|
|
11
|
+
var cleanedAttrs = __assign(__assign({ expires: "" }, defaultAttributesClient), restAttrs);
|
|
12
|
+
if (isUndefined(document)) {
|
|
13
|
+
if (process.env["NODE_ENV"] === "development") {
|
|
25
14
|
console.warn("[@koine/utils:setCookie] document is undefined");
|
|
26
15
|
}
|
|
27
16
|
return undefined;
|
|
28
17
|
}
|
|
29
|
-
if ((
|
|
18
|
+
if (isNumber(expires)) {
|
|
30
19
|
expires = new Date(Date.now() + expires * 864e5);
|
|
31
20
|
}
|
|
32
21
|
if (expires) {
|
|
@@ -45,18 +34,10 @@ function setCookie(name, value, attributes) {
|
|
|
45
34
|
if (attributes[attrName] === true) {
|
|
46
35
|
continue;
|
|
47
36
|
}
|
|
48
|
-
// Considers RFC 6265 section 5.2:
|
|
49
|
-
// ...
|
|
50
|
-
// 3. If the remaining unparsed-attributes contains a %x3B (";")
|
|
51
|
-
// character:
|
|
52
|
-
// Consume the characters of the unparsed-attributes up to,
|
|
53
|
-
// not including, the first %x3B (";") character.
|
|
54
|
-
// ...
|
|
55
37
|
stringifiedAttributes +=
|
|
56
38
|
"=" + String(attributes[attrName]).split(";")[0];
|
|
57
39
|
}
|
|
58
40
|
return (document.cookie =
|
|
59
41
|
name + "=" + converterWrite(value) + stringifiedAttributes);
|
|
60
42
|
}
|
|
61
|
-
|
|
62
|
-
exports.default = setCookie;
|
|
43
|
+
export default setCookie;
|
package/shuffle.d.ts
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Creates an array of shuffled values, using a version of the
|
|
3
|
-
* [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
|
|
4
|
-
*
|
|
5
|
-
* @see lodash.shuffle
|
|
6
|
-
* @since 0.1.0
|
|
7
|
-
* @category arrays
|
|
8
|
-
* @param {Array} array The array to shuffle.
|
|
9
|
-
* @returns {Array} Returns the new shuffled array.
|
|
10
|
-
* @example
|
|
11
|
-
*
|
|
12
|
-
* shuffle([1, 2, 3, 4])
|
|
13
|
-
* // => [4, 1, 3, 2]
|
|
14
|
-
*/
|
|
15
1
|
export declare function shuffle<T>(array: T[]): T[];
|
|
16
2
|
export default shuffle;
|
package/shuffle.js
CHANGED
|
@@ -1,29 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.shuffle = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
/**
|
|
6
|
-
* Creates an array of shuffled values, using a version of the
|
|
7
|
-
* [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
|
|
8
|
-
*
|
|
9
|
-
* @see lodash.shuffle
|
|
10
|
-
* @since 0.1.0
|
|
11
|
-
* @category arrays
|
|
12
|
-
* @param {Array} array The array to shuffle.
|
|
13
|
-
* @returns {Array} Returns the new shuffled array.
|
|
14
|
-
* @example
|
|
15
|
-
*
|
|
16
|
-
* shuffle([1, 2, 3, 4])
|
|
17
|
-
* // => [4, 1, 3, 2]
|
|
18
|
-
*/
|
|
19
|
-
function shuffle(array) {
|
|
1
|
+
import { __read, __spreadArray } from "tslib";
|
|
2
|
+
export function shuffle(array) {
|
|
20
3
|
var length = array == null ? 0 : array.length;
|
|
21
4
|
if (!length) {
|
|
22
5
|
return [];
|
|
23
6
|
}
|
|
24
7
|
var index = -1;
|
|
25
8
|
var lastIndex = length - 1;
|
|
26
|
-
var result =
|
|
9
|
+
var result = __spreadArray([], __read(array), false);
|
|
27
10
|
while (++index < length) {
|
|
28
11
|
var rand = index + Math.floor(Math.random() * (lastIndex - index + 1));
|
|
29
12
|
var value = result[rand];
|
|
@@ -32,5 +15,4 @@ function shuffle(array) {
|
|
|
32
15
|
}
|
|
33
16
|
return result;
|
|
34
17
|
}
|
|
35
|
-
|
|
36
|
-
exports.default = shuffle;
|
|
18
|
+
export default shuffle;
|
package/slugify.d.ts
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Slugify a text
|
|
3
|
-
*
|
|
4
|
-
* - replaces the accented letters
|
|
5
|
-
* - replaces the punctuation with dashes
|
|
6
|
-
*
|
|
7
|
-
* @category text
|
|
8
|
-
* @see https://gist.github.com/mathewbyrne/1280286#gistcomment-3498021
|
|
9
|
-
*/
|
|
10
1
|
export declare function slugify(text: string, separator?: string): string;
|
|
11
2
|
export default slugify;
|
package/slugify.js
CHANGED
|
@@ -1,27 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var accentSets_1 = require("./accentSets");
|
|
5
|
-
var removeAccents_1 = require("./removeAccents");
|
|
6
|
-
/**
|
|
7
|
-
* Slugify a text
|
|
8
|
-
*
|
|
9
|
-
* - replaces the accented letters
|
|
10
|
-
* - replaces the punctuation with dashes
|
|
11
|
-
*
|
|
12
|
-
* @category text
|
|
13
|
-
* @see https://gist.github.com/mathewbyrne/1280286#gistcomment-3498021
|
|
14
|
-
*/
|
|
15
|
-
function slugify(text, separator) {
|
|
1
|
+
import { accentsSets } from "./accentSets.js";
|
|
2
|
+
import { removeAccents } from "./removeAccents.js";
|
|
3
|
+
export function slugify(text, separator) {
|
|
16
4
|
if (separator === void 0) { separator = "-"; }
|
|
17
|
-
return
|
|
18
|
-
.replace(/\s+/g, "-")
|
|
19
|
-
.replace(/&/g, "-and-")
|
|
20
|
-
.replace(/[^\w-]+/g, "")
|
|
21
|
-
.replace(/--+/g, "-")
|
|
22
|
-
.replace(/^-+/, "")
|
|
23
|
-
.replace(/-+$/, "")
|
|
5
|
+
return removeAccents(text.toString().toLowerCase().trim(), accentsSets.concat([["-", "[·/_,:;']"]]))
|
|
6
|
+
.replace(/\s+/g, "-")
|
|
7
|
+
.replace(/&/g, "-and-")
|
|
8
|
+
.replace(/[^\w-]+/g, "")
|
|
9
|
+
.replace(/--+/g, "-")
|
|
10
|
+
.replace(/^-+/, "")
|
|
11
|
+
.replace(/-+$/, "")
|
|
24
12
|
.replace(/-/g, separator);
|
|
25
13
|
}
|
|
26
|
-
|
|
27
|
-
exports.default = slugify;
|
|
14
|
+
export default slugify;
|
package/split.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type Split<S extends string, D extends string> = string extends S ? string[] : S extends "" ? [] : S extends `${infer T}${D}${infer U}` ? [T, ...Split<U, D>] : [S];
|
|
2
|
-
export declare
|
|
2
|
+
export declare const split: <T extends string, D extends string>(string: T, delimiter: D) => Split<T, D>;
|
|
3
3
|
export default split;
|
package/split.js
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.split = void 0;
|
|
4
|
-
function split(str, delimiter) {
|
|
5
|
-
return str.split(delimiter);
|
|
6
|
-
}
|
|
7
|
-
exports.split = split;
|
|
8
|
-
exports.default = split;
|
|
1
|
+
export var split = function (string, delimiter) { return string.split(delimiter); };
|
|
2
|
+
export default split;
|
package/swapMap.d.ts
CHANGED
package/swapMap.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.swapMap = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Swap object map key/value
|
|
6
|
-
*
|
|
7
|
-
* @category objects
|
|
8
|
-
*/
|
|
9
|
-
function swapMap(map) {
|
|
1
|
+
export function swapMap(map) {
|
|
10
2
|
if (map === void 0) { map = {}; }
|
|
11
3
|
var output = {};
|
|
12
4
|
for (var key in map) {
|
|
@@ -14,5 +6,4 @@ function swapMap(map) {
|
|
|
14
6
|
}
|
|
15
7
|
return output;
|
|
16
8
|
}
|
|
17
|
-
|
|
18
|
-
exports.default = swapMap;
|
|
9
|
+
export default swapMap;
|
package/throttle.d.ts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Throttle function (e.g. for resize / scroll handlers)
|
|
3
|
-
*
|
|
4
|
-
* @category function
|
|
5
|
-
* @see https://github.com/Mobius1/Rangeable/
|
|
6
|
-
*/
|
|
7
1
|
export declare function throttle<TFn extends Function, TContext>(fn: TFn, limit: number, context?: TContext): (this: TContext, ...args: any[]) => NodeJS.Timeout | undefined;
|
|
8
2
|
export default throttle;
|
package/throttle.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.throttle = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
/**
|
|
6
|
-
* Throttle function (e.g. for resize / scroll handlers)
|
|
7
|
-
*
|
|
8
|
-
* @category function
|
|
9
|
-
* @see https://github.com/Mobius1/Rangeable/
|
|
10
|
-
*/
|
|
11
|
-
function throttle(fn, limit, context) {
|
|
1
|
+
import { __read, __spreadArray } from "tslib";
|
|
2
|
+
export function throttle(fn, limit, context) {
|
|
12
3
|
var wait;
|
|
13
4
|
return function () {
|
|
14
5
|
var args = [];
|
|
@@ -17,7 +8,7 @@ function throttle(fn, limit, context) {
|
|
|
17
8
|
}
|
|
18
9
|
context = context || this;
|
|
19
10
|
if (!wait) {
|
|
20
|
-
fn.apply.apply(fn,
|
|
11
|
+
fn.apply.apply(fn, __spreadArray([context], __read(args), false));
|
|
21
12
|
wait = true;
|
|
22
13
|
return setTimeout(function () {
|
|
23
14
|
wait = false;
|
|
@@ -26,5 +17,4 @@ function throttle(fn, limit, context) {
|
|
|
26
17
|
return;
|
|
27
18
|
};
|
|
28
19
|
}
|
|
29
|
-
|
|
30
|
-
exports.default = throttle;
|
|
20
|
+
export default throttle;
|
package/titleCase.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @category typography
|
|
3
|
-
* @see https://github.com/blakeembrey/change-case/blob/master/packages/title-case/src/index.ts
|
|
4
|
-
* @author Blake Embrey (hello@blakeembrey.com)
|
|
5
|
-
*/
|
|
6
1
|
export declare const titleCase: (input?: null | string) => string;
|
|
7
2
|
export default titleCase;
|
package/titleCase.js
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.titleCase = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @category typography
|
|
6
|
-
* @see https://github.com/blakeembrey/change-case/blob/master/packages/title-case/src/index.ts
|
|
7
|
-
* @author Blake Embrey (hello@blakeembrey.com)
|
|
8
|
-
*/
|
|
9
|
-
var titleCase = function (input) {
|
|
1
|
+
export var titleCase = function (input) {
|
|
10
2
|
return input
|
|
11
3
|
? input.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substring(1).toLowerCase(); })
|
|
12
4
|
: "";
|
|
13
5
|
};
|
|
14
|
-
|
|
15
|
-
exports.default = exports.titleCase;
|
|
6
|
+
export default titleCase;
|
package/toNumber.d.ts
CHANGED
package/toNumber.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var isNumber_1 = require("./isNumber");
|
|
5
|
-
/**
|
|
6
|
-
* @category cast
|
|
7
|
-
*/
|
|
8
|
-
function toNumber(input, fallback) {
|
|
9
|
-
return (0, isNumber_1.isNumber)(input) ? input : input ? parseFloat(input) : fallback || 0;
|
|
1
|
+
import { isNumber } from "./isNumber.js";
|
|
2
|
+
export function toNumber(input, fallback) {
|
|
3
|
+
return isNumber(input) ? input : input ? parseFloat(input) : fallback || 0;
|
|
10
4
|
}
|
|
11
|
-
|
|
12
|
-
exports.default = toNumber;
|
|
5
|
+
export default toNumber;
|
package/toRgba.d.ts
CHANGED
package/toRgba.js
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
// import hexRgb from "hex-rgb";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.toRgba = void 0;
|
|
5
|
-
// export const toRgb = (hexColor: string) => hexRgb(hexColor, { format: "css" });
|
|
6
|
-
// export const toRgba = (hexColor: string, alpha: number) =>
|
|
7
|
-
// hexRgb(hexColor, { format: "css", alpha });
|
|
8
|
-
/**
|
|
9
|
-
* @category colors
|
|
10
|
-
*/
|
|
11
|
-
function toRgba(hex, alpha) {
|
|
1
|
+
export function toRgba(hex, alpha) {
|
|
12
2
|
if (alpha === void 0) { alpha = 1; }
|
|
13
3
|
var r = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
|
|
14
4
|
if (r) {
|
|
@@ -16,5 +6,4 @@ function toRgba(hex, alpha) {
|
|
|
16
6
|
}
|
|
17
7
|
return "";
|
|
18
8
|
}
|
|
19
|
-
|
|
20
|
-
exports.default = toRgba;
|
|
9
|
+
export default toRgba;
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Transform string in a URL pathname (relative URL)
|
|
3
|
-
*
|
|
4
|
-
* - adds an initial slash
|
|
5
|
-
* - encode the string
|
|
6
|
-
* - replaces whitespaces with dashes
|
|
7
|
-
*
|
|
8
|
-
* @category location
|
|
9
|
-
*/
|
|
10
1
|
export declare function transformToUrlPathname(toPathname?: string): string;
|
|
11
2
|
export default transformToUrlPathname;
|
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var isString_1 = tslib_1.__importDefault(require("./isString"));
|
|
6
|
-
/**
|
|
7
|
-
* Transform string in a URL pathname (relative URL)
|
|
8
|
-
*
|
|
9
|
-
* - adds an initial slash
|
|
10
|
-
* - encode the string
|
|
11
|
-
* - replaces whitespaces with dashes
|
|
12
|
-
*
|
|
13
|
-
* @category location
|
|
14
|
-
*/
|
|
15
|
-
function transformToUrlPathname(toPathname) {
|
|
16
|
-
return (0, isString_1.default)(toPathname)
|
|
1
|
+
import isString from "./isString.js";
|
|
2
|
+
export function transformToUrlPathname(toPathname) {
|
|
3
|
+
return isString(toPathname)
|
|
17
4
|
? "/".concat(encodeURIComponent(toPathname.replace(/\s/g, "-").toLowerCase()))
|
|
18
5
|
: "";
|
|
19
6
|
}
|
|
20
|
-
|
|
21
|
-
exports.default = transformToUrlPathname;
|
|
7
|
+
export default transformToUrlPathname;
|
package/truncate.d.ts
CHANGED
package/truncate.js
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.truncate = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Truncate string
|
|
6
|
-
*
|
|
7
|
-
* @category typography
|
|
8
|
-
*/
|
|
9
|
-
var truncate = function (input, length) {
|
|
1
|
+
export var truncate = function (input, length) {
|
|
10
2
|
return input
|
|
11
3
|
? input.length > length
|
|
12
4
|
? input.substring(0, length) + "..."
|
|
13
5
|
: input
|
|
14
6
|
: "";
|
|
15
7
|
};
|
|
16
|
-
|
|
17
|
-
exports.default = exports.truncate;
|
|
8
|
+
export default truncate;
|
package/tryUntil.d.ts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @borrows [https://levelup.gitconnected.com/javascript-wait-until-something-happens-or-timeout-82636839ea93]
|
|
3
|
-
*
|
|
4
|
-
* @param timeout in `ms`
|
|
5
|
-
* @param interval in `ms`
|
|
6
|
-
*/
|
|
7
1
|
export declare const tryUntil: (test: () => boolean, timeout: number, interval: number, resolve: () => void, reject?: () => void) => void;
|
|
8
2
|
export default tryUntil;
|
package/tryUntil.js
CHANGED
|
@@ -1,31 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tryUntil = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @borrows [https://levelup.gitconnected.com/javascript-wait-until-something-happens-or-timeout-82636839ea93]
|
|
6
|
-
*
|
|
7
|
-
* @param timeout in `ms`
|
|
8
|
-
* @param interval in `ms`
|
|
9
|
-
*/
|
|
10
|
-
var tryUntil = function (test, timeout, interval, resolve, reject) {
|
|
11
|
-
// return new Promise((resolve, reject) => {
|
|
1
|
+
export var tryUntil = function (test, timeout, interval, resolve, reject) {
|
|
12
2
|
var timeWas = new Date();
|
|
13
3
|
var wait = setInterval(function () {
|
|
14
4
|
if (test()) {
|
|
15
|
-
// console.log("resolved after", new Date() - timeWas, "ms");
|
|
16
5
|
clearInterval(wait);
|
|
17
6
|
resolve();
|
|
18
|
-
// @ts-expect-error ...
|
|
19
7
|
}
|
|
20
8
|
else if (new Date() - timeWas > timeout) {
|
|
21
|
-
// Timeout
|
|
22
|
-
// console.log("rejected after", new Date() - timeWas, "ms");
|
|
23
9
|
clearInterval(wait);
|
|
24
10
|
if (reject)
|
|
25
11
|
reject();
|
|
26
12
|
}
|
|
27
13
|
}, interval);
|
|
28
|
-
// });
|
|
29
14
|
};
|
|
30
|
-
|
|
31
|
-
exports.default = exports.tryUntil;
|
|
15
|
+
export default tryUntil;
|
package/types.d.ts
CHANGED
|
@@ -1,28 +1,10 @@
|
|
|
1
1
|
import type { Replace } from "type-fest";
|
|
2
|
-
/**
|
|
3
|
-
* Whatever that in javascript returns `false` when checked in an `if` condition
|
|
4
|
-
*/
|
|
5
2
|
export type AnythingFalsy = null | undefined | 0 | "";
|
|
6
|
-
/**
|
|
7
|
-
* Pick the keys of an object `T` that starts with `S`. It produces a mapped type
|
|
8
|
-
* with a subset of `T` whose keys start with `S`.
|
|
9
|
-
*/
|
|
10
3
|
export type PickStartsWith<T extends object, S extends string> = {
|
|
11
4
|
[K in keyof T as K extends `${S}${string}` ? K : never]: T[K];
|
|
12
5
|
};
|
|
13
|
-
/**
|
|
14
|
-
* Returns a union of all the keys of an object `T` which starts with `S`.
|
|
15
|
-
*/
|
|
16
6
|
export type KeysStartsWith<T extends object, S extends string> = keyof PickStartsWith<T, S>;
|
|
17
|
-
/**
|
|
18
|
-
* Pick the keys of an object `T` that starts with `S`. It produces a mapped type
|
|
19
|
-
* with a subset of `T` whose keys start with `S` *and have `S`* removed.
|
|
20
|
-
*/
|
|
21
7
|
export type PickStartsWithTails<T extends object, S extends string> = {
|
|
22
8
|
[K in keyof T as K extends `${S}${string}` ? Replace<K, S, ""> : never]: T[K];
|
|
23
9
|
};
|
|
24
|
-
/**
|
|
25
|
-
* Returns a union of all the keys of an object `T` which starts with `S`.
|
|
26
|
-
* The strings in the produced union *have `S` removed*.
|
|
27
|
-
*/
|
|
28
10
|
export type KeysTailsStartsWith<T extends object, S extends string> = keyof PickStartsWithTails<T, S>;
|
package/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/typings.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* List here the global variables used by third party scripts supported within
|
|
3
|
-
* the `koine` ecosystem.
|
|
4
|
-
* variables.
|
|
3
|
+
* the `koine` ecosystem.
|
|
5
4
|
*/
|
|
6
|
-
|
|
7
|
-
// declare type NullableRecord<T> = {
|
|
8
|
-
// [K in keyof T]: T[K] | null;
|
|
9
|
-
// };
|