package-json-scripts-portability 0.0.2 → 0.0.3
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 +58 -19
- package/dist/analyze-script.d.mts +3 -3
- package/dist/analyze-script.mjs +19 -14
- 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 +25 -21
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isBuffer as isBuffer$1 } from "../../predicate/isBuffer.mjs";
|
|
2
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isBuffer.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Checks if the given value is a Buffer instance.
|
|
5
|
+
*
|
|
6
|
+
* This function tests whether the provided value is an instance of Buffer.
|
|
7
|
+
* It returns `true` if the value is a Buffer, and `false` otherwise.
|
|
8
|
+
*
|
|
9
|
+
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `Buffer`.
|
|
10
|
+
*
|
|
11
|
+
* @param x - The value to check if it is a Buffer.
|
|
12
|
+
* @returns Returns `true` if `x` is a Buffer, else `false`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* const buffer = Buffer.from("test");
|
|
16
|
+
* console.log(isBuffer(buffer)); // true
|
|
17
|
+
*
|
|
18
|
+
* const notBuffer = "not a buffer";
|
|
19
|
+
* console.log(isBuffer(notBuffer)); // false
|
|
20
|
+
*/
|
|
21
|
+
function isBuffer(x) {
|
|
22
|
+
return isBuffer$1(x);
|
|
23
|
+
}
|
|
24
|
+
export { isBuffer };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { isMatchWith } from "./isMatchWith.mjs";
|
|
2
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isMatch.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Checks if the target matches the source by comparing their structures and values.
|
|
5
|
+
* This function supports deep comparison for objects, arrays, maps, and sets.
|
|
6
|
+
*
|
|
7
|
+
* @param target - The target value to match against.
|
|
8
|
+
* @param source - The source value to match with.
|
|
9
|
+
* @returns Returns `true` if the target matches the source, otherwise `false`.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* // Basic usage
|
|
13
|
+
* isMatch({ a: 1, b: 2 }, { a: 1 }); // true
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Matching arrays
|
|
17
|
+
* isMatch([1, 2, 3], [1, 2, 3]); // true
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* // Matching maps
|
|
21
|
+
* const targetMap = new Map([['key1', 'value1'], ['key2', 'value2']]);
|
|
22
|
+
* const sourceMap = new Map([['key1', 'value1']]);
|
|
23
|
+
* isMatch(targetMap, sourceMap); // true
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* // Matching sets
|
|
27
|
+
* const targetSet = new Set([1, 2, 3]);
|
|
28
|
+
* const sourceSet = new Set([1, 2]);
|
|
29
|
+
* isMatch(targetSet, sourceSet); // true
|
|
30
|
+
*/
|
|
31
|
+
function isMatch(target, source) {
|
|
32
|
+
return isMatchWith(target, source, () => void 0);
|
|
33
|
+
}
|
|
34
|
+
export { isMatch };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { isPrimitive } from "../../predicate/isPrimitive.mjs";
|
|
2
|
+
import { getTag } from "../_internal/getTag.mjs";
|
|
3
|
+
import { eq } from "../util/eq.mjs";
|
|
4
|
+
import { isObject } from "./isObject.mjs";
|
|
5
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isMatchWith.mjs
|
|
6
|
+
/**
|
|
7
|
+
* Performs a deep comparison between a target value and a source pattern to determine if they match,
|
|
8
|
+
* using a custom comparison function for fine-grained control over the matching logic.
|
|
9
|
+
*
|
|
10
|
+
* This function recursively traverses both values, calling the custom compare function for each
|
|
11
|
+
* property/element pair. If the compare function returns a boolean, that result is used directly.
|
|
12
|
+
* If it returns undefined, the default matching behavior continues recursively.
|
|
13
|
+
*
|
|
14
|
+
* The matching behavior varies by data type:
|
|
15
|
+
* - **Objects**: Matches if all properties in the source exist in the target and match
|
|
16
|
+
* - **Arrays**: Matches if all elements in the source array can be found in the target array (order-independent)
|
|
17
|
+
* - **Maps**: Matches if all key-value pairs in the source Map exist and match in the target Map
|
|
18
|
+
* - **Sets**: Matches if all elements in the source Set can be found in the target Set
|
|
19
|
+
* - **Functions**: Matches using strict equality, or object comparison if the function has properties
|
|
20
|
+
* - **Primitives**: Matches using strict equality
|
|
21
|
+
*
|
|
22
|
+
* Special cases:
|
|
23
|
+
* - Empty arrays, Maps, and Sets always match any target
|
|
24
|
+
* - An empty object matches any target at the top level, but at nested levels it only matches object targets
|
|
25
|
+
* - `null` and `undefined` source values have specific matching rules
|
|
26
|
+
* - Circular references are handled using an internal stack to prevent infinite recursion
|
|
27
|
+
*
|
|
28
|
+
* @param target - The value to be tested for matching
|
|
29
|
+
* @param source - The pattern/template to match against
|
|
30
|
+
* @param [compare] - Optional custom comparison function that receives:
|
|
31
|
+
* - `objValue` - The value from the target at the current path
|
|
32
|
+
* - `srcValue` - The value from the source at the current path
|
|
33
|
+
* - `key` - The property key or array index being compared
|
|
34
|
+
* - `object` - The parent object/array from the target
|
|
35
|
+
* - `source` - The parent object/array from the source
|
|
36
|
+
* - `stack` - Internal Map used for circular reference detection
|
|
37
|
+
* Should return `true` for a match, `false` for no match, or `undefined` to continue with default behavior
|
|
38
|
+
*
|
|
39
|
+
* @returns `true` if the target matches the source pattern, `false` otherwise
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* // Basic matching without custom comparator
|
|
43
|
+
* isMatchWith({ a: 1, b: 2 }, { a: 1 }); // true
|
|
44
|
+
* isMatchWith([1, 2, 3], [1, 3]); // true
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* // Custom comparison for case-insensitive string matching
|
|
48
|
+
* const caseInsensitiveCompare = (objVal, srcVal) => {
|
|
49
|
+
* if (typeof objVal === 'string' && typeof srcVal === 'string') {
|
|
50
|
+
* return objVal.toLowerCase() === srcVal.toLowerCase();
|
|
51
|
+
* }
|
|
52
|
+
* return undefined; // Use default behavior for non-strings
|
|
53
|
+
* };
|
|
54
|
+
*
|
|
55
|
+
* isMatchWith(
|
|
56
|
+
* { name: 'JOHN', age: 30 },
|
|
57
|
+
* { name: 'john' },
|
|
58
|
+
* caseInsensitiveCompare
|
|
59
|
+
* ); // true
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* // Custom comparison for range matching
|
|
63
|
+
* const rangeCompare = (objVal, srcVal, key) => {
|
|
64
|
+
* if (key === 'age' && typeof srcVal === 'object' && srcVal.min !== undefined) {
|
|
65
|
+
* return objVal >= srcVal.min && objVal <= srcVal.max;
|
|
66
|
+
* }
|
|
67
|
+
* return undefined;
|
|
68
|
+
* };
|
|
69
|
+
*
|
|
70
|
+
* isMatchWith(
|
|
71
|
+
* { name: 'John', age: 25 },
|
|
72
|
+
* { age: { min: 18, max: 30 } },
|
|
73
|
+
* rangeCompare
|
|
74
|
+
* ); // true
|
|
75
|
+
*/
|
|
76
|
+
function isMatchWith(target, source, compare) {
|
|
77
|
+
if (typeof compare !== "function") return isMatchWith(target, source, () => void 0);
|
|
78
|
+
return isMatchWithInternal(target, source, function doesMatch(objValue, srcValue, key, object, source, stack) {
|
|
79
|
+
const isEqual = compare(objValue, srcValue, key, object, source, stack);
|
|
80
|
+
if (isEqual !== void 0) return Boolean(isEqual);
|
|
81
|
+
return isMatchWithInternal(objValue, srcValue, doesMatch, stack, false);
|
|
82
|
+
}, /* @__PURE__ */ new Map(), true);
|
|
83
|
+
}
|
|
84
|
+
function isMatchWithInternal(target, source, compare, stack, isRoot = false) {
|
|
85
|
+
if (source === target) return true;
|
|
86
|
+
switch (typeof source) {
|
|
87
|
+
case "object": return isObjectMatch(target, source, compare, stack, isRoot);
|
|
88
|
+
case "function":
|
|
89
|
+
if (Object.keys(source).length > 0) return isMatchWithInternal(target, Object.assign({}, source), compare, stack, isRoot);
|
|
90
|
+
return eq(target, source);
|
|
91
|
+
default:
|
|
92
|
+
if (!isObject(target)) return eq(target, source);
|
|
93
|
+
if (isRoot) {
|
|
94
|
+
if (typeof source === "string") return source === "";
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
return eq(target, source);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function isObjectMatch(target, source, compare, stack, isRoot = false) {
|
|
101
|
+
if (source == null) return true;
|
|
102
|
+
if (Array.isArray(source)) return isArrayMatch(target, source, compare, stack);
|
|
103
|
+
if (source instanceof Map) return isMapMatch(target, source, compare, stack);
|
|
104
|
+
if (source instanceof Set) return isSetMatch(target, source, compare, stack);
|
|
105
|
+
const keys = Object.keys(source);
|
|
106
|
+
if (target == null) return isRoot && keys.length === 0;
|
|
107
|
+
if (isRoot) {
|
|
108
|
+
if (isPrimitive(target)) target = Object(target);
|
|
109
|
+
} else {
|
|
110
|
+
if (getTag(source) === "[object Error]") return getTag(target) === "[object Error]" && target.name === source.name && target.message === source.message;
|
|
111
|
+
const tag = getTag(target);
|
|
112
|
+
if (tag !== "[object Object]" && tag !== "[object Arguments]") return false;
|
|
113
|
+
}
|
|
114
|
+
if (keys.length === 0) return true;
|
|
115
|
+
if (stack === null || stack === void 0 ? void 0 : stack.has(source)) return stack.get(source) === target;
|
|
116
|
+
stack === null || stack === void 0 || stack.set(source, target);
|
|
117
|
+
try {
|
|
118
|
+
for (let i = 0; i < keys.length; i++) {
|
|
119
|
+
const key = keys[i];
|
|
120
|
+
if (!(key in target)) return false;
|
|
121
|
+
if (source[key] === void 0 && target[key] !== void 0) return false;
|
|
122
|
+
if (source[key] === null && target[key] !== null) return false;
|
|
123
|
+
if (!compare(target[key], source[key], key, target, source, stack)) return false;
|
|
124
|
+
}
|
|
125
|
+
return true;
|
|
126
|
+
} finally {
|
|
127
|
+
stack === null || stack === void 0 || stack.delete(source);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function isMapMatch(target, source, compare, stack) {
|
|
131
|
+
if (source.size === 0) return true;
|
|
132
|
+
if (!(target instanceof Map)) return false;
|
|
133
|
+
for (const [key, sourceValue] of source.entries()) if (compare(target.get(key), sourceValue, key, target, source, stack) === false) return false;
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
function isArrayMatch(target, source, compare, stack) {
|
|
137
|
+
if (source.length === 0) return true;
|
|
138
|
+
if (!Array.isArray(target)) return false;
|
|
139
|
+
const countedIndex = /* @__PURE__ */ new Set();
|
|
140
|
+
for (let i = 0; i < source.length; i++) {
|
|
141
|
+
const sourceItem = source[i];
|
|
142
|
+
let found = false;
|
|
143
|
+
for (let j = 0; j < target.length; j++) {
|
|
144
|
+
if (countedIndex.has(j)) continue;
|
|
145
|
+
const targetItem = target[j];
|
|
146
|
+
let matches = false;
|
|
147
|
+
if (compare(targetItem, sourceItem, i, target, source, stack)) matches = true;
|
|
148
|
+
if (matches) {
|
|
149
|
+
countedIndex.add(j);
|
|
150
|
+
found = true;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (!found) return false;
|
|
155
|
+
}
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
function isSetMatch(target, source, compare, stack) {
|
|
159
|
+
if (source.size === 0) return true;
|
|
160
|
+
if (!(target instanceof Set)) return false;
|
|
161
|
+
return isArrayMatch([...target], [...source], compare, stack);
|
|
162
|
+
}
|
|
163
|
+
export { isMatchWith, isSetMatch };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isNumber } from "./isNumber.mjs";
|
|
2
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isNaN.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Checks if the value is NaN.
|
|
5
|
+
*
|
|
6
|
+
* @param value - The value to check.
|
|
7
|
+
* @returns `true` if the value is NaN, `false` otherwise.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* isNaN(NaN); // true
|
|
11
|
+
* isNaN(0); // false
|
|
12
|
+
* isNaN('NaN'); // false
|
|
13
|
+
* isNaN(undefined); // false
|
|
14
|
+
*/
|
|
15
|
+
function isNaN(value) {
|
|
16
|
+
return isNumber(value) && Number.isNaN(Number(value));
|
|
17
|
+
}
|
|
18
|
+
export { isNaN };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isNil.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a given value is null or undefined.
|
|
4
|
+
*
|
|
5
|
+
* This function tests whether the provided value is either `null` or `undefined`.
|
|
6
|
+
* It returns `true` if the value is `null` or `undefined`, and `false` otherwise.
|
|
7
|
+
*
|
|
8
|
+
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.
|
|
9
|
+
*
|
|
10
|
+
* @param x - The value to test for null or undefined.
|
|
11
|
+
* @returns `true` if the value is null or undefined, `false` otherwise.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const value1 = null;
|
|
15
|
+
* const value2 = undefined;
|
|
16
|
+
* const value3 = 42;
|
|
17
|
+
* const result1 = isNil(value1); // true
|
|
18
|
+
* const result2 = isNil(value2); // true
|
|
19
|
+
* const result3 = isNil(value3); // false
|
|
20
|
+
*/
|
|
21
|
+
function isNil(x) {
|
|
22
|
+
return x == null;
|
|
23
|
+
}
|
|
24
|
+
export { isNil };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { getTag } from "../_internal/getTag.mjs";
|
|
2
|
+
import { isObjectLike } from "./isObjectLike.mjs";
|
|
3
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isNumber.mjs
|
|
4
|
+
/**
|
|
5
|
+
* Checks if a given value is a number.
|
|
6
|
+
*
|
|
7
|
+
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `number`.
|
|
8
|
+
*
|
|
9
|
+
* @param value The value to check if it is a number.
|
|
10
|
+
* @returns Returns `true` if `value` is a number, else `false`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const value1 = 123;
|
|
14
|
+
* const value2 = 'abc';
|
|
15
|
+
* const value3 = true;
|
|
16
|
+
*
|
|
17
|
+
* console.log(isNumber(value1)); // true
|
|
18
|
+
* console.log(isNumber(value2)); // false
|
|
19
|
+
* console.log(isNumber(value3)); // false
|
|
20
|
+
*/
|
|
21
|
+
function isNumber(value) {
|
|
22
|
+
return typeof value === "number" || isObjectLike(value) && getTag(value) === "[object Number]";
|
|
23
|
+
}
|
|
24
|
+
export { isNumber };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isObjectLike.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Checks if the given value is object-like.
|
|
4
|
+
*
|
|
5
|
+
* A value is object-like if its type is object and it is not null.
|
|
6
|
+
*
|
|
7
|
+
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to an object-like value.
|
|
8
|
+
*
|
|
9
|
+
* @param value - The value to test if it is an object-like.
|
|
10
|
+
* @returns `true` if the value is an object-like, `false` otherwise.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const value1 = { a: 1 };
|
|
14
|
+
* const value2 = [1, 2, 3];
|
|
15
|
+
* const value3 = 'abc';
|
|
16
|
+
* const value4 = () => {};
|
|
17
|
+
* const value5 = null;
|
|
18
|
+
*
|
|
19
|
+
* console.log(isObjectLike(value1)); // true
|
|
20
|
+
* console.log(isObjectLike(value2)); // true
|
|
21
|
+
* console.log(isObjectLike(value3)); // false
|
|
22
|
+
* console.log(isObjectLike(value4)); // false
|
|
23
|
+
* console.log(isObjectLike(value5)); // false
|
|
24
|
+
*/
|
|
25
|
+
function isObjectLike(value) {
|
|
26
|
+
return typeof value === "object" && value !== null;
|
|
27
|
+
}
|
|
28
|
+
export { isObjectLike };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isSymbol.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Check whether a value is a symbol.
|
|
4
|
+
*
|
|
5
|
+
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `symbol`.
|
|
6
|
+
*
|
|
7
|
+
* @param value The value to check.
|
|
8
|
+
* @returns Returns `true` if `value` is a symbol, else `false`.
|
|
9
|
+
* @example
|
|
10
|
+
* isSymbol(Symbol.iterator);
|
|
11
|
+
* // => true
|
|
12
|
+
*
|
|
13
|
+
* isSymbol('abc');
|
|
14
|
+
* // => false
|
|
15
|
+
*/
|
|
16
|
+
function isSymbol(value) {
|
|
17
|
+
return typeof value === "symbol" || value instanceof Symbol;
|
|
18
|
+
}
|
|
19
|
+
export { isSymbol };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isTypedArray as isTypedArray$1 } from "../../predicate/isTypedArray.mjs";
|
|
2
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/isTypedArray.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a value is a TypedArray.
|
|
5
|
+
* @param x The value to check.
|
|
6
|
+
* @returns Returns true if `x` is a TypedArray, false otherwise.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* const arr = new Uint8Array([1, 2, 3]);
|
|
10
|
+
* isTypedArray(arr); // true
|
|
11
|
+
*
|
|
12
|
+
* const regularArray = [1, 2, 3];
|
|
13
|
+
* isTypedArray(regularArray); // false
|
|
14
|
+
*
|
|
15
|
+
* const buffer = new ArrayBuffer(16);
|
|
16
|
+
* isTypedArray(buffer); // false
|
|
17
|
+
*/
|
|
18
|
+
function isTypedArray(x) {
|
|
19
|
+
return isTypedArray$1(x);
|
|
20
|
+
}
|
|
21
|
+
export { isTypedArray };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isMatch } from "./isMatch.mjs";
|
|
2
|
+
import { cloneDeep } from "../object/cloneDeep.mjs";
|
|
3
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/matches.mjs
|
|
4
|
+
/**
|
|
5
|
+
* Creates a function that performs a deep comparison between a given target and the source object.
|
|
6
|
+
*
|
|
7
|
+
* @template T
|
|
8
|
+
* @template V
|
|
9
|
+
* @param source - The source object to create the matcher from.
|
|
10
|
+
* @returns Returns a function that takes a target object and returns `true` if the target matches the source, otherwise `false`.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* // Basic usage
|
|
14
|
+
* const matcher = matches({ a: 1, b: 2 });
|
|
15
|
+
* matcher({ a: 1, b: 2, c: 3 }); // true
|
|
16
|
+
* matcher({ a: 1, c: 3 }); // false
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Matching arrays
|
|
20
|
+
* const arrayMatcher = matches([1, 2, 3]);
|
|
21
|
+
* arrayMatcher([1, 2, 3, 4]); // true
|
|
22
|
+
* arrayMatcher([4, 5, 6]); // false
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* // Matching objects with nested structures
|
|
26
|
+
* const nestedMatcher = matches({ a: { b: 2 } });
|
|
27
|
+
* nestedMatcher({ a: { b: 2, c: 3 } }); // true
|
|
28
|
+
* nestedMatcher({ a: { c: 3 } }); // false
|
|
29
|
+
*/
|
|
30
|
+
function matches(source) {
|
|
31
|
+
source = cloneDeep(source);
|
|
32
|
+
return (target) => {
|
|
33
|
+
return isMatch(target, source);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export { matches };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { toKey } from "../_internal/toKey.mjs";
|
|
2
|
+
import { get } from "../object/get.mjs";
|
|
3
|
+
import { isMatch } from "./isMatch.mjs";
|
|
4
|
+
import { cloneDeep } from "../object/cloneDeep.mjs";
|
|
5
|
+
import { has } from "../object/has.mjs";
|
|
6
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/predicate/matchesProperty.mjs
|
|
7
|
+
/**
|
|
8
|
+
* Creates a function that checks if a given target object matches a specific property value.
|
|
9
|
+
*
|
|
10
|
+
* The returned function takes a target object and determines if the property at the
|
|
11
|
+
* specified path within the target object is equal to the given value.
|
|
12
|
+
*
|
|
13
|
+
* @param property - The property path to check within the target object.
|
|
14
|
+
* This can be a single property key or an array of property keys.
|
|
15
|
+
* @param source - The value to compare against the property value in the target object.
|
|
16
|
+
*
|
|
17
|
+
* @returns A function that takes a target object and returns
|
|
18
|
+
* `true` if the property value at the given path in the target object matches the provided value,
|
|
19
|
+
* otherwise returns `false`.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* // Using a single property key
|
|
23
|
+
* const checkName = matchesProperty('name', 'Alice');
|
|
24
|
+
* console.log(checkName({ name: 'Alice' })); // true
|
|
25
|
+
* console.log(checkName({ name: 'Bob' })); // false
|
|
26
|
+
*
|
|
27
|
+
* // Using an array of property keys
|
|
28
|
+
* const checkNested = matchesProperty(['address', 'city'], 'New York');
|
|
29
|
+
* console.log(checkNested({ address: { city: 'New York' } })); // true
|
|
30
|
+
* console.log(checkNested({ address: { city: 'Los Angeles' } })); // false
|
|
31
|
+
*/
|
|
32
|
+
function matchesProperty(property, source) {
|
|
33
|
+
switch (typeof property) {
|
|
34
|
+
case "object":
|
|
35
|
+
if (Object.is(property === null || property === void 0 ? void 0 : property.valueOf(), -0)) property = "-0";
|
|
36
|
+
break;
|
|
37
|
+
case "number": property = toKey(property);
|
|
38
|
+
}
|
|
39
|
+
source = cloneDeep(source);
|
|
40
|
+
return function(target) {
|
|
41
|
+
const result = get(target, property);
|
|
42
|
+
if (result === void 0) return has(target, property);
|
|
43
|
+
if (source === void 0) return result === void 0;
|
|
44
|
+
return isMatch(result, source);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export { matchesProperty };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { identity } from "../../function/identity.mjs";
|
|
2
|
+
import { property } from "../object/property.mjs";
|
|
3
|
+
import { matches } from "../predicate/matches.mjs";
|
|
4
|
+
import { matchesProperty } from "../predicate/matchesProperty.mjs";
|
|
5
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/util/iteratee.mjs
|
|
6
|
+
/**
|
|
7
|
+
* Creates a function that returns a value from an element in a collection.
|
|
8
|
+
*
|
|
9
|
+
* You can call `iteratee` with the following types of arguments:
|
|
10
|
+
*
|
|
11
|
+
* - **Function**: Returns the function as-is, which will be called with the element from the collection.
|
|
12
|
+
* - **Property name**: Returns the value of the specified property from the element.
|
|
13
|
+
* - **Property-value pair**: Returns a boolean indicating whether the element's property matches the given value.
|
|
14
|
+
* - **Partial object**: Returns a boolean indicating whether the element matches the properties of the partial object.
|
|
15
|
+
*
|
|
16
|
+
* If you don't provide any arguments or pass `null`, this function will return a function that simply returns its input unchanged.
|
|
17
|
+
*
|
|
18
|
+
* @param value - The value to convert to an iteratee.
|
|
19
|
+
* @returns Returns the new iteratee function.
|
|
20
|
+
* @example
|
|
21
|
+
* const func = iteratee();
|
|
22
|
+
* [{ a: 1 }, { a: 2 }, { a: 3 }].map(func) // => [{ a: 1 }, { a: 2 }, { a: 3 }]
|
|
23
|
+
*
|
|
24
|
+
* const func = iteratee((object) => object.a);
|
|
25
|
+
* [{ a: 1 }, { a: 2 }, { a: 3 }].map(func) // => [1, 2, 3]
|
|
26
|
+
*
|
|
27
|
+
* const func = iteratee('a');
|
|
28
|
+
* [{ a: 1 }, { a: 2 }, { a: 3 }].map(func) // => [1, 2, 3]
|
|
29
|
+
*
|
|
30
|
+
* const func = iteratee({ a: 1 });
|
|
31
|
+
* [{ a: 1 }, { a: 2 }, { a: 3 }].find(func) // => { a: 1 }
|
|
32
|
+
*
|
|
33
|
+
* const func = iteratee(['a', 1]);
|
|
34
|
+
* [{ a: 1 }, { a: 2 }, { a: 3 }].find(func) // => { a: 1 }
|
|
35
|
+
*/
|
|
36
|
+
function iteratee(value) {
|
|
37
|
+
if (value == null) return identity;
|
|
38
|
+
switch (typeof value) {
|
|
39
|
+
case "function": return value;
|
|
40
|
+
case "object":
|
|
41
|
+
if (Array.isArray(value) && value.length === 2) return matchesProperty(value[0], value[1]);
|
|
42
|
+
return matches(value);
|
|
43
|
+
default: return property(value);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export { iteratee };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { toKey } from "../_internal/toKey.mjs";
|
|
2
|
+
import { toString } from "./toString.mjs";
|
|
3
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/util/toPath.mjs
|
|
4
|
+
/**
|
|
5
|
+
* Converts a deep key string into an array of path segments.
|
|
6
|
+
*
|
|
7
|
+
* This function takes a string representing a deep key (e.g., 'a.b.c' or 'a[b][c]') and breaks it down into an array of strings, each representing a segment of the path.
|
|
8
|
+
*
|
|
9
|
+
* @param deepKey - The deep key string to convert.
|
|
10
|
+
* @returns An array of strings, each representing a segment of the path.
|
|
11
|
+
*
|
|
12
|
+
* Examples:
|
|
13
|
+
*
|
|
14
|
+
* toPath('a.b.c') // Returns ['a', 'b', 'c']
|
|
15
|
+
* toPath('a[b][c]') // Returns ['a', 'b', 'c']
|
|
16
|
+
* toPath('.a.b.c') // Returns ['', 'a', 'b', 'c']
|
|
17
|
+
* toPath('a["b.c"].d') // Returns ['a', 'b.c', 'd']
|
|
18
|
+
* toPath('') // Returns []
|
|
19
|
+
* toPath('.a[b].c.d[e]["f.g"].h') // Returns ['', 'a', 'b', 'c', 'd', 'e', 'f.g', 'h']
|
|
20
|
+
*/
|
|
21
|
+
function toPath(deepKey) {
|
|
22
|
+
if (Array.isArray(deepKey)) return deepKey.map(toKey);
|
|
23
|
+
if (typeof deepKey === "symbol") return [deepKey];
|
|
24
|
+
deepKey = toString(deepKey);
|
|
25
|
+
const result = [];
|
|
26
|
+
const length = deepKey.length;
|
|
27
|
+
if (length === 0) return result;
|
|
28
|
+
let index = 0;
|
|
29
|
+
let key = "";
|
|
30
|
+
let quoteChar = "";
|
|
31
|
+
let bracket = false;
|
|
32
|
+
let bracketHadQuote = false;
|
|
33
|
+
const bracketNumberRegex = /^-?\d+(?:\.\d+)?$/;
|
|
34
|
+
if (deepKey.charCodeAt(0) === 46) result.push("");
|
|
35
|
+
while (index < length) {
|
|
36
|
+
const char = deepKey[index];
|
|
37
|
+
if (quoteChar) {
|
|
38
|
+
if (char === "\\" && index + 1 < length) {
|
|
39
|
+
index++;
|
|
40
|
+
key += deepKey[index];
|
|
41
|
+
} else if (char === quoteChar) quoteChar = "";
|
|
42
|
+
else key += char;
|
|
43
|
+
} else if (bracket) {
|
|
44
|
+
if (char === "\"" || char === "'") {
|
|
45
|
+
quoteChar = char;
|
|
46
|
+
bracketHadQuote = true;
|
|
47
|
+
} else if (char === "]") {
|
|
48
|
+
bracket = false;
|
|
49
|
+
if (!bracketHadQuote && key.includes(".") && !bracketNumberRegex.test(key)) {
|
|
50
|
+
const segments = key.split(".");
|
|
51
|
+
for (let i = 0; i < segments.length; i++) if (segments[i] !== "") result.push(segments[i]);
|
|
52
|
+
} else result.push(key);
|
|
53
|
+
key = "";
|
|
54
|
+
} else key += char;
|
|
55
|
+
} else if (char === "[") {
|
|
56
|
+
bracket = true;
|
|
57
|
+
bracketHadQuote = false;
|
|
58
|
+
if (key) {
|
|
59
|
+
result.push(key);
|
|
60
|
+
key = "";
|
|
61
|
+
}
|
|
62
|
+
} else if (char === ".") {
|
|
63
|
+
if (key) {
|
|
64
|
+
result.push(key);
|
|
65
|
+
key = "";
|
|
66
|
+
}
|
|
67
|
+
const next = deepKey[index + 1];
|
|
68
|
+
if (next === void 0 || next === ".") result.push("");
|
|
69
|
+
} else key += char;
|
|
70
|
+
index++;
|
|
71
|
+
}
|
|
72
|
+
if (key) result.push(key);
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
export { toPath };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { baseToString } from "../_internal/baseToString.mjs";
|
|
2
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/compat/util/toString.mjs
|
|
3
|
+
/**
|
|
4
|
+
* Converts `value` to a string.
|
|
5
|
+
*
|
|
6
|
+
* An empty string is returned for `null` and `undefined` values.
|
|
7
|
+
* The sign of `-0` is preserved.
|
|
8
|
+
*
|
|
9
|
+
* @param value - The value to convert.
|
|
10
|
+
* @returns Returns the converted string.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* toString(null) // returns ''
|
|
14
|
+
* toString(undefined) // returns ''
|
|
15
|
+
* toString(-0) // returns '-0'
|
|
16
|
+
* toString([1, 2, -0]) // returns '1,2,-0'
|
|
17
|
+
* toString([Symbol('a'), Symbol('b')]) // returns 'Symbol(a),Symbol(b)'
|
|
18
|
+
*/
|
|
19
|
+
function toString(value) {
|
|
20
|
+
if (value == null) return "";
|
|
21
|
+
return baseToString(value);
|
|
22
|
+
}
|
|
23
|
+
export { toString };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/function/identity.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Returns the input value unchanged.
|
|
4
|
+
*
|
|
5
|
+
* @template T - The type of the input value.
|
|
6
|
+
* @param x - The value to be returned.
|
|
7
|
+
* @returns The input value.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* // Returns 5
|
|
11
|
+
* identity(5);
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* // Returns 'hello'
|
|
15
|
+
* identity('hello');
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Returns { key: 'value' }
|
|
19
|
+
* identity({ key: 'value' });
|
|
20
|
+
*/
|
|
21
|
+
function identity(x) {
|
|
22
|
+
return x;
|
|
23
|
+
}
|
|
24
|
+
export { identity };
|
|
@@ -136,8 +136,7 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
136
136
|
const propKey = aKeys[i];
|
|
137
137
|
const aProp = a[propKey];
|
|
138
138
|
if (!Object.hasOwn(b, propKey)) return false;
|
|
139
|
-
|
|
140
|
-
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) return false;
|
|
139
|
+
if (!isEqualWithImpl(aProp, b[propKey], propKey, a, b, stack, areValuesEqual)) return false;
|
|
141
140
|
}
|
|
142
141
|
return true;
|
|
143
142
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// node_modules/.pnpm/utilery@0.4.0/node_modules/utilery/dist/vendor/es-toolkit/dist/predicate/isNil.mjs
|
|
2
|
+
/**
|
|
3
|
+
* Checks if a given value is null or undefined.
|
|
4
|
+
*
|
|
5
|
+
* This function tests whether the provided value is either `null` or `undefined`.
|
|
6
|
+
* It returns `true` if the value is `null` or `undefined`, and `false` otherwise.
|
|
7
|
+
*
|
|
8
|
+
* This function can also serve as a type predicate in TypeScript, narrowing the type of the argument to `null` or `undefined`.
|
|
9
|
+
*
|
|
10
|
+
* @param x - The value to test for null or undefined.
|
|
11
|
+
* @returns `true` if the value is null or undefined, `false` otherwise.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const value1 = null;
|
|
15
|
+
* const value2 = undefined;
|
|
16
|
+
* const value3 = 42;
|
|
17
|
+
* const result1 = isNil(value1); // true
|
|
18
|
+
* const result2 = isNil(value2); // true
|
|
19
|
+
* const result3 = isNil(value3); // false
|
|
20
|
+
*/
|
|
21
|
+
function isNil(x) {
|
|
22
|
+
return x == null;
|
|
23
|
+
}
|
|
24
|
+
export { isNil };
|