es-toolkit 1.9.0-dev.197 → 1.9.0-dev.199

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.
Files changed (42) hide show
  1. package/dist/array/index.mjs +16 -16
  2. package/dist/chunk-236H5JZJ.mjs +1 -0
  3. package/dist/chunk-5G67ICEW.mjs +9 -0
  4. package/dist/chunk-5G67ICEW.mjs.map +1 -0
  5. package/dist/chunk-ASJF5D6C.mjs +1 -0
  6. package/dist/chunk-JYSV56US.mjs +41 -0
  7. package/dist/chunk-JYSV56US.mjs.map +1 -0
  8. package/dist/function/index.d.mts +1 -0
  9. package/dist/function/index.d.ts +1 -0
  10. package/dist/function/index.js +7 -0
  11. package/dist/function/index.js.map +1 -1
  12. package/dist/function/index.mjs +7 -3
  13. package/dist/function/negate.d.mts +3 -0
  14. package/dist/function/negate.d.ts +3 -0
  15. package/dist/function/negate.js +33 -0
  16. package/dist/function/negate.js.map +1 -0
  17. package/dist/function/negate.mjs +8 -0
  18. package/dist/function/negate.mjs.map +1 -0
  19. package/dist/index.d.mts +2 -0
  20. package/dist/index.d.ts +2 -0
  21. package/dist/index.js +49 -7
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +80 -72
  24. package/dist/math/index.mjs +6 -6
  25. package/dist/object/index.mjs +3 -3
  26. package/dist/predicate/index.d.mts +1 -0
  27. package/dist/predicate/index.d.ts +1 -0
  28. package/dist/predicate/index.js +45 -0
  29. package/dist/predicate/index.js.map +1 -1
  30. package/dist/predicate/index.mjs +13 -7
  31. package/dist/predicate/isEqual.d.mts +17 -0
  32. package/dist/predicate/isEqual.d.ts +17 -0
  33. package/dist/predicate/isEqual.js +73 -0
  34. package/dist/predicate/isEqual.js.map +1 -0
  35. package/dist/predicate/isEqual.mjs +10 -0
  36. package/dist/predicate/isEqual.mjs.map +1 -0
  37. package/dist/string/index.mjs +7 -7
  38. package/package.json +1 -1
  39. package/dist/chunk-MAJSPFA6.mjs +0 -1
  40. package/dist/chunk-N6EM6ETS.mjs +0 -1
  41. /package/dist/{chunk-MAJSPFA6.mjs.map → chunk-236H5JZJ.mjs.map} +0 -0
  42. /package/dist/{chunk-N6EM6ETS.mjs.map → chunk-ASJF5D6C.mjs.map} +0 -0
@@ -1,4 +1,7 @@
1
1
  import "../chunk-2MRZANXZ.mjs";
2
+ import {
3
+ xor
4
+ } from "../chunk-L7FQX5MN.mjs";
2
5
  import {
3
6
  xorBy
4
7
  } from "../chunk-Q47NGNXT.mjs";
@@ -14,6 +17,9 @@ import {
14
17
  import {
15
18
  zipWith
16
19
  } from "../chunk-4KYXHZ4R.mjs";
20
+ import {
21
+ unionBy
22
+ } from "../chunk-NFS7RWWE.mjs";
17
23
  import {
18
24
  unionWith
19
25
  } from "../chunk-2ZCITDMK.mjs";
@@ -33,8 +39,8 @@ import {
33
39
  without
34
40
  } from "../chunk-PYEYV7BY.mjs";
35
41
  import {
36
- xor
37
- } from "../chunk-L7FQX5MN.mjs";
42
+ shuffle
43
+ } from "../chunk-G7UQ5PUR.mjs";
38
44
  import {
39
45
  tail
40
46
  } from "../chunk-OF6NM4G7.mjs";
@@ -60,8 +66,8 @@ import {
60
66
  uniq
61
67
  } from "../chunk-DVK2N4KC.mjs";
62
68
  import {
63
- unionBy
64
- } from "../chunk-NFS7RWWE.mjs";
69
+ keyBy
70
+ } from "../chunk-AJKZMN2V.mjs";
65
71
  import {
66
72
  last
67
73
  } from "../chunk-KPBQ7OUY.mjs";
@@ -83,9 +89,11 @@ import {
83
89
  import {
84
90
  sampleSize
85
91
  } from "../chunk-EHSKB6DF.mjs";
92
+ import "../chunk-GIWAOOFY.mjs";
93
+ import "../chunk-SYWMYQYJ.mjs";
86
94
  import {
87
- shuffle
88
- } from "../chunk-G7UQ5PUR.mjs";
95
+ forEachRight
96
+ } from "../chunk-IEA53J7P.mjs";
89
97
  import {
90
98
  groupBy
91
99
  } from "../chunk-E6E4RZLN.mjs";
