@koine/utils 2.0.0-beta.82 → 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 -1
- package/Defer.esm.js +20 -1
- package/Emitter.cjs.js +18 -1
- package/Emitter.esm.js +18 -1
- package/accentsSets.cjs.js +13 -1
- package/accentsSets.esm.js +13 -1
- package/addOrReplaceAtIdx.cjs.js +7 -1
- package/addOrReplaceAtIdx.esm.js +7 -1
- package/areEqual.cjs.js +28 -1
- package/areEqual.esm.js +28 -1
- package/arrayFilterFalsy.cjs.js +6 -1
- package/arrayFilterFalsy.esm.js +6 -1
- package/arrayFindLastIndex.cjs.js +13 -1
- package/arrayFindLastIndex.esm.js +13 -1
- 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 -1
- package/arrayToLookup.esm.js +5 -1
- package/arrayUniqueByProperties.cjs.js +8 -1
- package/arrayUniqueByProperties.esm.js +8 -1
- package/buildUrlQueryString.cjs.js +10 -1
- package/buildUrlQueryString.esm.js +10 -1
- package/capitalize.cjs.js +7 -1
- package/capitalize.esm.js +7 -1
- package/changeCaseCamel.cjs.js +7 -1
- package/changeCaseCamel.esm.js +7 -1
- package/changeCaseCapital.cjs.js +7 -1
- package/changeCaseCapital.esm.js +7 -1
- package/changeCaseConstant.cjs.js +7 -1
- package/changeCaseConstant.esm.js +7 -1
- package/changeCaseDot.cjs.js +7 -1
- package/changeCaseDot.esm.js +7 -1
- package/changeCaseHelpers.cjs.js +32 -1
- package/changeCaseHelpers.esm.js +32 -1
- package/changeCaseKebab.cjs.js +7 -1
- package/changeCaseKebab.esm.js +7 -1
- package/changeCaseNone.cjs.js +7 -1
- package/changeCaseNone.esm.js +7 -1
- package/changeCasePascal.cjs.js +7 -1
- package/changeCasePascal.esm.js +7 -1
- 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 -1
- package/changeCaseSentence.esm.js +7 -1
- 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 -1
- package/chunkByChunks.esm.js +5 -1
- package/chunkBySize.cjs.js +4 -1
- package/chunkBySize.esm.js +4 -1
- package/clamp.cjs.js +6 -1
- package/clamp.esm.js +6 -1
- package/clsx.cjs.js +2 -1
- package/clsx.esm.js +2 -1
- 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 -1
- package/createPalette.esm.js +17 -1
- package/debounce.cjs.js +7 -1
- package/debounce.esm.js +7 -1
- package/debouncePromise.cjs.js +10 -1
- package/debouncePromise.esm.js +10 -1
- package/debounceRaf.cjs.js +4 -1
- package/debounceRaf.esm.js +4 -1
- 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 -1
- package/findDuplicatedIndexes.esm.js +3 -1
- package/forin.cjs.js +6 -1
- package/forin.esm.js +6 -1
- package/gbToBytes.cjs.js +5 -1
- package/gbToBytes.esm.js +5 -1
- package/getEmptyArray.cjs.js +6 -1
- package/getEmptyArray.esm.js +6 -1
- package/getKeys.cjs.js +8 -1
- package/getKeys.esm.js +8 -1
- package/getMediaQueryWidthResolvers.cjs.js +27 -1
- package/getMediaQueryWidthResolvers.esm.js +27 -1
- package/getMediaQueryWidthTailwindScreens.cjs.js +6 -1
- package/getMediaQueryWidthTailwindScreens.esm.js +6 -1
- package/getNonce.cjs.js +4 -1
- package/getNonce.esm.js +4 -1
- package/getParamAmong.cjs.js +11 -1
- package/getParamAmong.esm.js +11 -1
- package/getParamAsInt.cjs.js +10 -1
- package/getParamAsInt.esm.js +10 -1
- 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 -1
- package/getUrlHashParams.esm.js +6 -1
- package/getUrlHashPathname.cjs.js +7 -1
- package/getUrlHashPathname.esm.js +7 -1
- package/getUrlPathnameParts.cjs.js +10 -1
- package/getUrlPathnameParts.esm.js +10 -1
- package/getUrlQueryParams.cjs.js +12 -1
- package/getUrlQueryParams.esm.js +12 -1
- package/hashAny.cjs.js +30 -1
- package/hashAny.esm.js +30 -1
- package/imgEmptyPixel.cjs.js +5 -1
- package/imgEmptyPixel.esm.js +5 -1
- package/invariant.cjs.js +17 -1
- package/invariant.esm.js +17 -1
- package/isAbsoluteUrl.cjs.js +5 -1
- package/isAbsoluteUrl.esm.js +5 -1
- 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 -1
- package/isExternalUrl.esm.js +9 -1
- 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 -1
- package/isOneOf.esm.js +3 -1
- package/isPlainObject.cjs.js +5 -1
- package/isPlainObject.esm.js +5 -1
- package/isPositiveNumber.cjs.js +5 -1
- package/isPositiveNumber.esm.js +5 -1
- package/isPrimitive.cjs.js +5 -1
- package/isPrimitive.esm.js +5 -1
- 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 -1
- package/isType.esm.js +9 -1
- 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.esm.js +5 -1
- package/mapListBy.cjs.js +5 -1
- package/mapListBy.esm.js +5 -1
- package/matchSorter.cjs.js +90 -1
- package/matchSorter.esm.js +90 -1
- package/mbToBytes.cjs.js +5 -1
- package/mbToBytes.esm.js +5 -1
- package/mergeObjects.cjs.js +8 -1
- package/mergeObjects.esm.js +8 -1
- package/mergeUrlQueryParams.cjs.js +5 -1
- package/mergeUrlQueryParams.esm.js +5 -1
- package/moveSortableArrayItemByKey.cjs.js +7 -1
- package/moveSortableArrayItemByKey.esm.js +7 -1
- 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 -1
- package/objectFlat.esm.js +8 -1
- package/objectFlip.cjs.js +4 -1
- package/objectFlip.esm.js +4 -1
- package/objectMergeWithDefaults.cjs.js +29 -1
- package/objectMergeWithDefaults.esm.js +29 -1
- package/objectOmit.cjs.js +9 -1
- package/objectOmit.esm.js +9 -1
- package/objectPick.cjs.js +6 -1
- package/objectPick.esm.js +6 -1
- 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 +1 -1
- package/parseCookie.cjs.js +13 -1
- package/parseCookie.esm.js +13 -1
- package/parseURL.cjs.js +6 -1
- package/parseURL.esm.js +6 -1
- package/quaranteneProps.cjs.js +17 -1
- package/quaranteneProps.esm.js +17 -1
- package/randomInt.cjs.js +5 -1
- package/randomInt.esm.js +5 -1
- package/randomKey.cjs.js +6 -1
- package/randomKey.esm.js +6 -1
- package/readCookie.cjs.js +5 -1
- package/readCookie.esm.js +5 -1
- package/removeAccents.cjs.js +3 -1
- package/removeAccents.esm.js +3 -1
- package/removeCookie.cjs.js +3 -1
- package/removeCookie.esm.js +3 -1
- package/removeDuplicates.cjs.js +8 -1
- package/removeDuplicates.esm.js +8 -1
- package/removeDuplicatesByKey.cjs.js +6 -1
- package/removeDuplicatesByKey.esm.js +6 -1
- package/removeDuplicatesComparing.cjs.js +3 -1
- package/removeDuplicatesComparing.esm.js +3 -1
- package/removeIndexesFromArray.cjs.js +4 -1
- package/removeIndexesFromArray.esm.js +4 -1
- package/removeTrailingSlash.cjs.js +5 -1
- package/removeTrailingSlash.esm.js +5 -1
- package/removeUrlQueryParams.cjs.js +5 -1
- package/removeUrlQueryParams.esm.js +5 -1
- package/render.cjs.js +52 -1
- package/render.esm.js +52 -1
- package/round.cjs.js +11 -1
- package/round.esm.js +11 -1
- package/roundTo.cjs.js +22 -1
- package/roundTo.esm.js +22 -1
- package/serializeCookie.cjs.js +13 -1
- package/serializeCookie.esm.js +13 -1
- package/setCookie.cjs.js +11 -1
- package/setCookie.esm.js +11 -1
- package/shuffle.cjs.js +15 -1
- package/shuffle.esm.js +15 -1
- package/slugify.cjs.js +19 -1
- package/slugify.esm.js +19 -1
- 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 -1
- package/swapMap.esm.js +5 -1
- package/throttle.cjs.js +6 -1
- package/throttle.esm.js +6 -1
- package/toNumber.cjs.js +5 -1
- package/toNumber.esm.js +5 -1
- package/toRgba.cjs.js +5 -1
- package/toRgba.esm.js +5 -1
- package/transformToUrlPathname.cjs.js +9 -1
- package/transformToUrlPathname.esm.js +9 -1
- package/truncate.cjs.js +5 -1
- package/truncate.esm.js +5 -1
- package/tryUntil.cjs.js +14 -1
- package/tryUntil.esm.js +14 -1
- package/uid.cjs.js +5 -1
- package/uid.esm.js +5 -1
- package/updateLinkParams.cjs.js +7 -1
- package/updateLinkParams.esm.js +7 -1
- package/updateUrlQueryParams.cjs.js +5 -1
- package/updateUrlQueryParams.esm.js +5 -1
- package/uppercase.cjs.js +6 -1
- package/uppercase.esm.js +6 -1
- package/uuid.cjs.js +6 -1
- package/uuid.esm.js +6 -1
- 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/isServerNow.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 isServerNow=()=>isUndefined(window);
|
|
5
8
|
|
|
6
9
|
export { isServerNow as default, isServerNow };
|
package/isSet.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 Set
|
|
9
|
+
*
|
|
10
|
+
* @category is
|
|
11
|
+
*/let isSet=t=>"Set"===getType.getType(t);
|
|
8
12
|
|
|
9
13
|
exports["default"] = isSet;
|
|
10
14
|
exports.isSet = isSet;
|
package/isSet.esm.js
CHANGED
package/isString.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 string
|
|
9
|
+
*
|
|
10
|
+
* @category is
|
|
11
|
+
*/let isString=r=>"String"===getType.getType(r);
|
|
8
12
|
|
|
9
13
|
exports["default"] = isString;
|
|
10
14
|
exports.isString = isString;
|
package/isString.esm.js
CHANGED
package/isSymbol.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 Symbol
|
|
9
|
+
*
|
|
10
|
+
* @category is
|
|
11
|
+
*/let isSymbol=e=>"Symbol"===getType.getType(e);
|
|
8
12
|
|
|
9
13
|
exports["default"] = isSymbol;
|
|
10
14
|
exports.isSymbol = isSymbol;
|
package/isSymbol.esm.js
CHANGED
package/isType.cjs.js
CHANGED
|
@@ -4,7 +4,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var getType = require('./getType.cjs.js');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Does a generic check to check that the given payload is of a given type.
|
|
9
|
+
* In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);
|
|
10
|
+
* It will, however, differentiate between object and null
|
|
11
|
+
*
|
|
12
|
+
* @category is
|
|
13
|
+
* @throws {TypeError} Will throw type error if type is an invalid type
|
|
14
|
+
*/let isType=(e,r)=>{if(!(r instanceof Function))throw TypeError("Type must be a function");if(!Object.prototype.hasOwnProperty.call(r,"prototype"))throw TypeError("Type is not a class");// Classes usually have names (as functions usually have names)
|
|
15
|
+
let o=r.name;return getType.getType(e)===o||!!(e&&e.constructor===r)};
|
|
8
16
|
|
|
9
17
|
exports["default"] = isType;
|
|
10
18
|
exports.isType = isType;
|
package/isType.esm.js
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { getType } from './getType.esm.js';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Does a generic check to check that the given payload is of a given type.
|
|
5
|
+
* In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);
|
|
6
|
+
* It will, however, differentiate between object and null
|
|
7
|
+
*
|
|
8
|
+
* @category is
|
|
9
|
+
* @throws {TypeError} Will throw type error if type is an invalid type
|
|
10
|
+
*/let isType=(e,r)=>{if(!(r instanceof Function))throw TypeError("Type must be a function");if(!Object.prototype.hasOwnProperty.call(r,"prototype"))throw TypeError("Type is not a class");// Classes usually have names (as functions usually have names)
|
|
11
|
+
let o=r.name;return getType(e)===o||!!(e&&e.constructor===r)};
|
|
4
12
|
|
|
5
13
|
export { isType as default, isType };
|
package/isUndefined.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 undefined
|
|
9
|
+
*
|
|
10
|
+
* @category is
|
|
11
|
+
*/let isUndefined=d=>"Undefined"===getType.getType(d);
|
|
8
12
|
|
|
9
13
|
exports["default"] = isUndefined;
|
|
10
14
|
exports.isUndefined = isUndefined;
|
package/isUndefined.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 undefined
|
|
5
|
+
*
|
|
6
|
+
* @category is
|
|
7
|
+
*/let isUndefined=d=>"Undefined"===getType(d);
|
|
4
8
|
|
|
5
9
|
export { isUndefined as default, isUndefined };
|
package/isWeakMap.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 WeakMap
|
|
9
|
+
*
|
|
10
|
+
* @category is
|
|
11
|
+
*/let isWeakMap=a=>"WeakMap"===getType.getType(a);
|
|
8
12
|
|
|
9
13
|
exports["default"] = isWeakMap;
|
|
10
14
|
exports.isWeakMap = isWeakMap;
|
package/isWeakMap.esm.js
CHANGED
package/isWeakSet.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 WeakSet
|
|
9
|
+
*
|
|
10
|
+
* @category is
|
|
11
|
+
*/let isWeakSet=t=>"WeakSet"===getType.getType(t);
|
|
8
12
|
|
|
9
13
|
exports["default"] = isWeakSet;
|
|
10
14
|
exports.isWeakSet = isWeakSet;
|
package/isWeakSet.esm.js
CHANGED
package/kbToBytes.cjs.js
CHANGED
package/kbToBytes.esm.js
CHANGED
package/lowercase.cjs.js
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Replacement for native `toLowercase` tyescript ready (type narrowing ready)
|
|
7
|
+
*
|
|
8
|
+
* @category native
|
|
9
|
+
*/let lowercase=e=>(e||"").toLowerCase();
|
|
6
10
|
|
|
7
11
|
exports["default"] = lowercase;
|
|
8
12
|
exports.lowercase = lowercase;
|
package/lowercase.esm.js
CHANGED
package/mapListBy.cjs.js
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Maps an array of objects into a map keyed with the given key
|
|
7
|
+
*
|
|
8
|
+
* @category array
|
|
9
|
+
*/let mapListBy=(e=[],t="")=>e.reduce((e,p)=>(e[p[t]]=p,e),{});
|
|
6
10
|
|
|
7
11
|
exports["default"] = mapListBy;
|
|
8
12
|
exports.mapListBy = mapListBy;
|
package/mapListBy.esm.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Maps an array of objects into a map keyed with the given key
|
|
3
|
+
*
|
|
4
|
+
* @category array
|
|
5
|
+
*/let mapListBy=(e=[],t="")=>e.reduce((e,p)=>(e[p[t]]=p,e),{});
|
|
2
6
|
|
|
3
7
|
export { mapListBy as default, mapListBy };
|
package/matchSorter.cjs.js
CHANGED
|
@@ -7,7 +7,96 @@ var removeAccents = require('./removeAccents.cjs.js');
|
|
|
7
7
|
require('./getType.cjs.js');
|
|
8
8
|
require('./accentsSets.cjs.js');
|
|
9
9
|
|
|
10
|
-
let r=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue))
|
|
10
|
+
let r=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue)),/**
|
|
11
|
+
* Takes an array of items and a value and returns a new array with the items that match the given value
|
|
12
|
+
* @param {Array} items - the items to sort
|
|
13
|
+
* @param {String} value - the value to use for ranking
|
|
14
|
+
* @param {Object} options - Some options to configure the sorter
|
|
15
|
+
* @return {Array} - the new sorted array
|
|
16
|
+
*/l=(e,t,l={})=>{let{keys:u,threshold:a=1,baseSort:o=r,sorter:s=e=>e.sort((e,t)=>i(e,t,o))}=l;return s(e.reduce(function(e,r,o){let i=n(r,u,t,l),{rank:s,keyThreshold:h=a}=i;return s>=h&&e.push({...i,item:r,index:o}),e},[])).map(({item:e})=>e)},/**
|
|
17
|
+
* Gets the highest ranking for value for the given item based on its values for the given keys
|
|
18
|
+
* @param {*} item - the item to rank
|
|
19
|
+
* @param {Array} keys - the keys to get values from the item for the ranking
|
|
20
|
+
* @param {String} value - the value to rank against
|
|
21
|
+
* @param {Object} options - options to control the ranking
|
|
22
|
+
* @return {{rank: Number, keyIndex: Number, keyThreshold: Number}} - the highest ranking
|
|
23
|
+
*/n=(e,t,r,l)=>t?c(e,t).reduce(({rank:e,rankedValue:t,keyIndex:n,keyThreshold:a},{itemValue:o,attributes:i},s)=>{let h=u(o,r,l),f=t,{minRanking:c,maxRanking:d,threshold:k}=i;return h<c&&h>=1?h=c:h>d&&(h=d),h>e&&(e=h,n=s,a=k,f=o),{rankedValue:f,rank:e,keyIndex:n,keyThreshold:a}},{rankedValue:e,rank:0,keyIndex:-1,keyThreshold:l.threshold}):{// ends up being duplicate of 'item' in matches but consistent
|
|
24
|
+
rankedValue:// if keys is not specified, then we assume the item given is ready to be matched
|
|
25
|
+
e,rank:u(e,r,l),keyIndex:-1,keyThreshold:l.threshold},/**
|
|
26
|
+
* Gives a rankings score based on how well the two strings match.
|
|
27
|
+
* @param {String} testString - the string to test against
|
|
28
|
+
* @param {String} stringToRank - the string to rank
|
|
29
|
+
* @param {Object} options - options for the match (like keepDiacritics for comparison)
|
|
30
|
+
* @returns {Number} the ranking for how well stringToRank matches testString
|
|
31
|
+
*/u=(e,t,r)=>// too long
|
|
32
|
+
(e=s(e,r),(t=s(t,r)).length>e.length)?0:// case sensitive equals
|
|
33
|
+
e===t?7:// case insensitive equals
|
|
34
|
+
// Lower casing before further comparison
|
|
35
|
+
(e=e.toLowerCase())===(t=t.toLowerCase())?6:// starts with
|
|
36
|
+
e.startsWith(t)?5:// word starts with
|
|
37
|
+
e.includes(` ${t}`)?4:// contains
|
|
38
|
+
e.includes(t)?3:1===t.length?0:// If the only character in the given stringToRank
|
|
39
|
+
// isn't even contained in the testString, then
|
|
40
|
+
// it's definitely not a match.
|
|
41
|
+
// acronym
|
|
42
|
+
a(e).includes(t)?2:// will return a number between RANKING_MATCHES and
|
|
43
|
+
// RANKING_MATCHES + 1 depending on how close of a match it is.
|
|
44
|
+
o(e,t),/**
|
|
45
|
+
* Generates an acronym for a string.
|
|
46
|
+
*
|
|
47
|
+
* @param {String} string the string for which to produce the acronym
|
|
48
|
+
* @returns {String} the acronym
|
|
49
|
+
*/a=e=>{let t="";return e.split(" ").forEach(e=>{e.split("-").forEach(e=>{t+=e.substring(0,1);});}),t},/**
|
|
50
|
+
* Returns a score based on how spread apart the
|
|
51
|
+
* characters from the stringToRank are within the testString.
|
|
52
|
+
* A number close to RANKING_MATCHES represents a loose match. A number close
|
|
53
|
+
* to RANKING_MATCHES + 1 represents a tighter match.
|
|
54
|
+
* @param {String} testString - the string to test against
|
|
55
|
+
* @param {String} stringToRank - the string to rank
|
|
56
|
+
* @returns {Number} the number between RANKING_MATCHES and
|
|
57
|
+
* RANKING_MATCHES + 1 for how well stringToRank matches testString
|
|
58
|
+
*/o=(e,t)=>{let r=0,l=0;function n(e,t,l){for(let n=l,u=t.length;n<u;n++)if(t[n]===e)return r+=1,n+1;return -1}let u=n(t[0],e,0);if(u<0)return 0;l=u;for(let r=1,u=t.length;r<u;r++)if(!((l=n(t[r],e,l))>-1))return 0;return 1+1/(l-u)*(r/t.length)},/**
|
|
59
|
+
* Sorts items that have a rank, index, and keyIndex
|
|
60
|
+
* @param {Object} a - the first item to sort
|
|
61
|
+
* @param {Object} b - the second item to sort
|
|
62
|
+
* @return {Number} -1 if a should come first, 1 if b should come first, 0 if equal
|
|
63
|
+
*/i=(e,t,r)=>{let{rank:l,keyIndex:n}=e,{rank:u,keyIndex:a}=t;return l!==u?l>u?-1:1:n===a?// use the base sort function as a tie-breaker
|
|
64
|
+
r(e,t):n<a?-1:1},/**
|
|
65
|
+
* Prepares value for comparison by stringifying it, removing diacritics (if specified)
|
|
66
|
+
* @param {String} value - the value to clean
|
|
67
|
+
* @param {Object} options - {keepDiacritics: whether to remove diacritics}
|
|
68
|
+
* @return {String} the prepared value
|
|
69
|
+
*/s=(e,{keepDiacritics:r})=>(// value might not actually be a string at this point (we don't get to choose)
|
|
70
|
+
// so part of preparing the value for comparison is ensure that it is a string
|
|
71
|
+
e=`${e}`,// toString
|
|
72
|
+
r||(e=removeAccents.removeAccents(e)),e),/**
|
|
73
|
+
* Gets value for key in item at arbitrarily nested keypath
|
|
74
|
+
* @param {Object} item - the item
|
|
75
|
+
* @param {Object|Function} key - the potentially nested keypath or property callback
|
|
76
|
+
* @return {Array} - an array containing the value(s) at the nested keypath
|
|
77
|
+
*/h=(e,t)=>{let r;if("object"==typeof t&&(t=t.key),"function"==typeof t)r=t(e);else if(null==e)r=null;else if(Object.hasOwnProperty.call(e,t))r=e[t];else {if(t.includes("."))// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
78
|
+
return f(t,e);r=null;}return(// because `value` can also be undefined
|
|
79
|
+
null==r?[]:Array.isArray(r)?r:[String(r)])},/**
|
|
80
|
+
* Given path: "foo.bar.baz"
|
|
81
|
+
* And item: {foo: {bar: {baz: 'buzz'}}}
|
|
82
|
+
* -> 'buzz'
|
|
83
|
+
* @param path a dot-separated set of keys
|
|
84
|
+
* @param item the item to get the value from
|
|
85
|
+
*/f=(e,t)=>{let r=e.split("."),l=[t];for(let e=0,t=r.length;e<t;e++){let t=r[e],n=[];for(let e=0,r=l.length;e<r;e++){let r=l[e];if(null!=r){if(Object.hasOwnProperty.call(r,t)){let e=r[t];null!=e&&n.push(e);}else "*"===t&&// ensure that values is an array
|
|
86
|
+
(n=n.concat(r));}}l=n;}return Array.isArray(l[0])?// keep allowing the implicit wildcard for an array of strings at the end of
|
|
87
|
+
// the path; don't use `.flat()` because that's not available in node.js v10
|
|
88
|
+
[].concat(...l):// Based on our logic it should be an array of strings by now...
|
|
89
|
+
// assuming the user's path terminated in strings
|
|
90
|
+
l},/**
|
|
91
|
+
* Gets all the values for the given keys in the given item and returns an array of those values
|
|
92
|
+
* @param item - the item from which the values will be retrieved
|
|
93
|
+
* @param keys - the keys to use to retrieve the values
|
|
94
|
+
* @return objects with {itemValue, attributes}
|
|
95
|
+
*/c=(e,t)=>{let r=[];for(let l=0,n=t.length;l<n;l++){let n=t[l],u=k(n),a=h(e,n);for(let e=0,t=a.length;e<t;e++)r.push({itemValue:a[e],attributes:u});}return r},d={maxRanking:1/0,minRanking:-1/0},/**
|
|
96
|
+
* Gets all the attributes for the given key
|
|
97
|
+
* @param key - the key from which the attributes will be retrieved
|
|
98
|
+
* @return object containing the key's attributes
|
|
99
|
+
*/k=t=>isString.isString(t)?d:{...d,...t};
|
|
11
100
|
|
|
12
101
|
exports["default"] = l;
|
|
13
102
|
exports.defaultBaseSortFn = r;
|
package/matchSorter.esm.js
CHANGED
|
@@ -3,6 +3,95 @@ import { removeAccents } from './removeAccents.esm.js';
|
|
|
3
3
|
import './getType.esm.js';
|
|
4
4
|
import './accentsSets.esm.js';
|
|
5
5
|
|
|
6
|
-
let r=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue))
|
|
6
|
+
let r=(e,t)=>String(e.rankedValue).localeCompare(String(t.rankedValue)),/**
|
|
7
|
+
* Takes an array of items and a value and returns a new array with the items that match the given value
|
|
8
|
+
* @param {Array} items - the items to sort
|
|
9
|
+
* @param {String} value - the value to use for ranking
|
|
10
|
+
* @param {Object} options - Some options to configure the sorter
|
|
11
|
+
* @return {Array} - the new sorted array
|
|
12
|
+
*/l=(e,t,l={})=>{let{keys:u,threshold:a=1,baseSort:o=r,sorter:s=e=>e.sort((e,t)=>i(e,t,o))}=l;return s(e.reduce(function(e,r,o){let i=n(r,u,t,l),{rank:s,keyThreshold:h=a}=i;return s>=h&&e.push({...i,item:r,index:o}),e},[])).map(({item:e})=>e)},/**
|
|
13
|
+
* Gets the highest ranking for value for the given item based on its values for the given keys
|
|
14
|
+
* @param {*} item - the item to rank
|
|
15
|
+
* @param {Array} keys - the keys to get values from the item for the ranking
|
|
16
|
+
* @param {String} value - the value to rank against
|
|
17
|
+
* @param {Object} options - options to control the ranking
|
|
18
|
+
* @return {{rank: Number, keyIndex: Number, keyThreshold: Number}} - the highest ranking
|
|
19
|
+
*/n=(e,t,r,l)=>t?c(e,t).reduce(({rank:e,rankedValue:t,keyIndex:n,keyThreshold:a},{itemValue:o,attributes:i},s)=>{let h=u(o,r,l),f=t,{minRanking:c,maxRanking:d,threshold:k}=i;return h<c&&h>=1?h=c:h>d&&(h=d),h>e&&(e=h,n=s,a=k,f=o),{rankedValue:f,rank:e,keyIndex:n,keyThreshold:a}},{rankedValue:e,rank:0,keyIndex:-1,keyThreshold:l.threshold}):{// ends up being duplicate of 'item' in matches but consistent
|
|
20
|
+
rankedValue:// if keys is not specified, then we assume the item given is ready to be matched
|
|
21
|
+
e,rank:u(e,r,l),keyIndex:-1,keyThreshold:l.threshold},/**
|
|
22
|
+
* Gives a rankings score based on how well the two strings match.
|
|
23
|
+
* @param {String} testString - the string to test against
|
|
24
|
+
* @param {String} stringToRank - the string to rank
|
|
25
|
+
* @param {Object} options - options for the match (like keepDiacritics for comparison)
|
|
26
|
+
* @returns {Number} the ranking for how well stringToRank matches testString
|
|
27
|
+
*/u=(e,t,r)=>// too long
|
|
28
|
+
(e=s(e,r),(t=s(t,r)).length>e.length)?0:// case sensitive equals
|
|
29
|
+
e===t?7:// case insensitive equals
|
|
30
|
+
// Lower casing before further comparison
|
|
31
|
+
(e=e.toLowerCase())===(t=t.toLowerCase())?6:// starts with
|
|
32
|
+
e.startsWith(t)?5:// word starts with
|
|
33
|
+
e.includes(` ${t}`)?4:// contains
|
|
34
|
+
e.includes(t)?3:1===t.length?0:// If the only character in the given stringToRank
|
|
35
|
+
// isn't even contained in the testString, then
|
|
36
|
+
// it's definitely not a match.
|
|
37
|
+
// acronym
|
|
38
|
+
a(e).includes(t)?2:// will return a number between RANKING_MATCHES and
|
|
39
|
+
// RANKING_MATCHES + 1 depending on how close of a match it is.
|
|
40
|
+
o(e,t),/**
|
|
41
|
+
* Generates an acronym for a string.
|
|
42
|
+
*
|
|
43
|
+
* @param {String} string the string for which to produce the acronym
|
|
44
|
+
* @returns {String} the acronym
|
|
45
|
+
*/a=e=>{let t="";return e.split(" ").forEach(e=>{e.split("-").forEach(e=>{t+=e.substring(0,1);});}),t},/**
|
|
46
|
+
* Returns a score based on how spread apart the
|
|
47
|
+
* characters from the stringToRank are within the testString.
|
|
48
|
+
* A number close to RANKING_MATCHES represents a loose match. A number close
|
|
49
|
+
* to RANKING_MATCHES + 1 represents a tighter match.
|
|
50
|
+
* @param {String} testString - the string to test against
|
|
51
|
+
* @param {String} stringToRank - the string to rank
|
|
52
|
+
* @returns {Number} the number between RANKING_MATCHES and
|
|
53
|
+
* RANKING_MATCHES + 1 for how well stringToRank matches testString
|
|
54
|
+
*/o=(e,t)=>{let r=0,l=0;function n(e,t,l){for(let n=l,u=t.length;n<u;n++)if(t[n]===e)return r+=1,n+1;return -1}let u=n(t[0],e,0);if(u<0)return 0;l=u;for(let r=1,u=t.length;r<u;r++)if(!((l=n(t[r],e,l))>-1))return 0;return 1+1/(l-u)*(r/t.length)},/**
|
|
55
|
+
* Sorts items that have a rank, index, and keyIndex
|
|
56
|
+
* @param {Object} a - the first item to sort
|
|
57
|
+
* @param {Object} b - the second item to sort
|
|
58
|
+
* @return {Number} -1 if a should come first, 1 if b should come first, 0 if equal
|
|
59
|
+
*/i=(e,t,r)=>{let{rank:l,keyIndex:n}=e,{rank:u,keyIndex:a}=t;return l!==u?l>u?-1:1:n===a?// use the base sort function as a tie-breaker
|
|
60
|
+
r(e,t):n<a?-1:1},/**
|
|
61
|
+
* Prepares value for comparison by stringifying it, removing diacritics (if specified)
|
|
62
|
+
* @param {String} value - the value to clean
|
|
63
|
+
* @param {Object} options - {keepDiacritics: whether to remove diacritics}
|
|
64
|
+
* @return {String} the prepared value
|
|
65
|
+
*/s=(e,{keepDiacritics:r})=>(// value might not actually be a string at this point (we don't get to choose)
|
|
66
|
+
// so part of preparing the value for comparison is ensure that it is a string
|
|
67
|
+
e=`${e}`,// toString
|
|
68
|
+
r||(e=removeAccents(e)),e),/**
|
|
69
|
+
* Gets value for key in item at arbitrarily nested keypath
|
|
70
|
+
* @param {Object} item - the item
|
|
71
|
+
* @param {Object|Function} key - the potentially nested keypath or property callback
|
|
72
|
+
* @return {Array} - an array containing the value(s) at the nested keypath
|
|
73
|
+
*/h=(e,t)=>{let r;if("object"==typeof t&&(t=t.key),"function"==typeof t)r=t(e);else if(null==e)r=null;else if(Object.hasOwnProperty.call(e,t))r=e[t];else {if(t.includes("."))// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
74
|
+
return f(t,e);r=null;}return(// because `value` can also be undefined
|
|
75
|
+
null==r?[]:Array.isArray(r)?r:[String(r)])},/**
|
|
76
|
+
* Given path: "foo.bar.baz"
|
|
77
|
+
* And item: {foo: {bar: {baz: 'buzz'}}}
|
|
78
|
+
* -> 'buzz'
|
|
79
|
+
* @param path a dot-separated set of keys
|
|
80
|
+
* @param item the item to get the value from
|
|
81
|
+
*/f=(e,t)=>{let r=e.split("."),l=[t];for(let e=0,t=r.length;e<t;e++){let t=r[e],n=[];for(let e=0,r=l.length;e<r;e++){let r=l[e];if(null!=r){if(Object.hasOwnProperty.call(r,t)){let e=r[t];null!=e&&n.push(e);}else "*"===t&&// ensure that values is an array
|
|
82
|
+
(n=n.concat(r));}}l=n;}return Array.isArray(l[0])?// keep allowing the implicit wildcard for an array of strings at the end of
|
|
83
|
+
// the path; don't use `.flat()` because that's not available in node.js v10
|
|
84
|
+
[].concat(...l):// Based on our logic it should be an array of strings by now...
|
|
85
|
+
// assuming the user's path terminated in strings
|
|
86
|
+
l},/**
|
|
87
|
+
* Gets all the values for the given keys in the given item and returns an array of those values
|
|
88
|
+
* @param item - the item from which the values will be retrieved
|
|
89
|
+
* @param keys - the keys to use to retrieve the values
|
|
90
|
+
* @return objects with {itemValue, attributes}
|
|
91
|
+
*/c=(e,t)=>{let r=[];for(let l=0,n=t.length;l<n;l++){let n=t[l],u=k(n),a=h(e,n);for(let e=0,t=a.length;e<t;e++)r.push({itemValue:a[e],attributes:u});}return r},d={maxRanking:1/0,minRanking:-1/0},/**
|
|
92
|
+
* Gets all the attributes for the given key
|
|
93
|
+
* @param key - the key from which the attributes will be retrieved
|
|
94
|
+
* @return object containing the key's attributes
|
|
95
|
+
*/k=t=>isString(t)?d:{...d,...t};
|
|
7
96
|
|
|
8
97
|
export { l as default, r as defaultBaseSortFn, l as matchSorter };
|
package/mbToBytes.cjs.js
CHANGED
package/mbToBytes.esm.js
CHANGED
package/mergeObjects.cjs.js
CHANGED
|
@@ -7,7 +7,14 @@ var isUndefined = require('./isUndefined.cjs.js');
|
|
|
7
7
|
require('./isPlainObject.cjs.js');
|
|
8
8
|
require('./getType.cjs.js');
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Merge two or more objects together. It mutates the target object.
|
|
12
|
+
*
|
|
13
|
+
* @category object
|
|
14
|
+
* @see https://stackoverflow.com/a/46973278/1938970
|
|
15
|
+
*/let mergeObjects=(r,...i)=>{if(!i.length)return r;let m=i.shift();return void 0===m?r:(isObject.isObject(r)&&isObject.isObject(m)&&Object.keys(m).forEach(i=>{isObject.isObject(m[i])?(r[i]||(r[i]={}),mergeObjects(r[i],m[i])):isUndefined.isUndefined(m[i])||// FIXME: assertion here should not be needed but isUndefined does not
|
|
16
|
+
// narrow the type here
|
|
17
|
+
(r[i]=m[i]);}),mergeObjects(r,...i))};
|
|
11
18
|
|
|
12
19
|
exports["default"] = mergeObjects;
|
|
13
20
|
exports.mergeObjects = mergeObjects;
|
package/mergeObjects.esm.js
CHANGED
|
@@ -3,6 +3,13 @@ import { isUndefined } from './isUndefined.esm.js';
|
|
|
3
3
|
import './isPlainObject.esm.js';
|
|
4
4
|
import './getType.esm.js';
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Merge two or more objects together. It mutates the target object.
|
|
8
|
+
*
|
|
9
|
+
* @category object
|
|
10
|
+
* @see https://stackoverflow.com/a/46973278/1938970
|
|
11
|
+
*/let mergeObjects=(r,...i)=>{if(!i.length)return r;let m=i.shift();return void 0===m?r:(isObject(r)&&isObject(m)&&Object.keys(m).forEach(i=>{isObject(m[i])?(r[i]||(r[i]={}),mergeObjects(r[i],m[i])):isUndefined(m[i])||// FIXME: assertion here should not be needed but isUndefined does not
|
|
12
|
+
// narrow the type here
|
|
13
|
+
(r[i]=m[i]);}),mergeObjects(r,...i))};
|
|
7
14
|
|
|
8
15
|
export { mergeObjects as default, mergeObjects };
|
|
@@ -5,7 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var isNull = require('./isNull.cjs.js');
|
|
6
6
|
require('./getType.cjs.js');
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Merge query parameters objects, it *mutates* the first given object argument
|
|
10
|
+
*
|
|
11
|
+
* @category location
|
|
12
|
+
*/let mergeUrlQueryParams=(r={},l={})=>{for(let t in l){let m=l[t];r[t]&&isNull.isNull(m)?delete r[t]:r[t]=m;}return r};
|
|
9
13
|
|
|
10
14
|
exports["default"] = mergeUrlQueryParams;
|
|
11
15
|
exports.mergeUrlQueryParams = mergeUrlQueryParams;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { isNull } from './isNull.esm.js';
|
|
2
2
|
import './getType.esm.js';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Merge query parameters objects, it *mutates* the first given object argument
|
|
6
|
+
*
|
|
7
|
+
* @category location
|
|
8
|
+
*/let mergeUrlQueryParams=(r={},l={})=>{for(let t in l){let m=l[t];r[t]&&isNull(m)?delete r[t]:r[t]=m;}return r};
|
|
5
9
|
|
|
6
10
|
export { mergeUrlQueryParams as default, mergeUrlQueryParams };
|
|
@@ -2,7 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Move item from one place to another in a sortable array of objects, re-ordering
|
|
7
|
+
* the array accrodingly (no swapping of position).
|
|
8
|
+
* This is useful for drag and drop functionalities
|
|
9
|
+
*
|
|
10
|
+
* @category array
|
|
11
|
+
*/let moveSortableArrayItemByKey=(e,r,t,l)=>{let a=e.map(e=>e[r]),o=a.indexOf(t[r]),y=a.indexOf(l[r]),[m]=e.splice(o,1);return e.splice(y,0,m),[...e]};
|
|
6
12
|
|
|
7
13
|
exports["default"] = moveSortableArrayItemByKey;
|
|
8
14
|
exports.moveSortableArrayItemByKey = moveSortableArrayItemByKey;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Move item from one place to another in a sortable array of objects, re-ordering
|
|
3
|
+
* the array accrodingly (no swapping of position).
|
|
4
|
+
* This is useful for drag and drop functionalities
|
|
5
|
+
*
|
|
6
|
+
* @category array
|
|
7
|
+
*/let moveSortableArrayItemByKey=(e,r,t,l)=>{let a=e.map(e=>e[r]),o=a.indexOf(t[r]),y=a.indexOf(l[r]),[m]=e.splice(o,1);return e.splice(y,0,m),[...e]};
|
|
2
8
|
|
|
3
9
|
export { moveSortableArrayItemByKey as default, moveSortableArrayItemByKey };
|
package/noop.cjs.js
CHANGED
package/noop.esm.js
CHANGED
package/normaliseUrl.cjs.js
CHANGED
|
@@ -4,7 +4,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var removeTrailingSlash = require('./removeTrailingSlash.cjs.js');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Normalise URL, it works both for absolute and relative URLs
|
|
9
|
+
*
|
|
10
|
+
* - replaces too many consecutive slashes (except `http{s}://`)
|
|
11
|
+
* - removes the trailing slash
|
|
12
|
+
*
|
|
13
|
+
* @category location
|
|
14
|
+
* @see https://stackoverflow.com/a/40649435/1938970
|
|
15
|
+
*/let normaliseUrl=(e="")=>removeTrailingSlash.removeTrailingSlash(e.replace(/(:\/\/)|(\/)+/g,"$1$2"));
|
|
8
16
|
|
|
9
17
|
exports["default"] = normaliseUrl;
|
|
10
18
|
exports.normaliseUrl = normaliseUrl;
|