es-toolkit 1.9.0-dev.198 → 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.
- package/dist/array/index.mjs +44 -44
- package/dist/chunk-236H5JZJ.mjs +1 -0
- package/dist/chunk-5G67ICEW.mjs +9 -0
- package/dist/chunk-5G67ICEW.mjs.map +1 -0
- package/dist/function/index.d.mts +1 -0
- package/dist/function/index.d.ts +1 -0
- package/dist/function/index.js +7 -0
- package/dist/function/index.js.map +1 -1
- package/dist/function/index.mjs +7 -3
- package/dist/function/negate.d.mts +3 -0
- package/dist/function/negate.d.ts +3 -0
- package/dist/function/negate.js +33 -0
- package/dist/function/negate.js.map +1 -0
- package/dist/function/negate.mjs +8 -0
- package/dist/function/negate.mjs.map +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +77 -73
- package/dist/math/index.mjs +3 -3
- package/dist/object/index.mjs +3 -3
- package/dist/predicate/index.mjs +3 -3
- package/dist/string/index.mjs +4 -4
- package/package.json +1 -1
- package/dist/chunk-N6EM6ETS.mjs +0 -1
- /package/dist/{chunk-N6EM6ETS.mjs.map → chunk-236H5JZJ.mjs.map} +0 -0
package/dist/array/index.mjs
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import "../chunk-2MRZANXZ.mjs";
|
|
2
|
+
import {
|
|
3
|
+
xor
|
|
4
|
+
} from "../chunk-L7FQX5MN.mjs";
|
|
5
|
+
import {
|
|
6
|
+
xorBy
|
|
7
|
+
} from "../chunk-Q47NGNXT.mjs";
|
|
8
|
+
import {
|
|
9
|
+
xorWith
|
|
10
|
+
} from "../chunk-QRSJBBFY.mjs";
|
|
2
11
|
import {
|
|
3
12
|
zip
|
|
4
13
|
} from "../chunk-IDCUZVJL.mjs";
|
|
@@ -8,9 +17,18 @@ import {
|
|
|
8
17
|
import {
|
|
9
18
|
zipWith
|
|
10
19
|
} from "../chunk-4KYXHZ4R.mjs";
|
|
20
|
+
import {
|
|
21
|
+
unionBy
|
|
22
|
+
} from "../chunk-NFS7RWWE.mjs";
|
|
23
|
+
import {
|
|
24
|
+
unionWith
|
|
25
|
+
} from "../chunk-2ZCITDMK.mjs";
|
|
11
26
|
import {
|
|
12
27
|
uniqBy
|
|
13
28
|
} from "../chunk-OXAZEEGP.mjs";
|
|
29
|
+
import {
|
|
30
|
+
uniqWith
|
|
31
|
+
} from "../chunk-237HGSZS.mjs";
|
|
14
32
|
import {
|
|
15
33
|
unzip
|
|
16
34
|
} from "../chunk-UYZKMBDO.mjs";
|
|
@@ -21,14 +39,14 @@ import {
|
|
|
21
39
|
without
|
|
22
40
|
} from "../chunk-PYEYV7BY.mjs";
|
|
23
41
|
import {
|
|
24
|
-
|
|
25
|
-
} from "../chunk-
|
|
42
|
+
shuffle
|
|
43
|
+
} from "../chunk-G7UQ5PUR.mjs";
|
|
26
44
|
import {
|
|
27
|
-
|
|
28
|
-
} from "../chunk-
|
|
45
|
+
tail
|
|
46
|
+
} from "../chunk-OF6NM4G7.mjs";
|
|
29
47
|
import {
|
|
30
|
-
|
|
31
|
-
} from "../chunk-
|
|
48
|
+
take
|
|
49
|
+
} from "../chunk-ME352XO7.mjs";
|
|
32
50
|
import {
|
|
33
51
|
takeRight
|
|
34
52
|
} from "../chunk-IQLKIDXF.mjs";
|
|
@@ -45,17 +63,17 @@ import {
|
|
|
45
63
|
union
|
|
46
64
|
} from "../chunk-R6QA7PLZ.mjs";
|
|
47
65
|
import {
|
|
48
|
-
|
|
49
|
-
} from "../chunk-
|
|
66
|
+
uniq
|
|
67
|
+
} from "../chunk-DVK2N4KC.mjs";
|
|
50
68
|
import {
|
|
51
|
-
|
|
52
|
-
} from "../chunk-
|
|
69
|
+
keyBy
|
|
70
|
+
} from "../chunk-AJKZMN2V.mjs";
|
|
53
71
|
import {
|
|
54
|
-
|
|
55
|
-
} from "../chunk-
|
|
72
|
+
last
|
|
73
|
+
} from "../chunk-KPBQ7OUY.mjs";
|
|
56
74
|
import {
|
|
57
|
-
|
|
58
|
-
} from "../chunk-
|
|
75
|
+
maxBy
|
|
76
|
+
} from "../chunk-OOKNBU4V.mjs";
|
|
59
77
|
import {
|
|
60
78
|
minBy
|
|
61
79
|
} from "../chunk-IJD7FE2Z.mjs";
|
|
@@ -74,14 +92,14 @@ import {
|
|
|
74
92
|
import "../chunk-GIWAOOFY.mjs";
|
|
75
93
|
import "../chunk-SYWMYQYJ.mjs";
|
|
76
94
|
import {
|
|
77
|
-
|
|
78
|
-
} from "../chunk-
|
|
95
|
+
forEachRight
|
|
96
|
+
} from "../chunk-IEA53J7P.mjs";
|
|
79
97
|
import {
|
|
80
|
-
|
|
81
|
-
} from "../chunk-
|
|
98
|
+
groupBy
|
|
99
|
+
} from "../chunk-E6E4RZLN.mjs";
|
|
82
100
|
import {
|
|
83
|
-
|
|
84
|
-
} from "../chunk-
|
|
101
|
+
head
|
|
102
|
+
} from "../chunk-HM2JT2RX.mjs";
|
|
85
103
|
import {
|
|
86
104
|
initial
|
|
87
105
|
} from "../chunk-XPSOKBRZ.mjs";
|
|
@@ -95,14 +113,14 @@ import {
|
|
|
95
113
|
intersectionWith
|
|
96
114
|
} from "../chunk-XI7KRD2C.mjs";
|
|
97
115
|
import {
|
|
98
|
-
|
|
99
|
-
} from "../chunk-
|
|
116
|
+
differenceWith
|
|
117
|
+
} from "../chunk-6NVQAHXP.mjs";
|
|
100
118
|
import {
|
|
101
|
-
|
|
102
|
-
} from "../chunk-
|
|
119
|
+
drop
|
|
120
|
+
} from "../chunk-S3CORED5.mjs";
|
|
103
121
|
import {
|
|
104
|
-
|
|
105
|
-
} from "../chunk-
|
|
122
|
+
dropRight
|
|
123
|
+
} from "../chunk-JEKUA56R.mjs";
|
|
106
124
|
import {
|
|
107
125
|
dropRightWhile
|
|
108
126
|
} from "../chunk-JE6JKZU3.mjs";
|
|
@@ -118,15 +136,6 @@ import {
|
|
|
118
136
|
import {
|
|
119
137
|
flatten
|
|
120
138
|
} from "../chunk-33MSBDC6.mjs";
|
|
121
|
-
import {
|
|
122
|
-
forEachRight
|
|
123
|
-
} from "../chunk-IEA53J7P.mjs";
|
|
124
|
-
import {
|
|
125
|
-
groupBy
|
|
126
|
-
} from "../chunk-E6E4RZLN.mjs";
|
|
127
|
-
import {
|
|
128
|
-
head
|
|
129
|
-
} from "../chunk-HM2JT2RX.mjs";
|
|
130
139
|
import {
|
|
131
140
|
chunk
|
|
132
141
|
} from "../chunk-E6C5EZQA.mjs";
|
|
@@ -142,15 +151,6 @@ import {
|
|
|
142
151
|
import {
|
|
143
152
|
differenceBy
|
|
144
153
|
} from "../chunk-LVWX5B43.mjs";
|
|
145
|
-
import {
|
|
146
|
-
differenceWith
|
|
147
|
-
} from "../chunk-6NVQAHXP.mjs";
|
|
148
|
-
import {
|
|
149
|
-
drop
|
|
150
|
-
} 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 @@
|
|
|
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":[]}
|
package/dist/function/index.d.ts
CHANGED
package/dist/function/index.js
CHANGED
|
@@ -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":[]}
|
package/dist/function/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-236H5JZJ.mjs";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "../chunk-
|
|
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,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 @@
|
|
|
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,
|
|
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
|
|
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,
|
|
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 =
|
|
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(
|
|
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,
|