package-json-scripts-portability 0.0.2 → 0.0.4
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/README.md +60 -19
- package/dist/analyze-script.d.mts +10 -3
- package/dist/analyze-script.mjs +24 -15
- package/dist/command-checker.mjs +331 -99
- package/dist/command-usage.mjs +85 -36
- package/dist/commands.mjs +124 -5
- package/dist/context.mjs +8 -1
- package/dist/fixes.d.mts +1 -1
- package/dist/fixes.mjs +193 -49
- package/dist/line-break-checker.mjs +40 -7
- package/dist/messages.mjs +9 -1
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/array/sorted-array-insertion-index-with.mjs +33 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/array/sorted-array-insertion-index.mjs +10 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/semver/is-semver-in-range.mjs +5 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/semver/parse-semver.mjs +26 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/string/substring-after.mjs +24 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/_internal/isUnsafeProperty.mjs +18 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/_internal/setOwnValue.mjs +23 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/_internal/toPropertyKey.mjs +16 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/_internal/baseToString.mjs +26 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/_internal/hasOwn.mjs +13 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/_internal/isDeepKey.mjs +39 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/_internal/isIndex.mjs +10 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/_internal/tags.mjs +2 -1
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/_internal/toKey.mjs +15 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/array/sortedIndex.mjs +36 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/array/sortedIndexBy.mjs +54 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/array/sortedLastIndex.mjs +34 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/array/sortedLastIndexBy.mjs +21 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/function/identity.mjs +5 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/object/cloneDeep.mjs +52 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/object/cloneDeepWith.mjs +179 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/object/get.mjs +67 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/object/has.mjs +53 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/object/property.mjs +26 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isArguments.mjs +26 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isBuffer.mjs +24 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isMatch.mjs +34 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isMatchWith.mjs +163 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isNaN.mjs +18 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isNil.mjs +24 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isNumber.mjs +24 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isObjectLike.mjs +28 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isSymbol.mjs +19 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isTypedArray.mjs +21 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/matches.mjs +36 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/matchesProperty.mjs +47 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/util/iteratee.mjs +46 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/util/toPath.mjs +75 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/util/toString.mjs +23 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/function/identity.mjs +24 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/predicate/isEqualWith.mjs +1 -2
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/predicate/isNil.mjs +24 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/predicate/isNull.mjs +25 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/predicate/isPrimitive.mjs +26 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/predicate/isSymbol.mjs +28 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/predicate/isTypedArray.mjs +20 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/predicate/isUndefined.mjs +25 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/remeda/dist/binarySearchCutoffIndex-Bu-OMJ0Z.mjs +26 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/remeda/dist/sortedIndexWith.mjs +7 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/verkit/dist/comparison-CmVirWIW.mjs +108 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/verkit/dist/range-C5wjdo9a.mjs +164 -0
- package/dist/node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/verkit/dist/set-BGFWKKE8.mjs +38 -0
- package/dist/redirection-checker.mjs +76 -24
- package/dist/reporter.mjs +63 -18
- package/dist/runners.d.mts +2 -5
- package/dist/runners.mjs +103 -22
- package/dist/script-analyzer.mjs +457 -155
- package/dist/word-checker.mjs +232 -103
- package/dist/words.mjs +34 -7
- package/package.json +27 -23
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/_internal/isDeepKey.mjs
|
|
2
|
+
/** Matches any deep property path. Examples: `a.b`, `a[0]`, `a["b"]` */
|
|
3
|
+
const regexIsDeepProp = /\.|(\[(?:[^[\]]*|(["'])(?:(?!\2)[^\\]|\\.)*?\2)\])/;
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a given key is a deep key.
|
|
6
|
+
*
|
|
7
|
+
* A deep key is a string that contains a dot (.) or square brackets with a property accessor.
|
|
8
|
+
*
|
|
9
|
+
* @param {PropertyKey} key - The key to check.
|
|
10
|
+
* @returns {boolean} - Returns true if the key is a deep key, otherwise false.
|
|
11
|
+
*
|
|
12
|
+
* Examples:
|
|
13
|
+
*
|
|
14
|
+
* isDeepKey('a.b') // true
|
|
15
|
+
* isDeepKey('a[b]') // true
|
|
16
|
+
* isDeepKey('a') // false
|
|
17
|
+
* isDeepKey(123) // false
|
|
18
|
+
* isDeepKey('a.b.c') // true
|
|
19
|
+
* isDeepKey('a[b][c]') // true
|
|
20
|
+
* isDeepKey('a.') // false
|
|
21
|
+
* isDeepKey('.a') // false
|
|
22
|
+
* isDeepKey('a[b') // false
|
|
23
|
+
* isDeepKey('a]b]') // false
|
|
24
|
+
* isDeepKey('a][b') // false
|
|
25
|
+
* isDeepKey('') // false
|
|
26
|
+
* isDeepKey('a[0]') // true
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
function isDeepKey(key) {
|
|
30
|
+
switch (typeof key) {
|
|
31
|
+
case "number":
|
|
32
|
+
case "symbol": return false;
|
|
33
|
+
case "string":
|
|
34
|
+
if (key === "" || key.startsWith(".") || key.endsWith(".")) return false;
|
|
35
|
+
return regexIsDeepProp.test(key);
|
|
36
|
+
default: return false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export { isDeepKey };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/_internal/isIndex.mjs
|
|
2
|
+
const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
|
|
3
|
+
function isIndex(value, length = Number.MAX_SAFE_INTEGER) {
|
|
4
|
+
switch (typeof value) {
|
|
5
|
+
case "number": return Number.isInteger(value) && value >= 0 && value < length;
|
|
6
|
+
case "symbol": return false;
|
|
7
|
+
case "string": return IS_UNSIGNED_INTEGER.test(value);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export { isIndex };
|
|
@@ -3,6 +3,7 @@ const regexpTag = "[object RegExp]";
|
|
|
3
3
|
const stringTag = "[object String]";
|
|
4
4
|
const numberTag = "[object Number]";
|
|
5
5
|
const booleanTag = "[object Boolean]";
|
|
6
|
+
const argumentsTag = "[object Arguments]";
|
|
6
7
|
const symbolTag = "[object Symbol]";
|
|
7
8
|
const dateTag = "[object Date]";
|
|
8
9
|
const mapTag = "[object Map]";
|
|
@@ -24,4 +25,4 @@ const int32ArrayTag = "[object Int32Array]";
|
|
|
24
25
|
const bigInt64ArrayTag = "[object BigInt64Array]";
|
|
25
26
|
const float32ArrayTag = "[object Float32Array]";
|
|
26
27
|
const float64ArrayTag = "[object Float64Array]";
|
|
27
|
-
export { arrayBufferTag, arrayTag, bigInt64ArrayTag, bigUint64ArrayTag, booleanTag, dataViewTag, dateTag, errorTag, float32ArrayTag, float64ArrayTag, functionTag, int16ArrayTag, int32ArrayTag, int8ArrayTag, mapTag, numberTag, objectTag, regexpTag, setTag, stringTag, symbolTag, uint16ArrayTag, uint32ArrayTag, uint8ArrayTag, uint8ClampedArrayTag };
|
|
28
|
+
export { argumentsTag, arrayBufferTag, arrayTag, bigInt64ArrayTag, bigUint64ArrayTag, booleanTag, dataViewTag, dateTag, errorTag, float32ArrayTag, float64ArrayTag, functionTag, int16ArrayTag, int32ArrayTag, int8ArrayTag, mapTag, numberTag, objectTag, regexpTag, setTag, stringTag, symbolTag, uint16ArrayTag, uint32ArrayTag, uint8ArrayTag, uint8ClampedArrayTag };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/_internal/toKey.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
4
|
+
*
|
|
5
|
+
* @private
|
|
6
|
+
* @param {unknown} value The value to inspect.
|
|
7
|
+
* @returns {string|symbol} Returns the key.
|
|
8
|
+
*/
|
|
9
|
+
function toKey(value) {
|
|
10
|
+
var _value$valueOf;
|
|
11
|
+
if (typeof value === "string" || typeof value === "symbol") return value;
|
|
12
|
+
if (Object.is(value === null || value === void 0 || (_value$valueOf = value.valueOf) === null || _value$valueOf === void 0 ? void 0 : _value$valueOf.call(value), -0)) return "-0";
|
|
13
|
+
return String(value);
|
|
14
|
+
}
|
|
15
|
+
export { toKey };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isNil } from "../../predicate/isNil.mjs";
|
|
2
|
+
import { isNull } from "../../predicate/isNull.mjs";
|
|
3
|
+
import { isSymbol } from "../../predicate/isSymbol.mjs";
|
|
4
|
+
import { isNumber } from "../predicate/isNumber.mjs";
|
|
5
|
+
import { sortedIndexBy } from "./sortedIndexBy.mjs";
|
|
6
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/array/sortedIndex.mjs
|
|
7
|
+
const HALF_MAX_ARRAY_LENGTH = 0x7fffffff;
|
|
8
|
+
/**
|
|
9
|
+
* Uses a binary search to determine the lowest index at which `value`
|
|
10
|
+
* should be inserted into `array` in order to maintain its sort order.
|
|
11
|
+
*
|
|
12
|
+
* @category Array
|
|
13
|
+
* @param array The sorted array to inspect.
|
|
14
|
+
* @param value The value to evaluate.
|
|
15
|
+
* @returns Returns the index at which `value` should be inserted
|
|
16
|
+
* into `array`.
|
|
17
|
+
* @example
|
|
18
|
+
* sortedIndex([30, 50], 40)
|
|
19
|
+
* // => 1
|
|
20
|
+
*/
|
|
21
|
+
function sortedIndex(array, value) {
|
|
22
|
+
if (isNil(array)) return 0;
|
|
23
|
+
let low = 0;
|
|
24
|
+
let high = array.length;
|
|
25
|
+
if (isNumber(value) && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
|
|
26
|
+
while (low < high) {
|
|
27
|
+
const mid = low + high >>> 1;
|
|
28
|
+
const compute = array[mid];
|
|
29
|
+
if (!isNull(compute) && !isSymbol(compute) && compute < value) low = mid + 1;
|
|
30
|
+
else high = mid;
|
|
31
|
+
}
|
|
32
|
+
return high;
|
|
33
|
+
}
|
|
34
|
+
return sortedIndexBy(array, value, (value) => value);
|
|
35
|
+
}
|
|
36
|
+
export { sortedIndex };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { isNull } from "../../predicate/isNull.mjs";
|
|
2
|
+
import { isUndefined } from "../../predicate/isUndefined.mjs";
|
|
3
|
+
import { isSymbol } from "../predicate/isSymbol.mjs";
|
|
4
|
+
import { iteratee } from "../util/iteratee.mjs";
|
|
5
|
+
import { identity } from "../function/identity.mjs";
|
|
6
|
+
import { isNil } from "../predicate/isNil.mjs";
|
|
7
|
+
import { isNaN } from "../predicate/isNaN.mjs";
|
|
8
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/array/sortedIndexBy.mjs
|
|
9
|
+
const MAX_ARRAY_INDEX = 0xfffffffe;
|
|
10
|
+
/**
|
|
11
|
+
* This method is like `sortedIndex` except that it accepts `iteratee`
|
|
12
|
+
* which is invoked for `value` and each element of `array` to compute their
|
|
13
|
+
* sort ranking. The iteratee is invoked with one argument: (value).
|
|
14
|
+
*
|
|
15
|
+
* @param array The sorted array to inspect.
|
|
16
|
+
* @param value The value to evaluate.
|
|
17
|
+
* @param iteratee The iteratee invoked per element.
|
|
18
|
+
* @returns Returns the index at which `value` should be inserted
|
|
19
|
+
* into `array`.
|
|
20
|
+
* @example
|
|
21
|
+
* const objects = [{ 'n': 4 }, { 'n': 5 }]
|
|
22
|
+
* sortedIndexBy(objects, { 'n': 4 }, ({ n }) => n)
|
|
23
|
+
* // => 0
|
|
24
|
+
*/
|
|
25
|
+
function sortedIndexBy(array, value, iteratee$1 = identity, retHighest) {
|
|
26
|
+
if (isNil(array) || array.length === 0) return 0;
|
|
27
|
+
let low = 0;
|
|
28
|
+
let high = array.length;
|
|
29
|
+
const iterateeFunction = iteratee(iteratee$1);
|
|
30
|
+
const transformedValue = iterateeFunction(value);
|
|
31
|
+
const valIsNaN = isNaN(transformedValue);
|
|
32
|
+
const valIsNull = isNull(transformedValue);
|
|
33
|
+
const valIsSymbol = isSymbol(transformedValue);
|
|
34
|
+
const valIsUndefined = isUndefined(transformedValue);
|
|
35
|
+
while (low < high) {
|
|
36
|
+
let setLow;
|
|
37
|
+
const mid = Math.floor((low + high) / 2);
|
|
38
|
+
const computed = iterateeFunction(array[mid]);
|
|
39
|
+
const othIsDefined = !isUndefined(computed);
|
|
40
|
+
const othIsNull = isNull(computed);
|
|
41
|
+
const othIsReflexive = !isNaN(computed);
|
|
42
|
+
const othIsSymbol = isSymbol(computed);
|
|
43
|
+
if (valIsNaN) setLow = retHighest || othIsReflexive;
|
|
44
|
+
else if (valIsUndefined) setLow = othIsReflexive && (retHighest || othIsDefined);
|
|
45
|
+
else if (valIsNull) setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
|
|
46
|
+
else if (valIsSymbol) setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
|
|
47
|
+
else if (othIsNull || othIsSymbol) setLow = false;
|
|
48
|
+
else setLow = retHighest ? computed <= transformedValue : computed < transformedValue;
|
|
49
|
+
if (setLow) low = mid + 1;
|
|
50
|
+
else high = mid;
|
|
51
|
+
}
|
|
52
|
+
return Math.min(high, MAX_ARRAY_INDEX);
|
|
53
|
+
}
|
|
54
|
+
export { sortedIndexBy };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { isNil } from "../../predicate/isNil.mjs";
|
|
2
|
+
import { isNull } from "../../predicate/isNull.mjs";
|
|
3
|
+
import { isSymbol } from "../../predicate/isSymbol.mjs";
|
|
4
|
+
import { isNumber } from "../predicate/isNumber.mjs";
|
|
5
|
+
import { sortedLastIndexBy } from "./sortedLastIndexBy.mjs";
|
|
6
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/array/sortedLastIndex.mjs
|
|
7
|
+
const HALF_MAX_ARRAY_LENGTH = 0x7fffffff;
|
|
8
|
+
/**
|
|
9
|
+
* Uses a binary search to determine the highest index at which `value`
|
|
10
|
+
* should be inserted into `array` in order to maintain its sort order.
|
|
11
|
+
*
|
|
12
|
+
* @category Array
|
|
13
|
+
* @param array The sorted array to inspect.
|
|
14
|
+
* @param value The value to evaluate.
|
|
15
|
+
* @returns Returns the index at which `value` should be inserted
|
|
16
|
+
* into `array`.
|
|
17
|
+
* @example
|
|
18
|
+
* sortedLastIndex([4, 5, 5, 5, 6], 5)
|
|
19
|
+
* // => 4
|
|
20
|
+
*/
|
|
21
|
+
function sortedLastIndex(array, value) {
|
|
22
|
+
if (isNil(array)) return 0;
|
|
23
|
+
let high = array.length;
|
|
24
|
+
if (!isNumber(value) || Number.isNaN(value) || high > HALF_MAX_ARRAY_LENGTH) return sortedLastIndexBy(array, value, (value) => value);
|
|
25
|
+
let low = 0;
|
|
26
|
+
while (low < high) {
|
|
27
|
+
const mid = low + high >>> 1;
|
|
28
|
+
const compute = array[mid];
|
|
29
|
+
if (!isNull(compute) && !isSymbol(compute) && compute <= value) low = mid + 1;
|
|
30
|
+
else high = mid;
|
|
31
|
+
}
|
|
32
|
+
return high;
|
|
33
|
+
}
|
|
34
|
+
export { sortedLastIndex };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { sortedIndexBy } from "./sortedIndexBy.mjs";
|
|
2
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/array/sortedLastIndexBy.mjs
|
|
3
|
+
/**
|
|
4
|
+
* This method is like `sortedLastIndex` except that it accepts `iteratee`
|
|
5
|
+
* which is invoked for `value` and each element of `array` to compute their
|
|
6
|
+
* sort ranking. The iteratee is invoked with one argument: (value).
|
|
7
|
+
*
|
|
8
|
+
* @param array The sorted array to inspect.
|
|
9
|
+
* @param value The value to evaluate.
|
|
10
|
+
* @param iteratee The iteratee invoked per element.
|
|
11
|
+
* @returns Returns the highest index at which `value` should be inserted
|
|
12
|
+
* into `array`.
|
|
13
|
+
* @example
|
|
14
|
+
* const objects = [{ 'n': 4 }, { 'n': 5 }]
|
|
15
|
+
* sortedLastIndexBy(objects, { 'n': 4 }, ({ n }) => n)
|
|
16
|
+
* // => 1
|
|
17
|
+
*/
|
|
18
|
+
function sortedLastIndexBy(array, value, iteratee) {
|
|
19
|
+
return sortedIndexBy(array, value, iteratee, true);
|
|
20
|
+
}
|
|
21
|
+
export { sortedLastIndexBy };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { cloneDeepWith } from "./cloneDeepWith.mjs";
|
|
2
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/object/cloneDeep.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Creates a deep clone of the given object.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The type of the object.
|
|
7
|
+
* @param obj - The object to clone.
|
|
8
|
+
* @returns A deep clone of the given object.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* // Clone a primitive value
|
|
12
|
+
* const num = 29;
|
|
13
|
+
* const clonedNum = clone(num);
|
|
14
|
+
* console.log(clonedNum); // 29
|
|
15
|
+
* console.log(clonedNum === num); // true
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Clone an array
|
|
19
|
+
* const arr = [1, 2, 3];
|
|
20
|
+
* const clonedArr = cloneDeep(arr);
|
|
21
|
+
* console.log(clonedArr); // [1, 2, 3]
|
|
22
|
+
* console.log(clonedArr === arr); // false
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Clone an array with nested objects
|
|
26
|
+
* const arr = [1, { a: 1 }, [1, 2, 3]];
|
|
27
|
+
* const clonedArr = cloneDeep(arr);
|
|
28
|
+
* arr[1].a = 2;
|
|
29
|
+
* console.log(arr); // [1, { a: 2 }, [1, 2, 3]]
|
|
30
|
+
* console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]]
|
|
31
|
+
* console.log(clonedArr === arr); // false
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* // Clone an object
|
|
35
|
+
* const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };
|
|
36
|
+
* const clonedObj = cloneDeep(obj);
|
|
37
|
+
* console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }
|
|
38
|
+
* console.log(clonedObj === obj); // false
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* // Clone an object with nested objects
|
|
42
|
+
* const obj = { a: 1, b: { c: 1 } };
|
|
43
|
+
* const clonedObj = cloneDeep(obj);
|
|
44
|
+
* obj.b.c = 2;
|
|
45
|
+
* console.log(obj); // { a: 1, b: { c: 2 } }
|
|
46
|
+
* console.log(clonedObj); // { a: 1, b: { c: 1 } }
|
|
47
|
+
* console.log(clonedObj === obj); // false
|
|
48
|
+
*/
|
|
49
|
+
function cloneDeep(obj) {
|
|
50
|
+
return cloneDeepWith(obj);
|
|
51
|
+
}
|
|
52
|
+
export { cloneDeep };
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { setOwnValue } from "../../_internal/setOwnValue.mjs";
|
|
2
|
+
import { isPrimitive } from "../../predicate/isPrimitive.mjs";
|
|
3
|
+
import { getSymbols } from "../_internal/getSymbols.mjs";
|
|
4
|
+
import { getTag } from "../_internal/getTag.mjs";
|
|
5
|
+
import { argumentsTag, arrayBufferTag, arrayTag, booleanTag, dataViewTag, dateTag, float32ArrayTag, float64ArrayTag, int16ArrayTag, int32ArrayTag, int8ArrayTag, mapTag, numberTag, objectTag, regexpTag, setTag, stringTag, symbolTag, uint16ArrayTag, uint32ArrayTag, uint8ArrayTag, uint8ClampedArrayTag } from "../_internal/tags.mjs";
|
|
6
|
+
import { hasOwn } from "../_internal/hasOwn.mjs";
|
|
7
|
+
import { isBuffer } from "../predicate/isBuffer.mjs";
|
|
8
|
+
import { isTypedArray } from "../predicate/isTypedArray.mjs";
|
|
9
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/object/cloneDeepWith.mjs
|
|
10
|
+
/**
|
|
11
|
+
* Creates a deep clone of the given object using a customizer function.
|
|
12
|
+
*
|
|
13
|
+
* @template T - The type of the object.
|
|
14
|
+
* @param obj - The object to clone.
|
|
15
|
+
* @param [cloneValue] - A function to customize the cloning process.
|
|
16
|
+
* @returns A deep clone of the given object.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Clone a primitive value
|
|
20
|
+
* const num = 29;
|
|
21
|
+
* const clonedNum = cloneDeepWith(num);
|
|
22
|
+
* console.log(clonedNum); // 29
|
|
23
|
+
* console.log(clonedNum === num); // true
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Clone an object with a customizer
|
|
27
|
+
* const obj = { a: 1, b: 2 };
|
|
28
|
+
* const clonedObj = cloneDeepWith(obj, (value) => {
|
|
29
|
+
* if (typeof value === 'number') {
|
|
30
|
+
* return value * 2; // Double the number
|
|
31
|
+
* }
|
|
32
|
+
* });
|
|
33
|
+
* console.log(clonedObj); // { a: 2, b: 4 }
|
|
34
|
+
* console.log(clonedObj === obj); // false
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* // Clone an array with a customizer
|
|
38
|
+
* const arr = [1, 2, 3];
|
|
39
|
+
* const clonedArr = cloneDeepWith(arr, (value) => {
|
|
40
|
+
* if (typeof value === 'number') {
|
|
41
|
+
* return value + 1; // Increment each number
|
|
42
|
+
* }
|
|
43
|
+
* });
|
|
44
|
+
* console.log(clonedArr); // [2, 3, 4]
|
|
45
|
+
* console.log(clonedArr === arr); // false
|
|
46
|
+
*/
|
|
47
|
+
function cloneDeepWith(obj, customizer) {
|
|
48
|
+
return cloneDeepWithImpl(obj, void 0, obj, /* @__PURE__ */ new Map(), customizer);
|
|
49
|
+
}
|
|
50
|
+
function cloneDeepWithImpl(valueToClone, keyToClone, objectToClone, stack, customizer) {
|
|
51
|
+
if (customizer != null) {
|
|
52
|
+
const cloned = customizer(valueToClone, keyToClone, objectToClone, stack);
|
|
53
|
+
if (cloned !== void 0) return cloned;
|
|
54
|
+
}
|
|
55
|
+
if (isPrimitive(valueToClone)) return valueToClone;
|
|
56
|
+
if (stack.has(valueToClone)) return stack.get(valueToClone);
|
|
57
|
+
if (Array.isArray(valueToClone)) {
|
|
58
|
+
const result = new Array(valueToClone.length);
|
|
59
|
+
stack.set(valueToClone, result);
|
|
60
|
+
for (let i = 0; i < valueToClone.length; i++) result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, customizer);
|
|
61
|
+
if (hasOwn(valueToClone, "index")) result.index = valueToClone.index;
|
|
62
|
+
if (hasOwn(valueToClone, "input")) result.input = valueToClone.input;
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
if (valueToClone instanceof Date) return new Date(valueToClone.getTime());
|
|
66
|
+
if (valueToClone instanceof RegExp) {
|
|
67
|
+
const result = new RegExp(valueToClone.source, valueToClone.flags);
|
|
68
|
+
result.lastIndex = valueToClone.lastIndex;
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
if (valueToClone instanceof Map) {
|
|
72
|
+
const result = /* @__PURE__ */ new Map();
|
|
73
|
+
stack.set(valueToClone, result);
|
|
74
|
+
valueToClone.forEach((value, key) => {
|
|
75
|
+
result.set(key, cloneDeepWithImpl(value, key, objectToClone, stack, customizer));
|
|
76
|
+
});
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
if (valueToClone instanceof Set) {
|
|
80
|
+
const result = /* @__PURE__ */ new Set();
|
|
81
|
+
stack.set(valueToClone, result);
|
|
82
|
+
valueToClone.forEach((value) => {
|
|
83
|
+
result.add(cloneDeepWithImpl(value, void 0, objectToClone, stack, customizer));
|
|
84
|
+
});
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
87
|
+
if (isBuffer(valueToClone)) return valueToClone.subarray();
|
|
88
|
+
if (isTypedArray(valueToClone)) {
|
|
89
|
+
const result = new (Object.getPrototypeOf(valueToClone)).constructor(valueToClone.length);
|
|
90
|
+
stack.set(valueToClone, result);
|
|
91
|
+
for (let i = 0; i < valueToClone.length; i++) result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, customizer);
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
if (valueToClone instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && valueToClone instanceof SharedArrayBuffer) return valueToClone.slice(0);
|
|
95
|
+
if (valueToClone instanceof DataView) {
|
|
96
|
+
const result = new DataView(valueToClone.buffer.slice(0), valueToClone.byteOffset, valueToClone.byteLength);
|
|
97
|
+
stack.set(valueToClone, result);
|
|
98
|
+
copyProperties(result, valueToClone, objectToClone, stack, customizer);
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
if (typeof File !== "undefined" && valueToClone instanceof File) {
|
|
102
|
+
const result = new File([valueToClone], valueToClone.name, { type: valueToClone.type });
|
|
103
|
+
stack.set(valueToClone, result);
|
|
104
|
+
copyProperties(result, valueToClone, objectToClone, stack, customizer);
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
if (typeof Blob !== "undefined" && valueToClone instanceof Blob) {
|
|
108
|
+
const result = new Blob([valueToClone], { type: valueToClone.type });
|
|
109
|
+
stack.set(valueToClone, result);
|
|
110
|
+
copyProperties(result, valueToClone, objectToClone, stack, customizer);
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
const tag = getTag(valueToClone);
|
|
114
|
+
if (tag === "[object Error]") {
|
|
115
|
+
if (valueToClone === objectToClone) return {};
|
|
116
|
+
return valueToClone;
|
|
117
|
+
}
|
|
118
|
+
switch (tag) {
|
|
119
|
+
case numberTag:
|
|
120
|
+
case stringTag:
|
|
121
|
+
case booleanTag: {
|
|
122
|
+
const result = new valueToClone.constructor(valueToClone.valueOf());
|
|
123
|
+
stack.set(valueToClone, result);
|
|
124
|
+
copyProperties(result, valueToClone, objectToClone, stack, customizer);
|
|
125
|
+
return result;
|
|
126
|
+
}
|
|
127
|
+
case argumentsTag: {
|
|
128
|
+
const result = {};
|
|
129
|
+
stack.set(valueToClone, result);
|
|
130
|
+
copyProperties(result, valueToClone, objectToClone, stack, customizer);
|
|
131
|
+
result.length = valueToClone.length;
|
|
132
|
+
result[Symbol.iterator] = valueToClone[Symbol.iterator];
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (typeof valueToClone === "object" && isCloneableObject(tag)) {
|
|
137
|
+
const result = tag === "[object Object]" && typeof valueToClone.constructor !== "function" ? {} : Object.create(Object.getPrototypeOf(valueToClone));
|
|
138
|
+
stack.set(valueToClone, result);
|
|
139
|
+
copyProperties(result, valueToClone, objectToClone, stack, customizer);
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
return valueToClone;
|
|
143
|
+
}
|
|
144
|
+
function copyProperties(target, source, objectToClone, stack, customizer) {
|
|
145
|
+
const keys = [...Object.keys(source), ...getSymbols(source)];
|
|
146
|
+
for (let i = 0; i < keys.length; i++) {
|
|
147
|
+
const key = keys[i];
|
|
148
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, key);
|
|
149
|
+
if (descriptor == null || descriptor.writable) setOwnValue(target, key, cloneDeepWithImpl(source[key], key, objectToClone, stack, customizer));
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function isCloneableObject(tag) {
|
|
153
|
+
switch (tag) {
|
|
154
|
+
case argumentsTag:
|
|
155
|
+
case arrayTag:
|
|
156
|
+
case arrayBufferTag:
|
|
157
|
+
case dataViewTag:
|
|
158
|
+
case booleanTag:
|
|
159
|
+
case dateTag:
|
|
160
|
+
case float32ArrayTag:
|
|
161
|
+
case float64ArrayTag:
|
|
162
|
+
case int8ArrayTag:
|
|
163
|
+
case int16ArrayTag:
|
|
164
|
+
case int32ArrayTag:
|
|
165
|
+
case mapTag:
|
|
166
|
+
case numberTag:
|
|
167
|
+
case objectTag:
|
|
168
|
+
case regexpTag:
|
|
169
|
+
case setTag:
|
|
170
|
+
case stringTag:
|
|
171
|
+
case symbolTag:
|
|
172
|
+
case uint8ArrayTag:
|
|
173
|
+
case uint8ClampedArrayTag:
|
|
174
|
+
case uint16ArrayTag:
|
|
175
|
+
case uint32ArrayTag: return true;
|
|
176
|
+
default: return false;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
export { cloneDeepWith };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { isUnsafeProperty } from "../../_internal/isUnsafeProperty.mjs";
|
|
2
|
+
import { hasOwn } from "../_internal/hasOwn.mjs";
|
|
3
|
+
import { isDeepKey } from "../_internal/isDeepKey.mjs";
|
|
4
|
+
import { toKey } from "../_internal/toKey.mjs";
|
|
5
|
+
import { toPath } from "../util/toPath.mjs";
|
|
6
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/object/get.mjs
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves the value at a given path from an object. If the resolved value is undefined, the defaultValue is returned instead.
|
|
9
|
+
*
|
|
10
|
+
* @param object - The object to query.
|
|
11
|
+
* @param path - The path of the property to get.
|
|
12
|
+
* @param [defaultValue] - The value returned if the resolved value is undefined.
|
|
13
|
+
* @returns Returns the resolved value.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const object = { a: { b: { c: 1 } } };
|
|
17
|
+
* get(object, 'a.b.c');
|
|
18
|
+
* // => 1
|
|
19
|
+
*
|
|
20
|
+
* get(object, ['a', 'b', 'c']);
|
|
21
|
+
* // => 1
|
|
22
|
+
*
|
|
23
|
+
* get(object, 'a.b.d', 'default');
|
|
24
|
+
* // => 'default'
|
|
25
|
+
*/
|
|
26
|
+
function get(object, path, defaultValue) {
|
|
27
|
+
if (object == null) return defaultValue;
|
|
28
|
+
switch (typeof path) {
|
|
29
|
+
case "string": {
|
|
30
|
+
if (isUnsafeProperty(path)) return defaultValue;
|
|
31
|
+
const result = object[path];
|
|
32
|
+
if (result === void 0) {
|
|
33
|
+
if (isDeepKey(path) && !hasOwn(object, path)) return get(object, toPath(path), defaultValue);
|
|
34
|
+
else return defaultValue;
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
case "number":
|
|
39
|
+
case "symbol": {
|
|
40
|
+
if (typeof path === "number") path = toKey(path);
|
|
41
|
+
const result = object[path];
|
|
42
|
+
if (result === void 0) return defaultValue;
|
|
43
|
+
return result;
|
|
44
|
+
}
|
|
45
|
+
default: {
|
|
46
|
+
if (Array.isArray(path)) return getWithPath(object, path, defaultValue);
|
|
47
|
+
if (Object.is(path === null || path === void 0 ? void 0 : path.valueOf(), -0)) path = "-0";
|
|
48
|
+
else path = String(path);
|
|
49
|
+
if (isUnsafeProperty(path)) return defaultValue;
|
|
50
|
+
const result = object[path];
|
|
51
|
+
if (result === void 0) return defaultValue;
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function getWithPath(object, path, defaultValue) {
|
|
57
|
+
if (path.length === 0) return defaultValue;
|
|
58
|
+
let current = object;
|
|
59
|
+
for (let index = 0; index < path.length; index++) {
|
|
60
|
+
if (current == null) return defaultValue;
|
|
61
|
+
if (isUnsafeProperty(path[index])) return defaultValue;
|
|
62
|
+
current = current[path[index]];
|
|
63
|
+
}
|
|
64
|
+
if (current === void 0) return defaultValue;
|
|
65
|
+
return current;
|
|
66
|
+
}
|
|
67
|
+
export { get };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { hasOwn } from "../_internal/hasOwn.mjs";
|
|
2
|
+
import { isDeepKey } from "../_internal/isDeepKey.mjs";
|
|
3
|
+
import { toKey } from "../_internal/toKey.mjs";
|
|
4
|
+
import { toPath } from "../util/toPath.mjs";
|
|
5
|
+
import { isIndex } from "../_internal/isIndex.mjs";
|
|
6
|
+
import { isArguments } from "../predicate/isArguments.mjs";
|
|
7
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/object/has.mjs
|
|
8
|
+
/**
|
|
9
|
+
* Checks if a given path exists within an object.
|
|
10
|
+
*
|
|
11
|
+
* You can provide the path as a single property key, an array of property keys,
|
|
12
|
+
* or a string representing a deep path.
|
|
13
|
+
*
|
|
14
|
+
* If the path is an index and the object is an array or an arguments object, the function will verify
|
|
15
|
+
* if the index is valid and within the bounds of the array or arguments object, even if the array or
|
|
16
|
+
* arguments object is sparse (i.e., not all indexes are defined).
|
|
17
|
+
*
|
|
18
|
+
* @param object - The object to query.
|
|
19
|
+
* @param path - The path to check. This can be a single property key,
|
|
20
|
+
* an array of property keys, or a string representing a deep path.
|
|
21
|
+
* @returns Returns `true` if the path exists in the object, `false` otherwise.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
*
|
|
25
|
+
* const obj = { a: { b: { c: 3 } } };
|
|
26
|
+
*
|
|
27
|
+
* has(obj, 'a'); // true
|
|
28
|
+
* has(obj, ['a', 'b']); // true
|
|
29
|
+
* has(obj, ['a', 'b', 'c']); // true
|
|
30
|
+
* has(obj, 'a.b.c'); // true
|
|
31
|
+
* has(obj, 'a.b.d'); // false
|
|
32
|
+
* has(obj, ['a', 'b', 'c', 'd']); // false
|
|
33
|
+
* has([], 0); // false
|
|
34
|
+
* has([1, 2, 3], 2); // true
|
|
35
|
+
* has([1, 2, 3], 5); // false
|
|
36
|
+
*/
|
|
37
|
+
function has(object, path) {
|
|
38
|
+
let resolvedPath;
|
|
39
|
+
if (Array.isArray(path)) resolvedPath = path;
|
|
40
|
+
else if (typeof path === "string" && isDeepKey(path) && !(path in Object(object))) resolvedPath = toPath(path);
|
|
41
|
+
else resolvedPath = [path];
|
|
42
|
+
if (resolvedPath.length === 0) return false;
|
|
43
|
+
let current = object;
|
|
44
|
+
for (let i = 0; i < resolvedPath.length; i++) {
|
|
45
|
+
const key = toKey(resolvedPath[i]);
|
|
46
|
+
if (current == null || !hasOwn(current, key)) {
|
|
47
|
+
if (!((Array.isArray(current) || isArguments(current)) && isIndex(key) && Number(key) < current.length)) return false;
|
|
48
|
+
}
|
|
49
|
+
current = current[key];
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
}
|
|
53
|
+
export { has };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { get } from "./get.mjs";
|
|
2
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/object/property.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Creates a function that returns the value at a given path of an object.
|
|
5
|
+
*
|
|
6
|
+
* @template T - The type of object.
|
|
7
|
+
* @template R - The type of the value to return.
|
|
8
|
+
* @param path - The path of the property to get.
|
|
9
|
+
* @returns Returns a new function that takes an object and returns the value at the specified path.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const getObjectValue = property('a.b.c');
|
|
13
|
+
* const result = getObjectValue({ a: { b: { c: 3 } } });
|
|
14
|
+
* console.log(result); // => 3
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const getObjectValue = property(['a', 'b', 'c']);
|
|
18
|
+
* const result = getObjectValue({ a: { b: { c: 3 } } });
|
|
19
|
+
* console.log(result); // => 3
|
|
20
|
+
*/
|
|
21
|
+
function property(path) {
|
|
22
|
+
return function(object) {
|
|
23
|
+
return get(object, path);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export { property };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { getTag } from "../_internal/getTag.mjs";
|
|
2
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isArguments.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Checks if the given value is an arguments object.
|
|
5
|
+
*
|
|
6
|
+
* This function tests whether the provided value is an arguments object or not.
|
|
7
|
+
* It returns `true` if the value is an arguments object, and `false` otherwise.
|
|
8
|
+
*
|
|
9
|
+
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an arguments object.
|
|
10
|
+
*
|
|
11
|
+
* @param value - The value to test if it is an arguments object.
|
|
12
|
+
* @returns `true` if the value is an arguments, `false` otherwise.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const args = (function() { return arguments; })();
|
|
16
|
+
* const strictArgs = (function() { 'use strict'; return arguments; })();
|
|
17
|
+
* const value = [1, 2, 3];
|
|
18
|
+
*
|
|
19
|
+
* console.log(isArguments(args)); // true
|
|
20
|
+
* console.log(isArguments(strictArgs)); // true
|
|
21
|
+
* console.log(isArguments(value)); // false
|
|
22
|
+
*/
|
|
23
|
+
function isArguments(value) {
|
|
24
|
+
return value !== null && typeof value === "object" && getTag(value) === "[object Arguments]";
|
|
25
|
+
}
|
|
26
|
+
export { isArguments };
|