@koine/utils 2.0.0-beta.80 → 2.0.0-beta.83
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.cjs.js +20 -10
- package/Defer.esm.js +20 -10
- package/Emitter.cjs.js +18 -19
- package/Emitter.d.ts +1 -1
- package/Emitter.esm.js +18 -19
- package/accentsSets.cjs.d.ts +2 -0
- package/accentsSets.cjs.default.js +1 -0
- package/accentsSets.cjs.js +20 -0
- package/accentsSets.cjs.mjs +2 -0
- package/accentsSets.esm.js +15 -0
- package/addOrReplaceAtIdx.cjs.js +7 -14
- package/addOrReplaceAtIdx.esm.js +7 -14
- package/areEqual.cjs.js +28 -43
- package/areEqual.esm.js +28 -43
- package/arrayFilterFalsy.cjs.js +6 -1
- package/arrayFilterFalsy.d.ts +1 -1
- package/arrayFilterFalsy.esm.js +6 -1
- package/arrayFindLastIndex.cjs.js +13 -8
- package/arrayFindLastIndex.d.ts +1 -1
- package/arrayFindLastIndex.esm.js +13 -8
- package/arrayOfAll.cjs.js +16 -1
- package/arrayOfAll.esm.js +16 -1
- package/arraySum.cjs.js +6 -1
- package/arraySum.esm.js +6 -1
- package/arrayToLookup.cjs.js +5 -4
- package/arrayToLookup.esm.js +5 -4
- package/arrayUniqueByProperties.cjs.js +8 -1
- package/arrayUniqueByProperties.esm.js +8 -1
- package/buildUrlQueryString.cjs.js +10 -17
- package/buildUrlQueryString.esm.js +10 -17
- package/capitalize.cjs.js +7 -2
- package/capitalize.d.ts +1 -1
- package/capitalize.esm.js +7 -2
- package/changeCaseCamel.cjs.js +7 -17
- package/changeCaseCamel.esm.js +7 -17
- package/changeCaseCapital.cjs.js +7 -10
- package/changeCaseCapital.esm.js +7 -10
- package/changeCaseConstant.cjs.js +7 -6
- package/changeCaseConstant.esm.js +7 -6
- package/changeCaseDot.cjs.js +7 -1
- package/changeCaseDot.esm.js +7 -1
- package/changeCaseHelpers.cjs.js +32 -71
- package/changeCaseHelpers.esm.js +32 -71
- package/changeCaseKebab.cjs.js +7 -1
- package/changeCaseKebab.esm.js +7 -1
- package/changeCaseNone.cjs.js +7 -6
- package/changeCaseNone.esm.js +7 -6
- package/changeCasePascal.cjs.js +7 -9
- package/changeCasePascal.esm.js +7 -9
- package/changeCasePascalSnake.cjs.js +7 -1
- package/changeCasePascalSnake.esm.js +7 -1
- package/changeCasePath.cjs.js +7 -1
- package/changeCasePath.esm.js +7 -1
- package/changeCaseSentence.cjs.js +7 -15
- package/changeCaseSentence.esm.js +8 -16
- package/changeCaseSnake.cjs.js +7 -1
- package/changeCaseSnake.esm.js +7 -1
- package/changeCaseTrain.cjs.js +7 -1
- package/changeCaseTrain.esm.js +7 -1
- package/chunkByChunks.cjs.js +5 -31
- package/chunkByChunks.esm.js +5 -31
- package/chunkBySize.cjs.js +4 -7
- package/chunkBySize.esm.js +4 -7
- package/clamp.cjs.js +6 -1
- package/clamp.esm.js +6 -1
- package/clsx.cjs.js +8 -39
- package/clsx.esm.js +8 -39
- package/convertRange.cjs.js +14 -1
- package/convertRange.esm.js +14 -1
- package/cookie.cjs.js +44 -1
- package/cookie.esm.js +44 -1
- package/createPalette.cjs.js +17 -11
- package/createPalette.esm.js +17 -11
- package/debounce.cjs.js +7 -17
- package/debounce.esm.js +7 -17
- package/debouncePromise.cjs.js +16 -51
- package/debouncePromise.esm.js +16 -51
- package/debounceRaf.cjs.js +10 -12
- package/debounceRaf.esm.js +10 -12
- package/decode.cjs.js +4 -1
- package/decode.esm.js +4 -1
- package/encode.cjs.js +4 -1
- package/encode.esm.js +4 -1
- package/ensureInt.cjs.js +5 -1
- package/ensureInt.esm.js +5 -1
- package/errorToString.cjs.js +6 -1
- package/errorToString.esm.js +6 -1
- package/escapeRegExp.cjs.js +7 -1
- package/escapeRegExp.esm.js +7 -1
- package/findDuplicatedIndexes.cjs.js +3 -10
- package/findDuplicatedIndexes.esm.js +3 -10
- package/forin.cjs.js +6 -5
- package/forin.esm.js +6 -5
- package/gbToBytes.cjs.js +5 -1
- package/gbToBytes.esm.js +5 -1
- package/getEmptyArray.cjs.js +6 -3
- package/getEmptyArray.esm.js +6 -3
- package/getKeys.cjs.js +8 -1
- package/getKeys.d.ts +1 -1
- package/getKeys.esm.js +8 -1
- package/getMediaQueryWidthResolvers.cjs.js +27 -41
- package/getMediaQueryWidthResolvers.esm.js +27 -41
- package/getMediaQueryWidthTailwindScreens.cjs.js +6 -25
- package/getMediaQueryWidthTailwindScreens.esm.js +6 -25
- package/getNonce.cjs.js +4 -1
- package/getNonce.esm.js +4 -1
- package/getParamAmong.cjs.js +11 -4
- package/getParamAmong.esm.js +11 -4
- package/getParamAsInt.cjs.js +10 -7
- package/getParamAsInt.esm.js +10 -7
- package/getParamAsString.cjs.js +9 -1
- package/getParamAsString.esm.js +9 -1
- package/getType.cjs.js +13 -1
- package/getType.esm.js +13 -1
- package/getUrlHashParams.cjs.js +6 -8
- package/getUrlHashParams.esm.js +6 -8
- package/getUrlHashPathname.cjs.js +7 -1
- package/getUrlHashPathname.esm.js +7 -1
- package/getUrlPathnameParts.cjs.js +10 -4
- package/getUrlPathnameParts.esm.js +10 -4
- package/getUrlQueryParams.cjs.js +12 -20
- package/getUrlQueryParams.esm.js +12 -20
- package/hashAny.cjs.d.ts +2 -0
- package/hashAny.cjs.default.js +1 -0
- package/hashAny.cjs.js +40 -0
- package/hashAny.cjs.mjs +2 -0
- package/hashAny.d.ts +2 -0
- package/hashAny.esm.js +35 -0
- package/imgEmptyPixel.cjs.js +5 -1
- package/imgEmptyPixel.esm.js +5 -1
- package/index.cjs.js +5 -3
- package/index.d.ts +2 -1
- package/index.esm.js +3 -2
- package/invariant.cjs.js +17 -16
- package/invariant.esm.js +17 -16
- package/isAbsoluteUrl.cjs.js +5 -2
- package/isAbsoluteUrl.esm.js +5 -2
- package/isAnyObject.cjs.js +5 -1
- package/isAnyObject.esm.js +5 -1
- package/isArray.cjs.js +5 -1
- package/isArray.esm.js +5 -1
- package/isBlob.cjs.js +5 -1
- package/isBlob.esm.js +5 -1
- package/isBoolean.cjs.js +5 -1
- package/isBoolean.esm.js +5 -1
- package/isBrowser.cjs.js +4 -1
- package/isBrowser.esm.js +4 -1
- package/isBrowserNow.cjs.js +4 -1
- package/isBrowserNow.esm.js +4 -1
- package/isDate.cjs.js +5 -1
- package/isDate.esm.js +5 -1
- package/isEmptyArray.cjs.js +5 -1
- package/isEmptyArray.esm.js +5 -1
- package/isEmptyObject.cjs.js +5 -1
- package/isEmptyObject.esm.js +5 -1
- package/isEmptyString.cjs.js +5 -1
- package/isEmptyString.esm.js +5 -1
- package/isError.cjs.js +5 -1
- package/isError.esm.js +5 -1
- package/isExternalUrl.cjs.js +9 -9
- package/isExternalUrl.esm.js +9 -9
- package/isFile.cjs.js +5 -1
- package/isFile.esm.js +5 -1
- package/isFloat.cjs.js +5 -1
- package/isFloat.esm.js +5 -1
- package/isFormData.cjs.js +5 -1
- package/isFormData.esm.js +5 -1
- package/isFullArray.cjs.js +5 -1
- package/isFullArray.esm.js +5 -1
- package/isFullObject.cjs.js +5 -1
- package/isFullObject.esm.js +5 -1
- package/isFullString.cjs.js +5 -1
- package/isFullString.esm.js +5 -1
- package/isFunction.cjs.js +5 -1
- package/isFunction.esm.js +5 -1
- package/isInt.cjs.js +5 -1
- package/isInt.esm.js +5 -1
- package/isMap.cjs.js +5 -1
- package/isMap.esm.js +5 -1
- package/isNaNValue.cjs.js +5 -1
- package/isNaNValue.esm.js +5 -1
- package/isNegativeNumber.cjs.js +5 -1
- package/isNegativeNumber.esm.js +5 -1
- package/isNull.cjs.js +5 -1
- package/isNull.esm.js +5 -1
- package/isNullOrUndefined.cjs.js +5 -1
- package/isNullOrUndefined.esm.js +5 -1
- package/isNumber.cjs.js +7 -1
- package/isNumber.esm.js +7 -1
- package/isNumericLiteral.cjs.js +8 -1
- package/isNumericLiteral.esm.js +8 -1
- package/isObject.cjs.js +5 -1
- package/isObject.esm.js +5 -1
- package/isObjectLike.cjs.js +7 -1
- package/isObjectLike.esm.js +7 -1
- package/isObjectStringKeyed.cjs.js +9 -1
- package/isObjectStringKeyed.esm.js +9 -1
- package/isOneOf.cjs.js +3 -7
- package/isOneOf.esm.js +3 -7
- package/isPlainObject.cjs.js +5 -4
- package/isPlainObject.esm.js +5 -4
- package/isPositiveNumber.cjs.js +5 -1
- package/isPositiveNumber.esm.js +5 -1
- package/isPrimitive.cjs.js +5 -6
- package/isPrimitive.esm.js +5 -6
- package/isPromise.cjs.js +5 -1
- package/isPromise.esm.js +5 -1
- package/isRegExp.cjs.js +5 -1
- package/isRegExp.esm.js +5 -1
- package/isServer.cjs.js +4 -1
- package/isServer.esm.js +4 -1
- package/isServerNow.cjs.js +4 -1
- package/isServerNow.esm.js +4 -1
- package/isSet.cjs.js +5 -1
- package/isSet.esm.js +5 -1
- package/isString.cjs.js +5 -1
- package/isString.esm.js +5 -1
- package/isSymbol.cjs.js +5 -1
- package/isSymbol.esm.js +5 -1
- package/isType.cjs.js +9 -11
- package/isType.esm.js +9 -11
- package/isUndefined.cjs.js +5 -1
- package/isUndefined.esm.js +5 -1
- package/isWeakMap.cjs.js +5 -1
- package/isWeakMap.esm.js +5 -1
- package/isWeakSet.cjs.js +5 -1
- package/isWeakSet.esm.js +5 -1
- package/kbToBytes.cjs.js +5 -1
- package/kbToBytes.esm.js +5 -1
- package/lowercase.cjs.js +5 -1
- package/lowercase.d.ts +1 -1
- package/lowercase.esm.js +5 -1
- package/mapListBy.cjs.js +5 -4
- package/mapListBy.esm.js +5 -4
- package/matchSorter.cjs.js +94 -239
- package/matchSorter.d.ts +1 -1
- package/matchSorter.esm.js +92 -237
- package/mbToBytes.cjs.js +5 -1
- package/mbToBytes.esm.js +5 -1
- package/mergeObjects.cjs.js +8 -26
- package/mergeObjects.esm.js +8 -26
- package/mergeUrlQueryParams.cjs.js +5 -12
- package/mergeUrlQueryParams.esm.js +5 -12
- package/moveSortableArrayItemByKey.cjs.js +7 -8
- package/moveSortableArrayItemByKey.esm.js +7 -8
- package/noop.cjs.js +5 -1
- package/noop.esm.js +5 -1
- package/normaliseUrl.cjs.js +9 -1
- package/normaliseUrl.esm.js +9 -1
- package/normaliseUrlPathname.cjs.js +8 -1
- package/normaliseUrlPathname.esm.js +8 -1
- package/objectFlat.cjs.js +8 -16
- package/objectFlat.esm.js +8 -16
- package/objectFlip.cjs.js +4 -4
- package/objectFlip.esm.js +4 -4
- package/objectMergeWithDefaults.cjs.js +29 -19
- package/objectMergeWithDefaults.d.ts +1 -1
- package/objectMergeWithDefaults.esm.js +29 -19
- package/objectOmit.cjs.js +9 -7
- package/objectOmit.esm.js +9 -7
- package/objectPick.cjs.js +6 -8
- package/objectPick.esm.js +6 -8
- package/objectSort.cjs.js +8 -1
- package/objectSort.esm.js +8 -1
- package/objectSortByKeysMatching.cjs.js +9 -1
- package/objectSortByKeysMatching.esm.js +9 -1
- package/objectToArray.cjs.js +6 -1
- package/objectToArray.esm.js +6 -1
- package/package.json +10 -5
- package/parseCookie.cjs.js +13 -32
- package/parseCookie.esm.js +13 -32
- package/parseURL.cjs.js +6 -13
- package/parseURL.esm.js +6 -13
- package/quaranteneProps.cjs.js +17 -15
- package/quaranteneProps.esm.js +17 -15
- package/randomInt.cjs.js +5 -1
- package/randomInt.esm.js +5 -1
- package/randomKey.cjs.js +6 -4
- package/randomKey.esm.js +6 -4
- package/readCookie.cjs.js +5 -33
- package/readCookie.esm.js +5 -33
- package/removeAccents.cjs.js +4 -9
- package/removeAccents.d.ts +1 -1
- package/removeAccents.esm.js +4 -9
- package/removeCookie.cjs.js +3 -7
- package/removeCookie.esm.js +3 -7
- package/removeDuplicates.cjs.js +8 -1
- package/removeDuplicates.esm.js +8 -1
- package/removeDuplicatesByKey.cjs.js +6 -12
- package/removeDuplicatesByKey.esm.js +6 -12
- package/removeDuplicatesComparing.cjs.js +3 -4
- package/removeDuplicatesComparing.esm.js +3 -4
- package/removeIndexesFromArray.cjs.js +4 -9
- package/removeIndexesFromArray.esm.js +4 -9
- package/removeTrailingSlash.cjs.js +5 -1
- package/removeTrailingSlash.esm.js +5 -1
- package/removeUrlQueryParams.cjs.js +5 -11
- package/removeUrlQueryParams.esm.js +5 -11
- package/render.cjs.js +52 -112
- package/render.esm.js +52 -112
- package/round.cjs.js +11 -3
- package/round.esm.js +11 -3
- package/roundTo.cjs.js +22 -10
- package/roundTo.esm.js +22 -10
- package/serializeCookie.cjs.js +13 -67
- package/serializeCookie.esm.js +13 -67
- package/setCookie.cjs.js +11 -41
- package/setCookie.esm.js +11 -41
- package/shuffle.cjs.js +15 -16
- package/shuffle.esm.js +15 -16
- package/slugify.cjs.js +20 -9
- package/slugify.esm.js +20 -9
- package/split.cjs.js +6 -1
- package/split.esm.js +6 -1
- package/splitReverse.cjs.js +6 -1
- package/splitReverse.esm.js +6 -1
- package/swapMap.cjs.js +5 -7
- package/swapMap.esm.js +5 -7
- package/throttle.cjs.js +6 -14
- package/throttle.d.ts +1 -1
- package/throttle.esm.js +6 -14
- package/titleCase.cjs.js +6 -3
- package/titleCase.esm.js +6 -3
- package/toNumber.cjs.js +5 -1
- package/toNumber.esm.js +5 -1
- package/toRgba.cjs.js +5 -7
- package/toRgba.esm.js +5 -7
- package/transformToUrlPathname.cjs.js +9 -3
- package/transformToUrlPathname.esm.js +9 -3
- package/truncate.cjs.js +5 -5
- package/truncate.esm.js +5 -5
- package/tryUntil.cjs.js +14 -14
- package/tryUntil.esm.js +14 -14
- package/uid.cjs.js +5 -5
- package/uid.esm.js +5 -5
- package/updateLinkParams.cjs.js +7 -5
- package/updateLinkParams.esm.js +7 -5
- package/updateUrlQueryParams.cjs.js +5 -7
- package/updateUrlQueryParams.esm.js +5 -7
- package/uppercase.cjs.js +6 -1
- package/uppercase.d.ts +1 -1
- package/uppercase.esm.js +6 -1
- package/uuid.cjs.js +6 -4
- package/uuid.esm.js +6 -4
- package/uuidNumeric.cjs.js +4 -1
- package/uuidNumeric.esm.js +4 -1
- package/wait.cjs.js +5 -1
- package/wait.esm.js +5 -1
- package/accentSets.cjs.d.ts +0 -2
- package/accentSets.cjs.default.js +0 -1
- package/accentSets.cjs.js +0 -36
- package/accentSets.cjs.mjs +0 -2
- package/accentSets.esm.js +0 -31
- /package/{accentSets.d.ts → accentsSets.d.ts} +0 -0
package/hashAny.cjs.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var isUndefined = require('./isUndefined.cjs.js');
|
|
6
|
+
require('./getType.cjs.js');
|
|
7
|
+
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */// import { OBJECT, isUndefined } from './shared'
|
|
9
|
+
let e=Object,// use WeakMap to store the object->key mapping
|
|
10
|
+
// so the objects can be garbage collected.
|
|
11
|
+
// WeakMap uses a hashtable under the hood, so the lookup
|
|
12
|
+
// complexity is almost O(1).
|
|
13
|
+
r=new WeakMap,// counter of the key
|
|
14
|
+
s=0;/**
|
|
15
|
+
* A stable hash implementation that supports:
|
|
16
|
+
* - Fast and ensures unique hash properties
|
|
17
|
+
* - Handles unserializable values
|
|
18
|
+
* - Handles object key ordering
|
|
19
|
+
* - Generates short results
|
|
20
|
+
*
|
|
21
|
+
* This is not a serialization function, and the result is not guaranteed to be
|
|
22
|
+
* parsable.
|
|
23
|
+
*
|
|
24
|
+
* @borrows [`swr`'s `stableHash`](https://github.com/vercel/swr/blob/main/src/_internal/utils/shared.ts)
|
|
25
|
+
*
|
|
26
|
+
* That is not exported by the package, the following is not possible:
|
|
27
|
+
* ```js
|
|
28
|
+
* import { stableHash } from "swr/_internal/dist";
|
|
29
|
+
* ```
|
|
30
|
+
*/const hashAny=n=>{let o,f;let i=typeof n,a=n&&n.constructor,h=a==Date;if(e(n)!==n||h||a==RegExp)o=h?n.toJSON():"symbol"==i?n.toString():"string"==i?JSON.stringify(n):""+n;else {if(// Object/function, not null/date/regexp. Use WeakMap to store the id first.
|
|
31
|
+
// If it's already hashed, directly return the result.
|
|
32
|
+
o=r.get(n))return o;if(// Store the hash first for circular reference detection before entering the
|
|
33
|
+
// recursive `hashAny` calls.
|
|
34
|
+
// For other objects like set and map, we use this id directly as the hash.
|
|
35
|
+
o=++s+"~",r.set(n,o),a==Array){for(f=0,// Array.
|
|
36
|
+
o="@";f<n.length;f++)o+=hashAny(n[f])+",";r.set(n,o);}if(a==e){// Object, sort keys.
|
|
37
|
+
o="#";let s=e.keys(n).sort();for(;!isUndefined.isUndefined(f=s.pop());)isUndefined.isUndefined(n[f])||(o+=f+":"+hashAny(n[f])+",");r.set(n,o);}}return o};
|
|
38
|
+
|
|
39
|
+
exports["default"] = hashAny;
|
|
40
|
+
exports.hashAny = hashAny;
|
package/hashAny.cjs.mjs
ADDED
package/hashAny.d.ts
ADDED
package/hashAny.esm.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { isUndefined } from './isUndefined.esm.js';
|
|
2
|
+
import './getType.esm.js';
|
|
3
|
+
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */// import { OBJECT, isUndefined } from './shared'
|
|
5
|
+
let e=Object,// use WeakMap to store the object->key mapping
|
|
6
|
+
// so the objects can be garbage collected.
|
|
7
|
+
// WeakMap uses a hashtable under the hood, so the lookup
|
|
8
|
+
// complexity is almost O(1).
|
|
9
|
+
r=new WeakMap,// counter of the key
|
|
10
|
+
s=0;/**
|
|
11
|
+
* A stable hash implementation that supports:
|
|
12
|
+
* - Fast and ensures unique hash properties
|
|
13
|
+
* - Handles unserializable values
|
|
14
|
+
* - Handles object key ordering
|
|
15
|
+
* - Generates short results
|
|
16
|
+
*
|
|
17
|
+
* This is not a serialization function, and the result is not guaranteed to be
|
|
18
|
+
* parsable.
|
|
19
|
+
*
|
|
20
|
+
* @borrows [`swr`'s `stableHash`](https://github.com/vercel/swr/blob/main/src/_internal/utils/shared.ts)
|
|
21
|
+
*
|
|
22
|
+
* That is not exported by the package, the following is not possible:
|
|
23
|
+
* ```js
|
|
24
|
+
* import { stableHash } from "swr/_internal/dist";
|
|
25
|
+
* ```
|
|
26
|
+
*/const hashAny=n=>{let o,f;let i=typeof n,a=n&&n.constructor,h=a==Date;if(e(n)!==n||h||a==RegExp)o=h?n.toJSON():"symbol"==i?n.toString():"string"==i?JSON.stringify(n):""+n;else {if(// Object/function, not null/date/regexp. Use WeakMap to store the id first.
|
|
27
|
+
// If it's already hashed, directly return the result.
|
|
28
|
+
o=r.get(n))return o;if(// Store the hash first for circular reference detection before entering the
|
|
29
|
+
// recursive `hashAny` calls.
|
|
30
|
+
// For other objects like set and map, we use this id directly as the hash.
|
|
31
|
+
o=++s+"~",r.set(n,o),a==Array){for(f=0,// Array.
|
|
32
|
+
o="@";f<n.length;f++)o+=hashAny(n[f])+",";r.set(n,o);}if(a==e){// Object, sort keys.
|
|
33
|
+
o="#";let s=e.keys(n).sort();for(;!isUndefined(f=s.pop());)isUndefined(n[f])||(o+=f+":"+hashAny(n[f])+",");r.set(n,o);}}return o};
|
|
34
|
+
|
|
35
|
+
export { hashAny as default, hashAny };
|
package/imgEmptyPixel.cjs.js
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Empty img pixel as a string to inline
|
|
7
|
+
*
|
|
8
|
+
* @category img
|
|
9
|
+
*/let imgEmptyPixel="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
|
|
6
10
|
|
|
7
11
|
exports["default"] = imgEmptyPixel;
|
|
8
12
|
exports.imgEmptyPixel = imgEmptyPixel;
|
package/imgEmptyPixel.esm.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Empty img pixel as a string to inline
|
|
3
|
+
*
|
|
4
|
+
* @category img
|
|
5
|
+
*/let imgEmptyPixel="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";
|
|
2
6
|
|
|
3
7
|
export { imgEmptyPixel as default, imgEmptyPixel };
|
package/index.cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var accentsSets = require('./accentsSets.cjs.js');
|
|
6
6
|
var addOrReplaceAtIdx = require('./addOrReplaceAtIdx.cjs.js');
|
|
7
7
|
var areEqual = require('./areEqual.cjs.js');
|
|
8
8
|
var arrayFilterFalsy = require('./arrayFilterFalsy.cjs.js');
|
|
@@ -54,6 +54,7 @@ var getUrlHashParams = require('./getUrlHashParams.cjs.js');
|
|
|
54
54
|
var getUrlHashPathname = require('./getUrlHashPathname.cjs.js');
|
|
55
55
|
var getUrlPathnameParts = require('./getUrlPathnameParts.cjs.js');
|
|
56
56
|
var getUrlQueryParams = require('./getUrlQueryParams.cjs.js');
|
|
57
|
+
var hashAny = require('./hashAny.cjs.js');
|
|
57
58
|
var imgEmptyPixel = require('./imgEmptyPixel.cjs.js');
|
|
58
59
|
var isAbsoluteUrl = require('./isAbsoluteUrl.cjs.js');
|
|
59
60
|
var isAnyObject = require('./isAnyObject.cjs.js');
|
|
@@ -163,7 +164,7 @@ require('./cookie.cjs.js');
|
|
|
163
164
|
|
|
164
165
|
|
|
165
166
|
|
|
166
|
-
exports.accentsSets =
|
|
167
|
+
exports.accentsSets = accentsSets.accentsSets;
|
|
167
168
|
exports.addOrReplaceAtIdx = addOrReplaceAtIdx.addOrReplaceAtIdx;
|
|
168
169
|
exports.areEqual = areEqual.areEqual;
|
|
169
170
|
exports.arrayFilterFalsy = arrayFilterFalsy.arrayFilterFalsy;
|
|
@@ -215,6 +216,7 @@ exports.getUrlHashParams = getUrlHashParams.getUrlHashParams;
|
|
|
215
216
|
exports.getUrlHashPathname = getUrlHashPathname.getUrlHashPathname;
|
|
216
217
|
exports.getUrlPathnameParts = getUrlPathnameParts.getUrlPathnameParts;
|
|
217
218
|
exports.getUrlQueryParams = getUrlQueryParams.getUrlQueryParams;
|
|
219
|
+
exports.hashAny = hashAny.hashAny;
|
|
218
220
|
exports.imgEmptyPixel = imgEmptyPixel.imgEmptyPixel;
|
|
219
221
|
exports.isAbsoluteUrl = isAbsoluteUrl.isAbsoluteUrl;
|
|
220
222
|
exports.isAnyObject = isAnyObject.isAnyObject;
|
|
@@ -265,7 +267,7 @@ exports.isWeakSet = isWeakSet.isWeakSet;
|
|
|
265
267
|
exports.kbToBytes = kbToBytes.kbToBytes;
|
|
266
268
|
exports.lowercase = lowercase.lowercase;
|
|
267
269
|
exports.mapListBy = mapListBy.mapListBy;
|
|
268
|
-
exports.matchSorter = matchSorter
|
|
270
|
+
exports.matchSorter = matchSorter["default"];
|
|
269
271
|
exports.mbToBytes = mbToBytes.mbToBytes;
|
|
270
272
|
exports.mergeObjects = mergeObjects.mergeObjects;
|
|
271
273
|
exports.mergeUrlQueryParams = mergeUrlQueryParams.mergeUrlQueryParams;
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { accentsSets, type AccentsSet } from "./
|
|
1
|
+
export { accentsSets, type AccentsSet } from "./accentsSets";
|
|
2
2
|
export { addOrReplaceAtIdx } from "./addOrReplaceAtIdx";
|
|
3
3
|
export { areEqual } from "./areEqual";
|
|
4
4
|
export { arrayFilterFalsy } from "./arrayFilterFalsy";
|
|
@@ -51,6 +51,7 @@ export { getUrlHashParams } from "./getUrlHashParams";
|
|
|
51
51
|
export { getUrlHashPathname } from "./getUrlHashPathname";
|
|
52
52
|
export { getUrlPathnameParts } from "./getUrlPathnameParts";
|
|
53
53
|
export { getUrlQueryParams } from "./getUrlQueryParams";
|
|
54
|
+
export { hashAny } from "./hashAny";
|
|
54
55
|
export { imgEmptyPixel } from "./imgEmptyPixel";
|
|
55
56
|
export { isAbsoluteUrl } from "./isAbsoluteUrl";
|
|
56
57
|
export { isAnyObject } from "./isAnyObject";
|
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { accentsSets } from './
|
|
1
|
+
export { accentsSets } from './accentsSets.esm.js';
|
|
2
2
|
export { addOrReplaceAtIdx } from './addOrReplaceAtIdx.esm.js';
|
|
3
3
|
export { areEqual } from './areEqual.esm.js';
|
|
4
4
|
export { arrayFilterFalsy } from './arrayFilterFalsy.esm.js';
|
|
@@ -50,6 +50,7 @@ export { getUrlHashParams } from './getUrlHashParams.esm.js';
|
|
|
50
50
|
export { getUrlHashPathname } from './getUrlHashPathname.esm.js';
|
|
51
51
|
export { getUrlPathnameParts } from './getUrlPathnameParts.esm.js';
|
|
52
52
|
export { getUrlQueryParams } from './getUrlQueryParams.esm.js';
|
|
53
|
+
export { hashAny } from './hashAny.esm.js';
|
|
53
54
|
export { imgEmptyPixel } from './imgEmptyPixel.esm.js';
|
|
54
55
|
export { isAbsoluteUrl } from './isAbsoluteUrl.esm.js';
|
|
55
56
|
export { isAnyObject } from './isAnyObject.esm.js';
|
|
@@ -100,7 +101,7 @@ export { isWeakSet } from './isWeakSet.esm.js';
|
|
|
100
101
|
export { kbToBytes } from './kbToBytes.esm.js';
|
|
101
102
|
export { lowercase } from './lowercase.esm.js';
|
|
102
103
|
export { mapListBy } from './mapListBy.esm.js';
|
|
103
|
-
export { matchSorter } from './matchSorter.esm.js';
|
|
104
|
+
export { default as matchSorter } from './matchSorter.esm.js';
|
|
104
105
|
export { mbToBytes } from './mbToBytes.esm.js';
|
|
105
106
|
export { mergeObjects } from './mergeObjects.esm.js';
|
|
106
107
|
export { mergeUrlQueryParams } from './mergeUrlQueryParams.esm.js';
|
package/invariant.cjs.js
CHANGED
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
/**
|
|
6
|
+
* FIXME: invariant calls do not get tree shaked in minified output of projects
|
|
7
|
+
* using it. Let's not use it internally and not export it from `@koine/utils`
|
|
8
|
+
* until we find a tree-shakeable way of doing this. For now just wrapping
|
|
9
|
+
* the logging code into `if (process.env["NODE_ENV"] === "development") {}`
|
|
10
|
+
* works better despite it is more verbose.
|
|
11
|
+
*
|
|
12
|
+
* @resources
|
|
13
|
+
* - https://github.com/alexreardon/tiny-invariant
|
|
14
|
+
* - https://github.com/zertosh/invariant
|
|
15
|
+
* - https://stackoverflow.com/q/39055159/1938970
|
|
16
|
+
*
|
|
17
|
+
* @param condition The condition that, if `true` will throw the error during development
|
|
18
|
+
* @param message A string or a function that returns a string
|
|
19
|
+
* @param lib The library name to show in the error message prefix. When `lib` is also specified it outputs `[lib:prefix]: the message`, otherwise just `[lib|prefix]: the message`)
|
|
20
|
+
* @param prefix The library name to show in the error message prefix. When `lib` is also specified it outputs `[lib:prefix]: the message`, otherwise just `[lib|prefix]: the message`)
|
|
21
|
+
*/let invariant=(e,t,r,n)=>{if("development"===process.env.NODE_ENV){if(e)return;let o="function"==typeof t?t():t,i="";throw r&&n?i=`[${r}:${n}] `:r&&(i=`[${r}] `),Error(i+o)}};
|
|
21
22
|
|
|
22
23
|
exports["default"] = invariant;
|
|
23
24
|
exports.invariant = invariant;
|
package/invariant.esm.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
/**
|
|
2
|
+
* FIXME: invariant calls do not get tree shaked in minified output of projects
|
|
3
|
+
* using it. Let's not use it internally and not export it from `@koine/utils`
|
|
4
|
+
* until we find a tree-shakeable way of doing this. For now just wrapping
|
|
5
|
+
* the logging code into `if (process.env["NODE_ENV"] === "development") {}`
|
|
6
|
+
* works better despite it is more verbose.
|
|
7
|
+
*
|
|
8
|
+
* @resources
|
|
9
|
+
* - https://github.com/alexreardon/tiny-invariant
|
|
10
|
+
* - https://github.com/zertosh/invariant
|
|
11
|
+
* - https://stackoverflow.com/q/39055159/1938970
|
|
12
|
+
*
|
|
13
|
+
* @param condition The condition that, if `true` will throw the error during development
|
|
14
|
+
* @param message A string or a function that returns a string
|
|
15
|
+
* @param lib The library name to show in the error message prefix. When `lib` is also specified it outputs `[lib:prefix]: the message`, otherwise just `[lib|prefix]: the message`)
|
|
16
|
+
* @param prefix The library name to show in the error message prefix. When `lib` is also specified it outputs `[lib:prefix]: the message`, otherwise just `[lib|prefix]: the message`)
|
|
17
|
+
*/let invariant=(e,t,r,n)=>{if("development"===process.env.NODE_ENV){if(e)return;let o="function"==typeof t?t():t,i="";throw r&&n?i=`[${r}:${n}] `:r&&(i=`[${r}] `),Error(i+o)}};
|
|
17
18
|
|
|
18
19
|
export { invariant as default, invariant };
|
package/isAbsoluteUrl.cjs.js
CHANGED
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
let
|
|
6
|
-
|
|
5
|
+
let t=/^(?:[a-z+]+:)?\/\//i;/**
|
|
6
|
+
* @borrows [SO's answer](https://stackoverflow.com/a/19709846/1938970)
|
|
7
|
+
*
|
|
8
|
+
* @category is
|
|
9
|
+
*/let isAbsoluteUrl=e=>t.test(e);
|
|
7
10
|
|
|
8
11
|
exports["default"] = isAbsoluteUrl;
|
|
9
12
|
exports.isAbsoluteUrl = isAbsoluteUrl;
|
package/isAbsoluteUrl.esm.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
let
|
|
2
|
-
|
|
1
|
+
let t=/^(?:[a-z+]+:)?\/\//i;/**
|
|
2
|
+
* @borrows [SO's answer](https://stackoverflow.com/a/19709846/1938970)
|
|
3
|
+
*
|
|
4
|
+
* @category is
|
|
5
|
+
*/let isAbsoluteUrl=e=>t.test(e);
|
|
3
6
|
|
|
4
7
|
export { isAbsoluteUrl as default, isAbsoluteUrl };
|
package/isAnyObject.cjs.js
CHANGED
|
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var getType = require('./getType.cjs.js');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether the payload is an any kind of object (including special classes or objects with different prototypes)
|
|
9
|
+
*
|
|
10
|
+
* @category is
|
|
11
|
+
*/let isAnyObject=t=>"Object"===getType.getType(t);
|
|
8
12
|
|
|
9
13
|
exports["default"] = isAnyObject;
|
|
10
14
|
exports.isAnyObject = isAnyObject;
|
package/isAnyObject.esm.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { getType } from './getType.esm.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Returns whether the payload is an any kind of object (including special classes or objects with different prototypes)
|
|
5
|
+
*
|
|
6
|
+
* @category is
|
|
7
|
+
*/let isAnyObject=t=>"Object"===getType(t);
|
|
4
8
|
|
|
5
9
|
export { isAnyObject as default, isAnyObject };
|
package/isArray.cjs.js
CHANGED
|
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var getType = require('./getType.cjs.js');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether the payload is an array
|
|
9
|
+
*
|
|
10
|
+
* @category is
|
|
11
|
+
*/let isArray=e=>"Array"===getType.getType(e);
|
|
8
12
|
|
|
9
13
|
exports["default"] = isArray;
|
|
10
14
|
exports.isArray = isArray;
|
package/isArray.esm.js
CHANGED
package/isBlob.cjs.js
CHANGED
|
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var getType = require('./getType.cjs.js');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether the payload is a Blob
|
|
9
|
+
*
|
|
10
|
+
* @category is
|
|
11
|
+
*/let isBlob=e=>"Blob"===getType.getType(e);
|
|
8
12
|
|
|
9
13
|
exports["default"] = isBlob;
|
|
10
14
|
exports.isBlob = isBlob;
|
package/isBlob.esm.js
CHANGED
package/isBoolean.cjs.js
CHANGED
|
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var getType = require('./getType.cjs.js');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether the payload is a boolean
|
|
9
|
+
*
|
|
10
|
+
* @category is
|
|
11
|
+
*/let isBoolean=e=>"Boolean"===getType.getType(e);
|
|
8
12
|
|
|
9
13
|
exports["default"] = isBoolean;
|
|
10
14
|
exports.isBoolean = isBoolean;
|
package/isBoolean.esm.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { getType } from './getType.esm.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Returns whether the payload is a boolean
|
|
5
|
+
*
|
|
6
|
+
* @category is
|
|
7
|
+
*/let isBoolean=e=>"Boolean"===getType(e);
|
|
4
8
|
|
|
5
9
|
export { isBoolean as default, isBoolean };
|
package/isBrowser.cjs.js
CHANGED
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @category ssr
|
|
7
|
+
* @category is
|
|
8
|
+
*/let isBrowser="undefined"!=typeof window;
|
|
6
9
|
|
|
7
10
|
exports["default"] = isBrowser;
|
|
8
11
|
exports.isBrowser = isBrowser;
|
package/isBrowser.esm.js
CHANGED
package/isBrowserNow.cjs.js
CHANGED
|
@@ -5,7 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var isUndefined = require('./isUndefined.cjs.js');
|
|
6
6
|
require('./getType.cjs.js');
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* @category ssr
|
|
10
|
+
* @category is
|
|
11
|
+
*/let isBrowserNow=()=>!isUndefined.isUndefined(window);
|
|
9
12
|
|
|
10
13
|
exports["default"] = isBrowserNow;
|
|
11
14
|
exports.isBrowserNow = isBrowserNow;
|
package/isBrowserNow.esm.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { isUndefined } from './isUndefined.esm.js';
|
|
2
2
|
import './getType.esm.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @category ssr
|
|
6
|
+
* @category is
|
|
7
|
+
*/let isBrowserNow=()=>!isUndefined(window);
|
|
5
8
|
|
|
6
9
|
export { isBrowserNow as default, isBrowserNow };
|
package/isDate.cjs.js
CHANGED
|
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var getType = require('./getType.cjs.js');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether the payload is a Date, and that the date is valid
|
|
9
|
+
*
|
|
10
|
+
* @category is
|
|
11
|
+
*/let isDate=t=>"Date"===getType.getType(t)&&!isNaN(t);
|
|
8
12
|
|
|
9
13
|
exports["default"] = isDate;
|
|
10
14
|
exports.isDate = isDate;
|
package/isDate.esm.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { getType } from './getType.esm.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Returns whether the payload is a Date, and that the date is valid
|
|
5
|
+
*
|
|
6
|
+
* @category is
|
|
7
|
+
*/let isDate=t=>"Date"===getType(t)&&!isNaN(t);
|
|
4
8
|
|
|
5
9
|
export { isDate as default, isDate };
|
package/isEmptyArray.cjs.js
CHANGED
|
@@ -5,7 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var isArray = require('./isArray.cjs.js');
|
|
6
6
|
require('./getType.cjs.js');
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Returns whether the payload is a an empty array
|
|
10
|
+
*
|
|
11
|
+
* @category is
|
|
12
|
+
*/let isEmptyArray=t=>isArray.isArray(t)&&0===t.length;
|
|
9
13
|
|
|
10
14
|
exports["default"] = isEmptyArray;
|
|
11
15
|
exports.isEmptyArray = isEmptyArray;
|
package/isEmptyArray.esm.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { isArray } from './isArray.esm.js';
|
|
2
2
|
import './getType.esm.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Returns whether the payload is a an empty array
|
|
6
|
+
*
|
|
7
|
+
* @category is
|
|
8
|
+
*/let isEmptyArray=t=>isArray(t)&&0===t.length;
|
|
5
9
|
|
|
6
10
|
export { isEmptyArray as default, isEmptyArray };
|
package/isEmptyObject.cjs.js
CHANGED
|
@@ -5,7 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var isPlainObject = require('./isPlainObject.cjs.js');
|
|
6
6
|
require('./getType.cjs.js');
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)
|
|
10
|
+
*
|
|
11
|
+
* @category is
|
|
12
|
+
*/let isEmptyObject=e=>isPlainObject.isPlainObject(e)&&0===Object.keys(e).length;
|
|
9
13
|
|
|
10
14
|
exports["default"] = isEmptyObject;
|
|
11
15
|
exports.isEmptyObject = isEmptyObject;
|
package/isEmptyObject.esm.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { isPlainObject } from './isPlainObject.esm.js';
|
|
2
2
|
import './getType.esm.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Returns whether the payload is a an empty object (excluding special classes or objects with other prototypes)
|
|
6
|
+
*
|
|
7
|
+
* @category is
|
|
8
|
+
*/let isEmptyObject=e=>isPlainObject(e)&&0===Object.keys(e).length;
|
|
5
9
|
|
|
6
10
|
export { isEmptyObject as default, isEmptyObject };
|
package/isEmptyString.cjs.js
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Returns whether the payload is ''
|
|
7
|
+
*
|
|
8
|
+
* @category is
|
|
9
|
+
*/let isEmptyString=t=>""===t;
|
|
6
10
|
|
|
7
11
|
exports["default"] = isEmptyString;
|
|
8
12
|
exports.isEmptyString = isEmptyString;
|
package/isEmptyString.esm.js
CHANGED
package/isError.cjs.js
CHANGED
|
@@ -4,7 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var getType = require('./getType.cjs.js');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether the payload is an Error
|
|
9
|
+
*
|
|
10
|
+
* @category is
|
|
11
|
+
*/let isError=o=>"Error"===getType.getType(o);
|
|
8
12
|
|
|
9
13
|
exports["default"] = isError;
|
|
10
14
|
exports.isError = isError;
|
package/isError.esm.js
CHANGED
package/isExternalUrl.cjs.js
CHANGED
|
@@ -4,15 +4,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var isBrowser = require('./isBrowser.cjs.js');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
7
|
+
/**
|
|
8
|
+
* Is external url compared to the given current URL (if not provided it falls
|
|
9
|
+
* back to `location.href`)
|
|
10
|
+
*
|
|
11
|
+
* @category location
|
|
12
|
+
*
|
|
13
|
+
*/let isExternalUrl=(r,t)=>{let l=/https?:\/\/((?:[\w\d-]+\.)+[\w\d]{2,})/i,o=l.exec(r);return(// if no matches are found it means we either have an invalid URL, a relative
|
|
14
|
+
// URL or a hash link, and those are not considered externals
|
|
15
|
+
!!o&&(!(t=t||isBrowser.isBrowser?location.href:"")||l.exec(t)?.[1]!==o[1]))};
|
|
16
16
|
|
|
17
17
|
exports["default"] = isExternalUrl;
|
|
18
18
|
exports.isExternalUrl = isExternalUrl;
|
package/isExternalUrl.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { isBrowser } from './isBrowser.esm.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
3
|
+
/**
|
|
4
|
+
* Is external url compared to the given current URL (if not provided it falls
|
|
5
|
+
* back to `location.href`)
|
|
6
|
+
*
|
|
7
|
+
* @category location
|
|
8
|
+
*
|
|
9
|
+
*/let isExternalUrl=(r,t)=>{let l=/https?:\/\/((?:[\w\d-]+\.)+[\w\d]{2,})/i,o=l.exec(r);return(// if no matches are found it means we either have an invalid URL, a relative
|
|
10
|
+
// URL or a hash link, and those are not considered externals
|
|
11
|
+
!!o&&(!(t=t||isBrowser?location.href:"")||l.exec(t)?.[1]!==o[1]))};
|
|
12
12
|
|
|
13
13
|
export { isExternalUrl as default, isExternalUrl };
|