@ls-stack/utils 3.45.0 → 3.47.0

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.
@@ -0,0 +1,52 @@
1
+ import {
2
+ isPlainObject
3
+ } from "./chunk-JF2MDHOJ.js";
4
+
5
+ // src/deepReplaceValues.ts
6
+ function applyValueReplacements(value, replaceValues, visited, currentPath) {
7
+ function processValue(val, path) {
8
+ const replacement = replaceValues(val, path);
9
+ if (replacement !== false) {
10
+ return replacement.newValue;
11
+ }
12
+ if (Array.isArray(val)) {
13
+ if (visited.has(val)) {
14
+ throw new Error("Circular reference detected in array");
15
+ }
16
+ visited.add(val);
17
+ try {
18
+ return val.map((item, index) => {
19
+ const itemPath = path ? `${path}[${index}]` : `[${index}]`;
20
+ return processValue(item, itemPath);
21
+ });
22
+ } finally {
23
+ visited.delete(val);
24
+ }
25
+ }
26
+ if (isPlainObject(val)) {
27
+ if (visited.has(val)) {
28
+ throw new Error("Circular reference detected in object");
29
+ }
30
+ visited.add(val);
31
+ try {
32
+ const result = {};
33
+ for (const [key, itemValue] of Object.entries(val)) {
34
+ const itemPath = path ? `${path}.${key}` : key;
35
+ result[key] = processValue(itemValue, itemPath);
36
+ }
37
+ return result;
38
+ } finally {
39
+ visited.delete(val);
40
+ }
41
+ }
42
+ return val;
43
+ }
44
+ return processValue(value, currentPath);
45
+ }
46
+ function deepReplaceValues(value, replaceValues) {
47
+ return applyValueReplacements(value, replaceValues, /* @__PURE__ */ new Set(), "");
48
+ }
49
+
50
+ export {
51
+ deepReplaceValues
52
+ };
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/deepReplaceValues.ts
21
+ var deepReplaceValues_exports = {};
22
+ __export(deepReplaceValues_exports, {
23
+ deepReplaceValues: () => deepReplaceValues
24
+ });
25
+ module.exports = __toCommonJS(deepReplaceValues_exports);
26
+
27
+ // src/typeGuards.ts
28
+ function isPlainObject(value) {
29
+ if (!value || typeof value !== "object") return false;
30
+ const proto = Object.getPrototypeOf(value);
31
+ if (proto === null) {
32
+ return true;
33
+ }
34
+ const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
35
+ if (Ctor === Object) return true;
36
+ const objectCtorString = Object.prototype.constructor.toString();
37
+ return typeof Ctor == "function" && Function.toString.call(Ctor) === objectCtorString;
38
+ }
39
+
40
+ // src/deepReplaceValues.ts
41
+ function applyValueReplacements(value, replaceValues, visited, currentPath) {
42
+ function processValue(val, path) {
43
+ const replacement = replaceValues(val, path);
44
+ if (replacement !== false) {
45
+ return replacement.newValue;
46
+ }
47
+ if (Array.isArray(val)) {
48
+ if (visited.has(val)) {
49
+ throw new Error("Circular reference detected in array");
50
+ }
51
+ visited.add(val);
52
+ try {
53
+ return val.map((item, index) => {
54
+ const itemPath = path ? `${path}[${index}]` : `[${index}]`;
55
+ return processValue(item, itemPath);
56
+ });
57
+ } finally {
58
+ visited.delete(val);
59
+ }
60
+ }
61
+ if (isPlainObject(val)) {
62
+ if (visited.has(val)) {
63
+ throw new Error("Circular reference detected in object");
64
+ }
65
+ visited.add(val);
66
+ try {
67
+ const result = {};
68
+ for (const [key, itemValue] of Object.entries(val)) {
69
+ const itemPath = path ? `${path}.${key}` : key;
70
+ result[key] = processValue(itemValue, itemPath);
71
+ }
72
+ return result;
73
+ } finally {
74
+ visited.delete(val);
75
+ }
76
+ }
77
+ return val;
78
+ }
79
+ return processValue(value, currentPath);
80
+ }
81
+ function deepReplaceValues(value, replaceValues) {
82
+ return applyValueReplacements(value, replaceValues, /* @__PURE__ */ new Set(), "");
83
+ }
84
+ // Annotate the CommonJS export names for ESM import in node:
85
+ 0 && (module.exports = {
86
+ deepReplaceValues
87
+ });
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Recursively traverses an object or array and allows conditional replacement of values
3
+ * based on a provided callback function. The callback receives each value and its path
4
+ * within the data structure.
5
+ *
6
+ * @param value - The input value to process (object, array, or primitive)
7
+ * @param replaceValues - Callback function that receives each value and its path.
8
+ * Return `false` to keep the original value, or `{ newValue: unknown }` to replace it.
9
+ * The path uses dot notation for objects (e.g., "user.name") and bracket notation for arrays (e.g., "items[0]")
10
+ * @returns A new structure with replaced values. The original structure is not modified.
11
+ * @throws Error if circular references are detected
12
+ *
13
+ * @example
14
+ * const data = { user: { id: 1, name: "Alice" }, scores: [85, 92] };
15
+ * const result = deepReplaceValues(data, (value, path) => {
16
+ * if (typeof value === "number") {
17
+ * return { newValue: value * 2 };
18
+ * }
19
+ * return false;
20
+ * });
21
+ * // Result: { user: { id: 2, name: "Alice" }, scores: [170, 184] }
22
+ */
23
+ declare function deepReplaceValues<T, R = T>(value: T, replaceValues: (value: unknown, path: string) => false | {
24
+ newValue: unknown;
25
+ }): R;
26
+
27
+ export { deepReplaceValues };
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Recursively traverses an object or array and allows conditional replacement of values
3
+ * based on a provided callback function. The callback receives each value and its path
4
+ * within the data structure.
5
+ *
6
+ * @param value - The input value to process (object, array, or primitive)
7
+ * @param replaceValues - Callback function that receives each value and its path.
8
+ * Return `false` to keep the original value, or `{ newValue: unknown }` to replace it.
9
+ * The path uses dot notation for objects (e.g., "user.name") and bracket notation for arrays (e.g., "items[0]")
10
+ * @returns A new structure with replaced values. The original structure is not modified.
11
+ * @throws Error if circular references are detected
12
+ *
13
+ * @example
14
+ * const data = { user: { id: 1, name: "Alice" }, scores: [85, 92] };
15
+ * const result = deepReplaceValues(data, (value, path) => {
16
+ * if (typeof value === "number") {
17
+ * return { newValue: value * 2 };
18
+ * }
19
+ * return false;
20
+ * });
21
+ * // Result: { user: { id: 2, name: "Alice" }, scores: [170, 184] }
22
+ */
23
+ declare function deepReplaceValues<T, R = T>(value: T, replaceValues: (value: unknown, path: string) => false | {
24
+ newValue: unknown;
25
+ }): R;
26
+
27
+ export { deepReplaceValues };
@@ -0,0 +1,7 @@
1
+ import {
2
+ deepReplaceValues
3
+ } from "./chunk-PUKVXYYL.js";
4
+ import "./chunk-JF2MDHOJ.js";
5
+ export {
6
+ deepReplaceValues
7
+ };
@@ -39,12 +39,18 @@ function fastCache({ maxCacheSize = 1e3 } = {}) {
39
39
  }