@@ -105,8 +113,8 @@ import {
105
113
  intersectionWith
106
114
  } from "../chunk-XI7KRD2C.mjs";
107
115
  import {
108
- keyBy
109
- } from "../chunk-AJKZMN2V.mjs";
116
+ differenceWith
117
+ } from "../chunk-6NVQAHXP.mjs";
110
118
  import {
111
119
  drop
112
120
  } from "../chunk-S3CORED5.mjs";
@@ -128,9 +136,6 @@ import {
128
136
  import {
129
137
  flatten
130
138
  } from "../chunk-33MSBDC6.mjs";
131
- import {
132
- forEachRight
133
- } from "../chunk-IEA53J7P.mjs";
134
139
  import {
135
140
  chunk
136
141
  } from "../chunk-E6C5EZQA.mjs";
@@ -146,11 +151,6 @@ import {
146
151
  import {
147
152
  differenceBy
148
153
  } from "../chunk-LVWX5B43.mjs";
149
- import {
150
- differenceWith
151
- } from "../chunk-6NVQAHXP.mjs";
152
- import "../chunk-GIWAOOFY.mjs";
153
- import "../chunk-SYWMYQYJ.mjs";
154
154
  import "../chunk-2HIMLZE3.mjs";
155
155
  export {
156
156
  chunk,
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-236H5JZJ.mjs.map
@@ -0,0 +1,9 @@
1
+ // src/function/negate.ts
2
+ function negate(func) {
3
+ return (...args) => !func(...args);
4
+ }
5
+
6
+ export {
7
+ negate
8
+ };
9
+ //# sourceMappingURL=chunk-5G67ICEW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/function/negate.ts"],"sourcesContent":["\nexport function negate<F extends (...args: unknown[]) => boolean>(func: F): F {\n return ((...args: any[]) => !func(...args)) as F;\n}\n"],"mappings":";AACO,SAAS,OAAkD,MAAY;AAC1E,SAAQ,IAAI,SAAgB,CAAC,KAAK,GAAG,IAAI;AAC7C;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-ASJF5D6C.mjs.map
@@ -0,0 +1,41 @@
1
+ import {
2
+ union
3
+ } from "./chunk-R6QA7PLZ.mjs";
4
+
5
+ // src/predicate/isEqual.ts
6
+ function isEqual(a, b) {
7
+ if (Object.is(a, b)) {
8
+ return true;
9
+ }
10
+ if (a instanceof Date && b instanceof Date) {
11
+ return a.getTime() === b.getTime();
12
+ }
13
+ if (a instanceof RegExp && b instanceof RegExp) {
14
+ return a.source === b.source && a.flags === b.flags;
15
+ }
16
+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) {
17
+ return false;
18
+ }
19
+ const aKeys = Object.keys(a);
20
+ const bKeys = Object.keys(b);
21
+ if (aKeys.length !== bKeys.length) {
22
+ return false;
23
+ }
24
+ if (union(aKeys, bKeys).length !== aKeys.length) {
25
+ return false;
26
+ }
27
+ for (let i = 0; i < aKeys.length; i++) {
28
+ const propKey = aKeys[i];
29
+ const aProp = a[propKey];
30
+ const bProp = b[propKey];
31
+ if (!isEqual(aProp, bProp)) {
32
+ return false;
33
+ }
34
+ }
35
+ return true;
36
+ }
37
+
38
+ export {
39
+ isEqual
40
+ };
41
+ //# sourceMappingURL=chunk-JYSV56US.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/predicate/isEqual.ts"],"sourcesContent":["import { union } from \"../array/union.ts\";\n\n/**\n * Checks if two values are equal, including support for `Date`, `RegExp`, and deep object comparison.\n *\n * @param {unknown} a - The first value to compare.\n * @param {unknown} b - The second value to compare.\n * @returns {boolean} `true` if the values are equal, otherwise `false`.\n *\n * @example\n * isEqual(1, 1); // true\n * isEqual({ a: 1 }, { a: 1 }); // true\n * isEqual(/abc/g, /abc/g); // true\n * isEqual(new Date('2020-01-01'), new Date('2020-01-01')); // true\n * isEqual([1, 2, 3], [1, 2, 3]); // true\n */\nexport function isEqual(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) {\n return true;\n }\n\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n\n if (a instanceof RegExp && b instanceof RegExp) {\n return a.source === b.source && a.flags === b.flags;\n }\n\n if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {\n return false;\n }\n\n const aKeys = Object.keys(a as object);\n const bKeys = Object.keys(b as object);\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n // check if all keys in both arrays match\n if (union(aKeys, bKeys).length !== aKeys.length) {\n return false;\n }\n\n for (let i = 0; i < aKeys.length; i++) {\n const propKey = aKeys[i];\n const aProp = (a as any)[propKey];\n const bProp = (b as any)[propKey];\n \n if (!isEqual(aProp, bProp)) {\n return false;\n }\n }\n\n return true;\n}\n"],"mappings":";;;;;AAgBO,SAAS,QAAQ,GAAY,GAAqB;AACvD,MAAI,OAAO,GAAG,GAAG,CAAC,GAAG;AACnB,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,QAAQ,aAAa,MAAM;AAC1C,WAAO,EAAE,QAAQ,MAAM,EAAE,QAAQ;AAAA,EACnC;AAEA,MAAI,aAAa,UAAU,aAAa,QAAQ;AAC9C,WAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE;AAAA,EAChD;AAEA,MAAI,OAAO,MAAM,YAAY,OAAO,MAAM,YAAY,MAAM,QAAQ,MAAM,MAAM;AAC9E,WAAO;AAAA,EACT;AAEA,QAAM,QAAQ,OAAO,KAAK,CAAW;AACrC,QAAM,QAAQ,OAAO,KAAK,CAAW;AAErC,MAAI,MAAM,WAAW,MAAM,QAAQ;AACjC,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,OAAO,KAAK,EAAE,WAAW,MAAM,QAAQ;AAC/C,WAAO;AAAA,EACT;AAEA,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAM,UAAU,MAAM,CAAC;AACvB,UAAM,QAAS,EAAU,OAAO;AAChC,UAAM,QAAS,EAAU,OAAO;AAEhC,QAAI,CAAC,QAAQ,OAAO,KAAK,GAAG;AAC1B,aAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
@@ -2,3 +2,4 @@ export { debounce } from './debounce.mjs';
2
2
  export { noop } from './noop.mjs';
3
3
  export { once } from './once.mjs';
4
4
  export { throttle } from './throttle.mjs';
5
+ export { negate } from './negate.mjs';
@@ -2,3 +2,4 @@ export { debounce } from './debounce.js';
2
2
  export { noop } from './noop.js';
3
3
  export { once } from './once.js';
4
4
  export { throttle } from './throttle.js';
5
+ export { negate } from './negate.js';
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var function_exports = {};
22
22
  __export(function_exports, {
23
23
  debounce: () => debounce,
24
+ negate: () => negate,
24
25
  noop: () => noop,
25
26
  once: () => once,
26
27
  throttle: () => throttle
@@ -86,9 +87,15 @@ function throttle(func, throttleMs) {
86
87
  };
87
88
  return throttledFunction;
88
89
  }
90
+
91
+ // src/function/negate.ts
92
+ function negate(func) {
93
+ return (...args) => !func(...args);
94
+ }
89
95
  // Annotate the CommonJS export names for ESM import in node:
90
96
  0 && (module.exports = {
91
97
  debounce,
98
+ negate,
92
99
  noop,
93
100
  once,
94
101
  throttle
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/function/index.ts","../../src/function/debounce.ts","../../src/function/noop.ts","../../src/function/once.ts","../../src/function/throttle.ts"],"sourcesContent":["export { debounce } from './debounce.ts';\nexport { noop } from './noop.ts';\nexport { once } from './once.ts';\nexport { throttle } from './throttle.ts';\n","interface DebounceOptions {\n signal?: AbortSignal;\n}\n\n/**\n * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds\n * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`\n * method to cancel any pending execution.\n *\n * @template F - The type of function.\n * @param {F} func - The function to debounce.\n * @param {number} debounceMs - The number of milliseconds to delay.\n * @param {DebounceOptions} options - The options object.\n * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.\n * @returns {F & { cancel: () => void }} A new debounced function with a `cancel` method.\n *\n * @example\n * const debouncedFunction = debounce(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' after 1 second if not called again in that time\n * debouncedFunction();\n *\n * // Will not log anything as the previous call is canceled\n * debouncedFunction.cancel();\n *\n * // With AbortSignal\n * const controller = new AbortController();\n * const signal = controller.signal;\n * const debouncedWithSignal = debounce(() => {\n * console.log('Function executed');\n * }, 1000, { signal });\n *\n * debouncedWithSignal();\n *\n * // Will cancel the debounced function call\n * controller.abort();\n */\nexport function debounce<F extends (...args: any[]) => void>(\n func: F,\n debounceMs: number,\n { signal }: DebounceOptions = {}\n): F & { cancel: () => void } {\n let timeoutId: number | null = null;\n\n const debounced = function (...args: Parameters<F>) {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n if (signal?.aborted) {\n return;\n }\n\n timeoutId = setTimeout(() => {\n func(...args);\n timeoutId = null;\n }, debounceMs) as any;\n } as F & { cancel: () => void };\n\n const onAbort = function () {\n debounced.cancel();\n };\n\n debounced.cancel = function () {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n signal?.addEventListener('abort', onAbort, { once: true });\n\n return debounced;\n}\n","/**\n * A no-operation function that does nothing.\n * This can be used as a placeholder or default function.\n *\n * @example\n * noop(); // Does nothing\n *\n * @returns {void} This function does not return anything.\n */\nexport function noop(): void {}\n","/**\n * Creates a function that is restricted to invoking the provided function `func` once.\n * Repeated calls to the function will return the value from the first invocation.\n *\n * @template F - The type of function.\n * @param {F} func - The function to restrict.\n * @returns {F} A new function that invokes `func` once and caches the result.\n *\n * @example\n * const initialize = once(() => {\n * console.log('Initialized!');\n * return true;\n * });\n *\n * initialize(); // Logs: 'Initialized!' and returns true\n * initialize(); // Returns true without logging\n */\nexport function once<F extends () => any>(func: F): F {\n let called = false;\n let cache: ReturnType<F> | undefined;\n\n return function () {\n if (called) {\n return cache;\n }\n\n const result = func();\n\n called = true;\n cache = result;\n\n return result;\n } as F;\n}\n","/**\n * Creates a throttled function that only invokes the provided function at most once\n * per every `throttleMs` milliseconds. Subsequent calls to the throttled function\n * within the wait time will not trigger the execution of the original function.\n *\n * @template F - The type of function.\n * @param {F} func - The function to throttle.\n * @param {number} throttleMs - The number of milliseconds to throttle executions to.\n * @returns {F} A new throttled function that accepts the same parameters as the original function.\n *\n * @example\n * const throttledFunction = throttle(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' immediately\n * throttledFunction();\n *\n * // Will not log anything as it is within the throttle time\n * throttledFunction();\n *\n * // After 1 second\n * setTimeout(() => {\n * throttledFunction(); // Will log 'Function executed'\n * }, 1000);\n */\nexport function throttle<F extends (...args: any[]) => void>(func: F, throttleMs: number): F {\n let lastCallTime: number | null;\n\n const throttledFunction = function (...args: Parameters<F>) {\n const now = Date.now();\n\n if (lastCallTime == null || now - lastCallTime >= throttleMs) {\n lastCallTime = now;\n func(...args);\n }\n } as F;\n\n return throttledFunction;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACuCO,SAAS,SACd,MACA,YACA,EAAE,OAAO,IAAqB,CAAC,GACH;AAC5B,MAAI,YAA2B;AAE/B,QAAM,YAAY,YAAa,MAAqB;AAClD,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AAAA,IACxB;AAEA,QAAI,iCAAQ,SAAS;AACnB;AAAA,IACF;AAEA,gBAAY,WAAW,MAAM;AAC3B,WAAK,GAAG,IAAI;AACZ,kBAAY;AAAA,IACd,GAAG,UAAU;AAAA,EACf;AAEA,QAAM,UAAU,WAAY;AAC1B,cAAU,OAAO;AAAA,EACnB;AAEA,YAAU,SAAS,WAAY;AAC7B,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AACtB,kBAAY;AAAA,IACd;AAAA,EACF;AAEA,mCAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK;AAExD,SAAO;AACT;;;AClEO,SAAS,OAAa;AAAC;;;ACQvB,SAAS,KAA0B,MAAY;AACpD,MAAI,SAAS;AACb,MAAI;AAEJ,SAAO,WAAY;AACjB,QAAI,QAAQ;AACV,aAAO;AAAA,IACT;AAEA,UAAM,SAAS,KAAK;AAEpB,aAAS;AACT,YAAQ;AAER,WAAO;AAAA,EACT;AACF;;;ACPO,SAAS,SAA6C,MAAS,YAAuB;AAC3F,MAAI;AAEJ,QAAM,oBAAoB,YAAa,MAAqB;AAC1D,UAAM,MAAM,KAAK,IAAI;AAErB,QAAI,gBAAgB,QAAQ,MAAM,gBAAgB,YAAY;AAC5D,qBAAe;AACf,WAAK,GAAG,IAAI;AAAA,IACd;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../src/function/index.ts","../../src/function/debounce.ts","../../src/function/noop.ts","../../src/function/once.ts","../../src/function/throttle.ts","../../src/function/negate.ts"],"sourcesContent":["export { debounce } from './debounce.ts';\nexport { noop } from './noop.ts';\nexport { once } from './once.ts';\nexport { throttle } from './throttle.ts';\nexport { negate } from './negate.ts';\n","interface DebounceOptions {\n signal?: AbortSignal;\n}\n\n/**\n * Creates a debounced function that delays invoking the provided function until after `debounceMs` milliseconds\n * have elapsed since the last time the debounced function was invoked. The debounced function also has a `cancel`\n * method to cancel any pending execution.\n *\n * @template F - The type of function.\n * @param {F} func - The function to debounce.\n * @param {number} debounceMs - The number of milliseconds to delay.\n * @param {DebounceOptions} options - The options object.\n * @param {AbortSignal} options.signal - An optional AbortSignal to cancel the debounced function.\n * @returns {F & { cancel: () => void }} A new debounced function with a `cancel` method.\n *\n * @example\n * const debouncedFunction = debounce(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' after 1 second if not called again in that time\n * debouncedFunction();\n *\n * // Will not log anything as the previous call is canceled\n * debouncedFunction.cancel();\n *\n * // With AbortSignal\n * const controller = new AbortController();\n * const signal = controller.signal;\n * const debouncedWithSignal = debounce(() => {\n * console.log('Function executed');\n * }, 1000, { signal });\n *\n * debouncedWithSignal();\n *\n * // Will cancel the debounced function call\n * controller.abort();\n */\nexport function debounce<F extends (...args: any[]) => void>(\n func: F,\n debounceMs: number,\n { signal }: DebounceOptions = {}\n): F & { cancel: () => void } {\n let timeoutId: number | null = null;\n\n const debounced = function (...args: Parameters<F>) {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n }\n\n if (signal?.aborted) {\n return;\n }\n\n timeoutId = setTimeout(() => {\n func(...args);\n timeoutId = null;\n }, debounceMs) as any;\n } as F & { cancel: () => void };\n\n const onAbort = function () {\n debounced.cancel();\n };\n\n debounced.cancel = function () {\n if (timeoutId !== null) {\n clearTimeout(timeoutId);\n timeoutId = null;\n }\n };\n\n signal?.addEventListener('abort', onAbort, { once: true });\n\n return debounced;\n}\n","/**\n * A no-operation function that does nothing.\n * This can be used as a placeholder or default function.\n *\n * @example\n * noop(); // Does nothing\n *\n * @returns {void} This function does not return anything.\n */\nexport function noop(): void {}\n","/**\n * Creates a function that is restricted to invoking the provided function `func` once.\n * Repeated calls to the function will return the value from the first invocation.\n *\n * @template F - The type of function.\n * @param {F} func - The function to restrict.\n * @returns {F} A new function that invokes `func` once and caches the result.\n *\n * @example\n * const initialize = once(() => {\n * console.log('Initialized!');\n * return true;\n * });\n *\n * initialize(); // Logs: 'Initialized!' and returns true\n * initialize(); // Returns true without logging\n */\nexport function once<F extends () => any>(func: F): F {\n let called = false;\n let cache: ReturnType<F> | undefined;\n\n return function () {\n if (called) {\n return cache;\n }\n\n const result = func();\n\n called = true;\n cache = result;\n\n return result;\n } as F;\n}\n","/**\n * Creates a throttled function that only invokes the provided function at most once\n * per every `throttleMs` milliseconds. Subsequent calls to the throttled function\n * within the wait time will not trigger the execution of the original function.\n *\n * @template F - The type of function.\n * @param {F} func - The function to throttle.\n * @param {number} throttleMs - The number of milliseconds to throttle executions to.\n * @returns {F} A new throttled function that accepts the same parameters as the original function.\n *\n * @example\n * const throttledFunction = throttle(() => {\n * console.log('Function executed');\n * }, 1000);\n *\n * // Will log 'Function executed' immediately\n * throttledFunction();\n *\n * // Will not log anything as it is within the throttle time\n * throttledFunction();\n *\n * // After 1 second\n * setTimeout(() => {\n * throttledFunction(); // Will log 'Function executed'\n * }, 1000);\n */\nexport function throttle<F extends (...args: any[]) => void>(func: F, throttleMs: number): F {\n let lastCallTime: number | null;\n\n const throttledFunction = function (...args: Parameters<F>) {\n const now = Date.now();\n\n if (lastCallTime == null || now - lastCallTime >= throttleMs) {\n lastCallTime = now;\n func(...args);\n }\n } as F;\n\n return throttledFunction;\n}\n","\nexport function negate<F extends (...args: unknown[]) => boolean>(func: F): F {\n return ((...args: any[]) => !func(...args)) as F;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACuCO,SAAS,SACd,MACA,YACA,EAAE,OAAO,IAAqB,CAAC,GACH;AAC5B,MAAI,YAA2B;AAE/B,QAAM,YAAY,YAAa,MAAqB;AAClD,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AAAA,IACxB;AAEA,QAAI,iCAAQ,SAAS;AACnB;AAAA,IACF;AAEA,gBAAY,WAAW,MAAM;AAC3B,WAAK,GAAG,IAAI;AACZ,kBAAY;AAAA,IACd,GAAG,UAAU;AAAA,EACf;AAEA,QAAM,UAAU,WAAY;AAC1B,cAAU,OAAO;AAAA,EACnB;AAEA,YAAU,SAAS,WAAY;AAC7B,QAAI,cAAc,MAAM;AACtB,mBAAa,SAAS;AACtB,kBAAY;AAAA,IACd;AAAA,EACF;AAEA,mCAAQ,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK;AAExD,SAAO;AACT;;;AClEO,SAAS,OAAa;AAAC;;;ACQvB,SAAS,KAA0B,MAAY;AACpD,MAAI,SAAS;AACb,MAAI;AAEJ,SAAO,WAAY;AACjB,QAAI,QAAQ;AACV,aAAO;AAAA,IACT;AAEA,UAAM,SAAS,KAAK;AAEpB,aAAS;AACT,YAAQ;AAER,WAAO;AAAA,EACT;AACF;;;ACPO,SAAS,SAA6C,MAAS,YAAuB;AAC3F,MAAI;AAEJ,QAAM,oBAAoB,YAAa,MAAqB;AAC1D,UAAM,MAAM,KAAK,IAAI;AAErB,QAAI,gBAAgB,QAAQ,MAAM,gBAAgB,YAAY;AAC5D,qBAAe;AACf,WAAK,GAAG,IAAI;AAAA,IACd;AAAA,EACF;AAEA,SAAO;AACT;;;ACtCO,SAAS,OAAkD,MAAY;AAC1E,SAAQ,IAAI,SAAgB,CAAC,KAAK,GAAG,IAAI;AAC7C;","names":[]}
@@ -1,7 +1,7 @@
1
- import "../chunk-N6EM6ETS.mjs";
1
+ import "../chunk-236H5JZJ.mjs";
2
2
  import {
3
- debounce
4
- } from "../chunk-3IP4JVLL.mjs";
3
+ negate
4
+ } from "../chunk-5G67ICEW.mjs";
5
5
  import {
6
6
  noop
7
7
  } from "../chunk-LKXCOLNY.mjs";
@@ -11,9 +11,13 @@ import {
11
11
  import {
12
12
  throttle
13
13
  } from "../chunk-QOJGMVVR.mjs";
14
+ import {
15
+ debounce
16
+ } from "../chunk-3IP4JVLL.mjs";
14
17
  import "../chunk-2HIMLZE3.mjs";
15
18
  export {
16
19
  debounce,
20
+ negate,
17
21
  noop,
18
22
  once,
19
23
  throttle
@@ -0,0 +1,3 @@
1
+ declare function negate<F extends (...args: unknown[]) => boolean>(func: F): F;
2
+
3
+ export { negate };
@@ -0,0 +1,3 @@
1
+ declare function negate<F extends (...args: unknown[]) => boolean>(func: F): F;
2
+
3
+ export { negate };
@@ -0,0 +1,33 @@
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/function/negate.ts
21
+ var negate_exports = {};
22
+ __export(negate_exports, {
23
+ negate: () => negate
24
+ });
25
+ module.exports = __toCommonJS(negate_exports);
26
+ function negate(func) {
27
+ return (...args) => !func(...args);
28
+ }
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ negate
32
+ });
33
+ //# sourceMappingURL=negate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/function/negate.ts"],"sourcesContent":["\nexport function negate<F extends (...args: unknown[]) => boolean>(func: F): F {\n return ((...args: any[]) => !func(...args)) as F;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,SAAS,OAAkD,MAAY;AAC1E,SAAQ,IAAI,SAAgB,CAAC,KAAK,GAAG,IAAI;AAC7C;","names":[]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ negate
3
+ } from "../chunk-5G67ICEW.mjs";
4
+ import "../chunk-2HIMLZE3.mjs";
5
+ export {
6
+ negate
7
+ };
8
+ //# sourceMappingURL=negate.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/dist/index.d.mts CHANGED
@@ -53,6 +53,7 @@ export { debounce } from './function/debounce.mjs';
53
53
  export { noop } from './function/noop.mjs';
54
54
  export { once } from './function/once.mjs';
55
55
  export { throttle } from './function/throttle.mjs';
56
+ export { negate } from './function/negate.mjs';
56
57
  export { clamp } from './math/clamp.mjs';
57
58
  export { inRange } from './math/inRange.mjs';
58
59
  export { mean } from './math/mean.mjs';
@@ -68,6 +69,7 @@ export { pick } from './object/pick.mjs';
68
69
  export { pickBy } from './object/pickBy.mjs';
69
70
  export { invert } from './object/invert.mjs';
70
71
  export { clone } from './object/clone.mjs';
72
+ export { isEqual } from './predicate/isEqual.mjs';
71
73
  export { isNil } from './predicate/isNil.mjs';
72
74
  export { isNotNil } from './predicate/isNotNil.mjs';
73
75
  export { isNull } from './predicate/isNull.mjs';
package/dist/index.d.ts CHANGED
@@ -53,6 +53,7 @@ export { debounce } from './function/debounce.js';
53
53
  export { noop } from './function/noop.js';
54
54
  export { once } from './function/once.js';
55
55
  export { throttle } from './function/throttle.js';
56
+ export { negate } from './function/negate.js';
56
57
  export { clamp } from './math/clamp.js';
57
58
  export { inRange } from './math/inRange.js';
58
59
  export { mean } from './math/mean.js';
@@ -68,6 +69,7 @@ export { pick } from './object/pick.js';
68
69
  export { pickBy } from './object/pickBy.js';
69
70
  export { invert } from './object/invert.js';
70
71
  export { clone } from './object/clone.js';
72
+ export { isEqual } from './predicate/isEqual.js';
71
73
  export { isNil } from './predicate/isNil.js';
72
74
  export { isNotNil } from './predicate/isNotNil.js';
73
75
  export { isNull } from './predicate/isNull.js';
package/dist/index.js CHANGED
@@ -3749,7 +3749,7 @@ var require_lodash = __commonJS({
3749
3749
  }
3750
3750
  function reject(collection, predicate) {
3751
3751
  var func = isArray(collection) ? arrayFilter : baseFilter;
3752
- return func(collection, negate(getIteratee(predicate, 3)));
3752
+ return func(collection, negate2(getIteratee(predicate, 3)));
3753
3753
  }
3754
3754
  function sample2(collection) {
3755
3755
  var func = isArray(collection) ? arraySample : baseSample;
@@ -3970,7 +3970,7 @@ var require_lodash = __commonJS({
3970
3970
  return memoized;
3971
3971
  }
3972
3972
  memoize.Cache = MapCache;
3973
- function negate(predicate) {
3973
+ function negate2(predicate) {
3974
3974
  if (typeof predicate != "function") {
3975
3975
  throw new TypeError2(FUNC_ERROR_TEXT);
3976
3976
  }
@@ -4128,7 +4128,7 @@ var require_lodash = __commonJS({
4128
4128
  }
4129
4129
  return true;
4130
4130
  }
4131
- function isEqual(value, other) {
4131
+ function isEqual2(value, other) {
4132
4132
  return baseIsEqual(value, other);
4133
4133
  }
4134
4134
  function isEqualWith(value, other, customizer) {
@@ -4439,7 +4439,7 @@ var require_lodash = __commonJS({
4439
4439
  return result2;
4440
4440
  });
4441
4441
  function omitBy2(object, predicate) {
4442
- return pickBy2(object, negate(getIteratee(predicate)));
4442
+ return pickBy2(object, negate2(getIteratee(predicate)));
4443
4443
  }
4444
4444
  var pick2 = flatRest(function(object, paths) {
4445
4445
  return object == null ? {} : basePick(object, paths);
@@ -5106,7 +5106,7 @@ var require_lodash = __commonJS({
5106
5106
  lodash.method = method;
5107
5107
  lodash.methodOf = methodOf;
5108
5108
  lodash.mixin = mixin;
5109
- lodash.negate = negate;
5109
+ lodash.negate = negate2;
5110
5110
  lodash.nthArg = nthArg;
5111
5111
  lodash.omit = omit2;
5112
5112
  lodash.omitBy = omitBy2;
@@ -5241,7 +5241,7 @@ var require_lodash = __commonJS({
5241
5241
  lodash.isDate = isDate;
5242
5242
  lodash.isElement = isElement;
5243
5243
  lodash.isEmpty = isEmpty;
5244
- lodash.isEqual = isEqual;
5244
+ lodash.isEqual = isEqual2;
5245
5245
  lodash.isEqualWith = isEqualWith;
5246
5246
  lodash.isError = isError;
5247
5247
  lodash.isFinite = isFinite;
@@ -5413,7 +5413,7 @@ var require_lodash = __commonJS({
5413
5413
  });
5414
5414
  });
5415
5415
  LazyWrapper.prototype.reject = function(predicate) {
5416
- return this.filter(negate(getIteratee(predicate)));
5416
+ return this.filter(negate2(getIteratee(predicate)));
5417
5417
  };
5418
5418
  LazyWrapper.prototype.slice = function(start, end) {
5419
5419
  start = toInteger(start);
@@ -5557,6 +5557,7 @@ __export(src_exports, {
5557
5557
  intersectionBy: () => intersectionBy,
5558
5558
  intersectionWith: () => intersectionWith,
5559
5559
  invert: () => invert,
5560
+ isEqual: () => isEqual,
5560
5561
  isNil: () => isNil,
5561
5562
  isNotNil: () => isNotNil,
5562
5563
  isNull: () => isNull,
@@ -5569,6 +5570,7 @@ __export(src_exports, {
5569
5570
  mean: () => mean,
5570
5571
  meanBy: () => meanBy,
5571
5572
  minBy: () => minBy,
5573
+ negate: () => negate,
5572
5574
  noop: () => noop,
5573
5575
  omit: () => omit,
5574
5576
  omitBy: () => omitBy,
@@ -6191,6 +6193,11 @@ function throttle(func, throttleMs) {
6191
6193
  return throttledFunction;
6192
6194
  }
6193
6195
 
6196
+ // src/function/negate.ts
6197
+ function negate(func) {
6198
+ return (...args) => !func(...args);
6199
+ }
6200
+
6194
6201
  // src/math/clamp.ts
6195
6202
  function clamp(value, bound1, bound2) {
6196
6203
  if (bound2 == null) {
@@ -6349,6 +6356,39 @@ function isPrimitive(value) {
6349
6356
  return value == null || typeof value !== "object" && typeof value !== "function";
6350
6357
  }
6351
6358
 
6359
+ // src/predicate/isEqual.ts
6360
+ function isEqual(a, b) {
6361
+ if (Object.is(a, b)) {
6362
+ return true;
6363
+ }
6364
+ if (a instanceof Date && b instanceof Date) {
6365
+ return a.getTime() === b.getTime();
6366
+ }
6367
+ if (a instanceof RegExp && b instanceof RegExp) {
6368
+ return a.source === b.source && a.flags === b.flags;
6369
+ }
6370
+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) {
6371
+ return false;
6372
+ }
6373
+ const aKeys = Object.keys(a);
6374
+ const bKeys = Object.keys(b);
6375
+ if (aKeys.length !== bKeys.length) {
6376
+ return false;
6377
+ }
6378
+ if (union(aKeys, bKeys).length !== aKeys.length) {
6379
+ return false;
6380
+ }
6381
+ for (let i = 0; i < aKeys.length; i++) {
6382
+ const propKey = aKeys[i];
6383
+ const aProp = a[propKey];
6384
+ const bProp = b[propKey];
6385
+ if (!isEqual(aProp, bProp)) {
6386
+ return false;
6387
+ }
6388
+ }
6389
+ return true;
6390
+ }
6391
+
6352
6392
  // src/predicate/isNil.ts
6353
6393
  function isNil(x) {
6354
6394
  return x == null;
@@ -6460,6 +6500,7 @@ var capitalize2 = (str) => {
6460
6500
  intersectionBy,
6461
6501
  intersectionWith,
6462
6502
  invert,
6503
+ isEqual,
6463
6504
  isNil,
6464
6505
  isNotNil,
6465
6506
  isNull,
@@ -6472,6 +6513,7 @@ var capitalize2 = (str) => {
6472
6513
  mean,
6473
6514
  meanBy,
6474
6515
  minBy,
6516
+ negate,
6475
6517
  noop,
6476
6518
  omit,
6477
6519
  omitBy,