es-toolkit 1.9.0-dev.198 → 1.9.0-dev.200

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.
@@ -1,4 +1,7 @@
1
1
  import "../chunk-2MRZANXZ.mjs";
2
+ import {
3
+ xorWith
4
+ } from "../chunk-QRSJBBFY.mjs";
2
5
  import {
3
6
  zip
4
7
  } from "../chunk-IDCUZVJL.mjs";
@@ -27,8 +30,8 @@ import {
27
30
  xorBy
28
31
  } from "../chunk-Q47NGNXT.mjs";
29
32
  import {
30
- xorWith
31
- } from "../chunk-QRSJBBFY.mjs";
33
+ take
34
+ } from "../chunk-ME352XO7.mjs";
32
35
  import {
33
36
  takeRight
34
37
  } from "../chunk-IQLKIDXF.mjs";
@@ -44,6 +47,9 @@ import {
44
47
  import {
45
48
  union
46
49
  } from "../chunk-R6QA7PLZ.mjs";
50
+ import {
51
+ uniq
52
+ } from "../chunk-DVK2N4KC.mjs";
47
53
  import {
48
54
  unionBy
49
55
  } from "../chunk-NFS7RWWE.mjs";
@@ -54,8 +60,8 @@ import {
54
60
  uniqWith
55
61
  } from "../chunk-237HGSZS.mjs";
56
62
  import {
57
- uniq
58
- } from "../chunk-DVK2N4KC.mjs";
63
+ maxBy
64
+ } from "../chunk-OOKNBU4V.mjs";
59
65
  import {
60
66
  minBy
61
67
  } from "../chunk-IJD7FE2Z.mjs";
@@ -80,8 +86,8 @@ import {
80
86
  tail
81
87
  } from "../chunk-OF6NM4G7.mjs";
82
88
  import {
83
- take
84
- } from "../chunk-ME352XO7.mjs";
89
+ head
90
+ } from "../chunk-HM2JT2RX.mjs";
85
91
  import {
86
92
  initial
87
93
  } from "../chunk-XPSOKBRZ.mjs";
@@ -101,8 +107,8 @@ import {
101
107
  last
102
108
  } from "../chunk-KPBQ7OUY.mjs";
103
109
  import {
104
- maxBy
105
- } from "../chunk-OOKNBU4V.mjs";
110
+ dropRight
111
+ } from "../chunk-JEKUA56R.mjs";
106
112
  import {
107
113
  dropRightWhile
108
114
  } from "../chunk-JE6JKZU3.mjs";
@@ -124,9 +130,6 @@ import {
124
130
  import {
125
131
  groupBy
126
132
  } from "../chunk-E6E4RZLN.mjs";
127
- import {
128
- head
129
- } from "../chunk-HM2JT2RX.mjs";
130
133
  import {
131
134
  chunk
132
135
  } from "../chunk-E6C5EZQA.mjs";
@@ -148,9 +151,6 @@ import {
148
151
  import {
149
152
  drop
150
153
  } from "../chunk-S3CORED5.mjs";
151
- import {
152
- dropRight
153
- } from "../chunk-JEKUA56R.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-BOOQBJN2.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/function/negate.ts"],"sourcesContent":["/**\n * Creates a function that negates the result of the predicate function.\n *\n * @template F - The type of the function to negate.\n * @param {F} func - The function to negate.\n * @returns {F} The new negated function, which negates the boolean result of `func`.\n */\nexport function negate<F extends (...args: unknown[]) => boolean>(func: F): F {\n return ((...args: any[]) => !func(...args)) as F;\n}\n"],"mappings":";AAOO,SAAS,OAAkD,MAAY;AAC1E,SAAQ,IAAI,SAAgB,CAAC,KAAK,GAAG,IAAI;AAC7C;","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","/**\n * Creates a function that negates the result of the predicate function.\n *\n * @template F - The type of the function to negate.\n * @param {F} func - The function to negate.\n * @returns {F} The new negated function, which negates the boolean result of `func`.\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;;;AChCO,SAAS,OAAkD,MAAY;AAC1E,SAAQ,IAAI,SAAgB,CAAC,KAAK,GAAG,IAAI;AAC7C;","names":[]}
@@ -1,7 +1,10 @@
1
- import "../chunk-N6EM6ETS.mjs";
1
+ import "../chunk-236H5JZJ.mjs";
2
2
  import {
3
3
  debounce
4
4
  } from "../chunk-3IP4JVLL.mjs";
5
+ import {
6
+ negate
7
+ } from "../chunk-BOOQBJN2.mjs";
5
8
  import {
6
9
  noop
7
10
  } from "../chunk-LKXCOLNY.mjs";
@@ -14,6 +17,7 @@ import {
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,10 @@
1
+ /**
2
+ * Creates a function that negates the result of the predicate function.
3
+ *
4
+ * @template F - The type of the function to negate.
5
+ * @param {F} func - The function to negate.
6
+ * @returns {F} The new negated function, which negates the boolean result of `func`.
7
+ */
8
+ declare function negate<F extends (...args: unknown[]) => boolean>(func: F): F;
9
+
10
+ export { negate };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Creates a function that negates the result of the predicate function.
3
+ *
4
+ * @template F - The type of the function to negate.
5
+ * @param {F} func - The function to negate.
6
+ * @returns {F} The new negated function, which negates the boolean result of `func`.
7
+ */
8
+ declare function negate<F extends (...args: unknown[]) => boolean>(func: F): F;
9
+
10
+ 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":["/**\n * Creates a function that negates the result of the predicate function.\n *\n * @template F - The type of the function to negate.\n * @param {F} func - The function to negate.\n * @returns {F} The new negated function, which negates the boolean result of `func`.\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;AAOO,SAAS,OAAkD,MAAY;AAC1E,SAAQ,IAAI,SAAgB,CAAC,KAAK,GAAG,IAAI;AAC7C;","names":[]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ negate
3
+ } from "../chunk-BOOQBJN2.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';
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';
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
  }
@@ -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;
@@ -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);
@@ -5570,6 +5570,7 @@ __export(src_exports, {
5570
5570
  mean: () => mean,
5571
5571
  meanBy: () => meanBy,
5572
5572
  minBy: () => minBy,
5573
+ negate: () => negate,
5573
5574
  noop: () => noop,
5574
5575
  omit: () => omit,
5575
5576
  omitBy: () => omitBy,
@@ -6192,6 +6193,11 @@ function throttle(func, throttleMs) {
6192
6193
  return throttledFunction;
6193
6194
  }
6194
6195
 
6196
+ // src/function/negate.ts
6197
+ function negate(func) {
6198
+ return (...args) => !func(...args);
6199
+ }
6200
+
6195
6201
  // src/math/clamp.ts
6196
6202
  function clamp(value, bound1, bound2) {
6197
6203
  if (bound2 == null) {
@@ -6507,6 +6513,7 @@ var capitalize2 = (str) => {
6507
6513
  mean,
6508
6514
  meanBy,
6509
6515
  minBy,
6516
+ negate,
6510
6517
  noop,
6511
6518
  omit,
6512
6519
  omitBy,