40
40
  function getOrInsert(cacheKey, val) {
41
41
  if (!cache2.has(cacheKey)) {
42
- cache2.set(cacheKey, val());
42
+ const value = val();
43
+ cache2.set(cacheKey, value);
43
44
  trimCache();
45
+ return cache2.get(cacheKey) ?? value;
44
46
  }
45
47
  return cache2.get(cacheKey);
46
48
  }
47
- return { getOrInsert, clear: () => cache2.clear() };
49
+ return {
50
+ getOrInsert,
51
+ /** Clears all cached values */
52
+ clear: () => cache2.clear()
53
+ };
48
54
  }
49
55
 
50
56
  // src/matchPath.ts
package/dist/matchPath.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  fastCache
3
- } from "./chunk-OIAGLRII.js";
3
+ } from "./chunk-AULH7VMS.js";
4
4
  import "./chunk-5MNYPLZI.js";
5
5
  import "./chunk-HTCYUMDR.js";
6
6
  import "./chunk-II4R3VVX.js";
@@ -92,11 +92,13 @@ function deepEqual(foo, bar, maxDepth = 20) {
92
92
  // src/partialEqual.ts
93
93
  var has2 = Object.prototype.hasOwnProperty;
94
94
  function createComparison(type) {
95
- return {
96
- "~sc": type
97
- };
95
+ return { "~sc": type };
98
96
  }
99
97
  var match = {
98
+ noExtraKeys: (partialShape) => createComparison(["withNoExtraKeys", partialShape]),
99
+ deepNoExtraKeys: (partialShape) => createComparison(["withDeepNoExtraKeys", partialShape]),
100
+ noExtraDefinedKeys: (partialShape) => createComparison(["noExtraDefinedKeys", partialShape]),
101
+ deepNoExtraDefinedKeys: (partialShape) => createComparison(["deepNoExtraDefinedKeys", partialShape]),
100
102
  hasType: {
101
103
  string: createComparison(["hasType", "string"]),
102
104
  number: createComparison(["hasType", "number"]),
@@ -137,6 +139,7 @@ var match = {
137
139
  array: createComparison(["not", ["hasType", "array"]]),
138
140
  function: createComparison(["not", ["hasType", "function"]])
139
141
  },
142
+ keyNotBePresent: createComparison(["not", ["keyNotBePresent", null]]),
140
143
  isInstanceOf: (constructor) => createComparison(["not", ["isInstanceOf", constructor]]),
141
144
  str: {
142
145
  contains: (substring) => createComparison(["not", ["strContains", substring]]),
@@ -158,7 +161,11 @@ var match = {
158
161
  partialEqual: (value) => createComparison(["not", ["partialEqual", value]]),
159
162
  custom: (value) => createComparison(["not", ["custom", value]]),
160
163
  any: (...comparisons) => createComparison(["not", ["any", comparisons.map((c) => c["~sc"])]]),
161
- all: (...comparisons) => createComparison(["not", ["all", comparisons.map((c) => c["~sc"])]])
164
+ all: (...comparisons) => createComparison(["not", ["all", comparisons.map((c) => c["~sc"])]]),
165
+ noExtraKeys: (partialShape) => createComparison(["not", ["withNoExtraKeys", partialShape]]),
166
+ deepNoExtraKeys: (partialShape) => createComparison(["not", ["withDeepNoExtraKeys", partialShape]]),
167
+ noExtraDefinedKeys: (partialShape) => createComparison(["not", ["noExtraDefinedKeys", partialShape]]),
168
+ deepNoExtraDefinedKeys: (partialShape) => createComparison(["not", ["deepNoExtraDefinedKeys", partialShape]])
162
169
  }
163
170
  };
164
171
  function find2(iter, tar) {
@@ -256,6 +263,128 @@ function executeComparison(target, comparison) {
256
263
  return true;
257
264
  case "not":
258
265
  return !executeComparison(target, value);
266
+ case "withNoExtraKeys":
267
+ if (typeof target !== "object" || target === null || Array.isArray(target)) {
268
+ return false;
269
+ }
270
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
271
+ return false;
272
+ }
273
+ for (const key in target) {
274
+ if (has2.call(target, key) && !has2.call(value, key)) {
275
+ return false;
276
+ }
277
+ }
278
+ for (const key in value) {
279
+ if (has2.call(value, key)) {
280
+ if (!has2.call(target, key)) {
281
+ return false;
282
+ }
283
+ if (!partialEqual(target[key], value[key])) {
284
+ return false;
285
+ }
286
+ }
287
+ }
288
+ return true;
289
+ case "withDeepNoExtraKeys":
290
+ if (typeof target !== "object" || target === null || Array.isArray(target)) {
291
+ return false;
292
+ }
293
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
294
+ return false;
295
+ }
296
+ for (const key in target) {
297
+ if (has2.call(target, key) && !has2.call(value, key)) {
298
+ return false;
299
+ }
300
+ }
301
+ for (const key in value) {
302
+ if (has2.call(value, key)) {
303
+ if (!has2.call(target, key)) {
304
+ return false;
305
+ }
306
+ const targetValue = target[key];
307
+ const partialValue = value[key];
308
+ if (partialValue && typeof partialValue === "object" && "~sc" in partialValue && partialValue["~sc"][0] === "withDeepNoExtraKeys") {
309
+ if (!executeComparison(targetValue, partialValue["~sc"])) {
310
+ return false;
311
+ }
312
+ } else if (partialValue && typeof partialValue === "object" && !Array.isArray(partialValue) && partialValue.constructor === Object && targetValue && typeof targetValue === "object" && !Array.isArray(targetValue) && targetValue.constructor === Object) {
313
+ if (!executeComparison(targetValue, [
314
+ "withDeepNoExtraKeys",
315
+ partialValue
316
+ ])) {
317
+ return false;
318
+ }
319
+ } else {
320
+ if (!partialEqual(targetValue, partialValue)) {
321
+ return false;
322
+ }
323
+ }
324
+ }
325
+ }
326
+ return true;
327
+ case "noExtraDefinedKeys":
328
+ if (typeof target !== "object" || target === null || Array.isArray(target)) {
329
+ return false;
330
+ }
331
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
332
+ return false;
333
+ }
334
+ for (const key in target) {
335
+ if (has2.call(target, key) && target[key] !== void 0 && !has2.call(value, key)) {
336
+ return false;
337
+ }
338
+ }
339
+ for (const key in value) {
340
+ if (has2.call(value, key)) {
341
+ if (!has2.call(target, key)) {
342
+ return false;
343
+ }
344
+ if (!partialEqual(target[key], value[key])) {
345
+ return false;
346
+ }
347
+ }
348
+ }
349
+ return true;
350
+ case "deepNoExtraDefinedKeys":
351
+ if (typeof target !== "object" || target === null || Array.isArray(target)) {
352
+ return false;
353
+ }
354
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
355
+ return false;
356
+ }
357
+ for (const key in target) {
358
+ if (has2.call(target, key) && target[key] !== void 0 && !has2.call(value, key)) {
359
+ return false;
360
+ }
361
+ }
362
+ for (const key in value) {
363
+ if (has2.call(value, key)) {
364
+ if (!has2.call(target, key)) {
365
+ return false;
366
+ }
367
+ const targetValue = target[key];
368
+ const partialValue = value[key];
369
+ if (partialValue && typeof partialValue === "object" && "~sc" in partialValue && partialValue["~sc"][0] === "deepNoExtraDefinedKeys") {
370
+ if (!executeComparison(targetValue, partialValue["~sc"])) {
371
+ return false;
372
+ }
373
+ } else if (partialValue && typeof partialValue === "object" && !Array.isArray(partialValue) && partialValue.constructor === Object && targetValue && typeof targetValue === "object" && !Array.isArray(targetValue) && targetValue.constructor === Object) {
374
+ if (!executeComparison(targetValue, [
375
+ "deepNoExtraDefinedKeys",
376
+ partialValue
377
+ ])) {
378
+ return false;
379
+ }
380
+ } else {
381
+ if (!partialEqual(targetValue, partialValue)) {
382
+ return false;
383
+ }
384
+ }
385
+ }
386
+ }
387
+ return true;
259
388
  default:
260
389
  return false;
261
390
  }
@@ -318,7 +447,11 @@ function partialEqual(target, sub) {
318
447
  } else if (subValue && typeof subValue === "object" && "~sc" in subValue && subValue["~sc"][0] === "any") {
319
448
  const targetHasKey = has2.call(target, key);
320
449
  const targetValue = targetHasKey ? target[key] : void 0;
321
- if (!executeComparisonWithKeyContext(targetValue, subValue["~sc"], targetHasKey)) {
450
+ if (!executeComparisonWithKeyContext(
451
+ targetValue,
452
+ subValue["~sc"],
453
+ targetHasKey
454
+ )) {
322
455
  return false;
323
456
  }
324
457
  } else {
@@ -1,11 +1,15 @@
1
1
  type ComparisonsType = [type: 'strStartsWith', value: string] | [type: 'strEndsWith', value: string] | [
2
2
  type: 'hasType',
3
3
  value: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'function'
4
- ] | [type: 'strContains', value: string] | [type: 'strMatchesRegex', value: RegExp] | [type: 'deepEqual', value: any] | [type: 'numIsGreaterThan', value: number] | [type: 'numIsGreaterThanOrEqual', value: number] | [type: 'numIsLessThan', value: number] | [type: 'numIsLessThanOrEqual', value: number] | [type: 'numIsInRange', value: [number, number]] | [type: 'jsonStringHasPartial', value: any] | [type: 'partialEqual', value: any] | [type: 'custom', value: (target: unknown) => boolean] | [type: 'isInstanceOf', value: new (...args: any[]) => any] | [type: 'keyNotBePresent', value: null] | [type: 'not', value: ComparisonsType] | [type: 'any', value: ComparisonsType[]] | [type: 'all', value: ComparisonsType[]];
4
+ ] | [type: 'strContains', value: string] | [type: 'strMatchesRegex', value: RegExp] | [type: 'deepEqual', value: any] | [type: 'numIsGreaterThan', value: number] | [type: 'numIsGreaterThanOrEqual', value: number] | [type: 'numIsLessThan', value: number] | [type: 'numIsLessThanOrEqual', value: number] | [type: 'numIsInRange', value: [number, number]] | [type: 'jsonStringHasPartial', value: any] | [type: 'partialEqual', value: any] | [type: 'custom', value: (target: unknown) => boolean] | [type: 'isInstanceOf', value: new (...args: any[]) => any] | [type: 'keyNotBePresent', value: null] | [type: 'not', value: ComparisonsType] | [type: 'any', value: ComparisonsType[]] | [type: 'all', value: ComparisonsType[]] | [type: 'withNoExtraKeys', partialShape: any] | [type: 'withDeepNoExtraKeys', partialShape: any] | [type: 'noExtraDefinedKeys', partialShape: any] | [type: 'deepNoExtraDefinedKeys', partialShape: any];
5
5
  type Comparison = {
6
6
  '~sc': ComparisonsType;
7
7
  };
8
- declare const match: {
8
+ type BaseMatch = {
9
+ noExtraKeys: (partialShape: any) => Comparison;
10
+ deepNoExtraKeys: (partialShape: any) => Comparison;
11
+ noExtraDefinedKeys: (partialShape: any) => Comparison;
12
+ deepNoExtraDefinedKeys: (partialShape: any) => Comparison;
9
13
  hasType: {
10
14
  string: Comparison;
11
15
  number: Comparison;
@@ -37,39 +41,11 @@ declare const match: {
37
41
  keyNotBePresent: Comparison;
38
42
  any: (...comparisons: Comparison[]) => Comparison;
39
43
  all: (...comparisons: Comparison[]) => Comparison;
40
- not: {
41
- hasType: {
42
- string: Comparison;
43
- number: Comparison;
44
- boolean: Comparison;
45
- object: Comparison;
46
- array: Comparison;
47
- function: Comparison;
48
- };
49
- isInstanceOf: (constructor: new (...args: any[]) => any) => Comparison;
50
- str: {
51
- contains: (substring: string) => Comparison;
52
- startsWith: (substring: string) => Comparison;
53
- endsWith: (substring: string) => Comparison;
54
- matchesRegex: (regex: RegExp) => Comparison;
55
- };
56
- num: {
57
- isGreaterThan: (value: number) => Comparison;
58
- isGreaterThanOrEqual: (value: number) => Comparison;
59
- isLessThan: (value: number) => Comparison;
60
- isLessThanOrEqual: (value: number) => Comparison;
61
- isInRange: (value: [number, number]) => Comparison;
62
- };
63
- jsonString: {
64
- hasPartial: (value: any) => Comparison;
65
- };
66
- equal: (value: any) => Comparison;
67
- partialEqual: (value: any) => Comparison;
68
- custom: (value: (target: unknown) => boolean) => Comparison;
69
- any: (...comparisons: Comparison[]) => Comparison;
70
- all: (...comparisons: Comparison[]) => Comparison;
71
- };
72
44
  };
45
+ type Match = BaseMatch & {
46
+ not: BaseMatch;
47
+ };
48
+ declare const match: Match;
73
49
  declare function partialEqual(target: any, sub: any): boolean;
74
50
 
75
51
  export { match, partialEqual };
@@ -1,11 +1,15 @@
1
1
  type ComparisonsType = [type: 'strStartsWith', value: string] | [type: 'strEndsWith', value: string] | [
2
2
  type: 'hasType',
3
3
  value: 'string' | 'number' | 'boolean' | 'object' | 'array' | 'function'
4
- ] | [type: 'strContains', value: string] | [type: 'strMatchesRegex', value: RegExp] | [type: 'deepEqual', value: any] | [type: 'numIsGreaterThan', value: number] | [type: 'numIsGreaterThanOrEqual', value: number] | [type: 'numIsLessThan', value: number] | [type: 'numIsLessThanOrEqual', value: number] | [type: 'numIsInRange', value: [number, number]] | [type: 'jsonStringHasPartial', value: any] | [type: 'partialEqual', value: any] | [type: 'custom', value: (target: unknown) => boolean] | [type: 'isInstanceOf', value: new (...args: any[]) => any] | [type: 'keyNotBePresent', value: null] | [type: 'not', value: ComparisonsType] | [type: 'any', value: ComparisonsType[]] | [type: 'all', value: ComparisonsType[]];
4
+ ] | [type: 'strContains', value: string] | [type: 'strMatchesRegex', value: RegExp] | [type: 'deepEqual', value: any] | [type: 'numIsGreaterThan', value: number] | [type: 'numIsGreaterThanOrEqual', value: number] | [type: 'numIsLessThan', value: number] | [type: 'numIsLessThanOrEqual', value: number] | [type: 'numIsInRange', value: [number, number]] | [type: 'jsonStringHasPartial', value: any] | [type: 'partialEqual', value: any] | [type: 'custom', value: (target: unknown) => boolean] | [type: 'isInstanceOf', value: new (...args: any[]) => any] | [type: 'keyNotBePresent', value: null] | [type: 'not', value: ComparisonsType] | [type: 'any', value: ComparisonsType[]] | [type: 'all', value: ComparisonsType[]] | [type: 'withNoExtraKeys', partialShape: any] | [type: 'withDeepNoExtraKeys', partialShape: any] | [type: 'noExtraDefinedKeys', partialShape: any] | [type: 'deepNoExtraDefinedKeys', partialShape: any];
5
5
  type Comparison = {
6
6
  '~sc': ComparisonsType;
7
7
  };
8
- declare const match: {
8
+ type BaseMatch = {
9
+ noExtraKeys: (partialShape: any) => Comparison;
10
+ deepNoExtraKeys: (partialShape: any) => Comparison;
11
+ noExtraDefinedKeys: (partialShape: any) => Comparison;
12
+ deepNoExtraDefinedKeys: (partialShape: any) => Comparison;
9
13
  hasType: {
10
14
  string: Comparison;
11
15
  number: Comparison;
@@ -37,39 +41,11 @@ declare const match: {
37
41
  keyNotBePresent: Comparison;
38
42
  any: (...comparisons: Comparison[]) => Comparison;
39
43
  all: (...comparisons: Comparison[]) => Comparison;
40
- not: {
41
- hasType: {
42
- string: Comparison;
43
- number: Comparison;
44
- boolean: Comparison;
45
- object: Comparison;
46
- array: Comparison;
47
- function: Comparison;
48
- };
49
- isInstanceOf: (constructor: new (...args: any[]) => any) => Comparison;
50
- str: {
51
- contains: (substring: string) => Comparison;
52
- startsWith: (substring: string) => Comparison;
53
- endsWith: (substring: string) => Comparison;
54
- matchesRegex: (regex: RegExp) => Comparison;
55
- };
56
- num: {
57
- isGreaterThan: (value: number) => Comparison;
58
- isGreaterThanOrEqual: (value: number) => Comparison;
59
- isLessThan: (value: number) => Comparison;
60
- isLessThanOrEqual: (value: number) => Comparison;
61
- isInRange: (value: [number, number]) => Comparison;
62
- };
63
- jsonString: {
64
- hasPartial: (value: any) => Comparison;
65
- };
66
- equal: (value: any) => Comparison;
67
- partialEqual: (value: any) => Comparison;
68
- custom: (value: (target: unknown) => boolean) => Comparison;
69
- any: (...comparisons: Comparison[]) => Comparison;
70
- all: (...comparisons: Comparison[]) => Comparison;
71
- };
72
44
  };
45
+ type Match = BaseMatch & {
46
+ not: BaseMatch;
47
+ };
48
+ declare const match: Match;
73
49
  declare function partialEqual(target: any, sub: any): boolean;
74
50
 
75
51
  export { match, partialEqual };