es-toolkit 1.19.0-dev.619 → 1.19.0-dev.621
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/_chunk/{isNumber-CM_Bs0.js → isWeakSet-E_VMwB.js} +0 -10
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/array/findLastIndex.mjs +8 -8
- package/dist/compat/array/some.d.mts +0 -1
- package/dist/compat/array/some.d.ts +0 -1
- package/dist/compat/function/throttle.d.mts +30 -0
- package/dist/compat/function/throttle.d.ts +30 -0
- package/dist/compat/index.d.mts +3 -3
- package/dist/compat/index.d.ts +3 -3
- package/dist/compat/index.js +48 -33
- package/dist/compat/index.mjs +3 -3
- package/dist/{predicate → compat/predicate}/isNumber.d.mts +1 -1
- package/dist/{predicate → compat/predicate}/isNumber.d.ts +1 -1
- package/dist/compat/predicate/isNumber.mjs +10 -0
- package/dist/compat/string/camelCase.d.mts +1 -1
- package/dist/compat/string/camelCase.d.ts +1 -1
- package/dist/compat/string/kebabCase.d.mts +2 -2
- package/dist/compat/string/kebabCase.d.ts +2 -2
- package/dist/compat/string/lowerCase.d.mts +2 -2
- package/dist/compat/string/lowerCase.d.ts +2 -2
- package/dist/compat/string/snakeCase.d.mts +2 -2
- package/dist/compat/string/snakeCase.d.ts +2 -2
- package/dist/compat/string/startCase.d.mts +2 -2
- package/dist/compat/string/startCase.d.ts +2 -2
- package/dist/compat/string/trim.d.mts +0 -1
- package/dist/compat/string/trim.d.ts +0 -1
- package/dist/compat/string/trimEnd.d.mts +0 -1
- package/dist/compat/string/trimEnd.d.ts +0 -1
- package/dist/compat/string/trimStart.d.mts +0 -1
- package/dist/compat/string/trimStart.d.ts +0 -1
- package/dist/compat/string/upperCase.d.mts +17 -0
- package/dist/compat/string/upperCase.d.ts +17 -0
- package/dist/compat/string/upperCase.mjs +9 -0
- package/dist/index.d.mts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +11 -13
- package/dist/index.mjs +0 -2
- package/dist/predicate/index.d.mts +0 -2
- package/dist/predicate/index.d.ts +0 -2
- package/dist/predicate/index.js +11 -13
- package/dist/predicate/index.mjs +0 -2
- package/package.json +1 -1
- package/dist/predicate/isNumber.mjs +0 -5
- /package/dist/{predicate → compat/predicate}/isNaN.d.mts +0 -0
- /package/dist/{predicate → compat/predicate}/isNaN.d.ts +0 -0
- /package/dist/{predicate → compat/predicate}/isNaN.mjs +0 -0
|
@@ -2,30 +2,30 @@ import { property } from '../object/property.mjs';
|
|
|
2
2
|
import { matches } from '../predicate/matches.mjs';
|
|
3
3
|
import { matchesProperty } from '../predicate/matchesProperty.mjs';
|
|
4
4
|
|
|
5
|
-
function findLastIndex(
|
|
5
|
+
function findLastIndex(arr, doesMatch, fromIndex = arr.length - 1) {
|
|
6
6
|
if (fromIndex < 0) {
|
|
7
|
-
fromIndex = Math.max(
|
|
7
|
+
fromIndex = Math.max(arr.length + fromIndex, 0);
|
|
8
8
|
}
|
|
9
9
|
else {
|
|
10
|
-
fromIndex = Math.min(fromIndex,
|
|
10
|
+
fromIndex = Math.min(fromIndex, arr.length - 1);
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
arr = arr.slice(0, fromIndex + 1);
|
|
13
13
|
switch (typeof doesMatch) {
|
|
14
14
|
case 'function': {
|
|
15
|
-
return
|
|
15
|
+
return arr.findLastIndex(doesMatch);
|
|
16
16
|
}
|
|
17
17
|
case 'object': {
|
|
18
18
|
if (Array.isArray(doesMatch) && doesMatch.length === 2) {
|
|
19
19
|
const key = doesMatch[0];
|
|
20
20
|
const value = doesMatch[1];
|
|
21
|
-
return
|
|
21
|
+
return arr.findLastIndex(matchesProperty(key, value));
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
|
-
return
|
|
24
|
+
return arr.findLastIndex(matches(doesMatch));
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
case 'string': {
|
|
28
|
-
return
|
|
28
|
+
return arr.findLastIndex(property(doesMatch));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -65,7 +65,6 @@ declare function some<T>(arr: readonly T[], doesMatch: Partial<T>): boolean;
|
|
|
65
65
|
* @param {T[]} arr The array to iterate over.
|
|
66
66
|
* @param {((item: T, index: number, arr: any) => unknown) | Partial<T> | [keyof T, unknown] | string} [predicate=identity] The function invoked per iteration.
|
|
67
67
|
* If a property name or an object is provided it will be used to create a predicate function.
|
|
68
|
-
* @param guard
|
|
69
68
|
* @returns {boolean} Returns `true` if any element passes the predicate check, else `false`.
|
|
70
69
|
*
|
|
71
70
|
* @example
|
|
@@ -65,7 +65,6 @@ declare function some<T>(arr: readonly T[], doesMatch: Partial<T>): boolean;
|
|
|
65
65
|
* @param {T[]} arr The array to iterate over.
|
|
66
66
|
* @param {((item: T, index: number, arr: any) => unknown) | Partial<T> | [keyof T, unknown] | string} [predicate=identity] The function invoked per iteration.
|
|
67
67
|
* If a property name or an object is provided it will be used to create a predicate function.
|
|
68
|
-
* @param guard
|
|
69
68
|
* @returns {boolean} Returns `true` if any element passes the predicate check, else `false`.
|
|
70
69
|
*
|
|
71
70
|
* @example
|
|
@@ -14,6 +14,36 @@ interface ThrottleOptions {
|
|
|
14
14
|
*/
|
|
15
15
|
trailing?: boolean;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a throttled function that only invokes the provided function at most once
|
|
19
|
+
* per every `throttleMs` milliseconds. Subsequent calls to the throttled function
|
|
20
|
+
* within the wait time will not trigger the execution of the original function.
|
|
21
|
+
*
|
|
22
|
+
* @template F - The type of function.
|
|
23
|
+
* @param {F} func - The function to throttle.
|
|
24
|
+
* @param {number} throttleMs - The number of milliseconds to throttle executions to.
|
|
25
|
+
* @param {ThrottleOptions} options - The options object
|
|
26
|
+
* @param {AbortSignal} options.signal - An optional AbortSignal to cancel the throttled function.
|
|
27
|
+
* @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout.
|
|
28
|
+
* @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout.
|
|
29
|
+
* @returns {(...args: Parameters<F>) => void} A new throttled function that accepts the same parameters as the original function.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const throttledFunction = throttle(() => {
|
|
33
|
+
* console.log('Function executed');
|
|
34
|
+
* }, 1000);
|
|
35
|
+
*
|
|
36
|
+
* // Will log 'Function executed' immediately
|
|
37
|
+
* throttledFunction();
|
|
38
|
+
*
|
|
39
|
+
* // Will not log anything as it is within the throttle time
|
|
40
|
+
* throttledFunction();
|
|
41
|
+
*
|
|
42
|
+
* // After 1 second
|
|
43
|
+
* setTimeout(() => {
|
|
44
|
+
* throttledFunction(); // Will log 'Function executed'
|
|
45
|
+
* }, 1000);
|
|
46
|
+
*/
|
|
17
47
|
declare function throttle<F extends (...args: any[]) => any>(func: F, throttleMs?: number, options?: ThrottleOptions): ((...args: Parameters<F>) => ReturnType<F> | undefined) & {
|
|
18
48
|
cancel: () => void;
|
|
19
49
|
flush: () => void;
|
|
@@ -14,6 +14,36 @@ interface ThrottleOptions {
|
|
|
14
14
|
*/
|
|
15
15
|
trailing?: boolean;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates a throttled function that only invokes the provided function at most once
|
|
19
|
+
* per every `throttleMs` milliseconds. Subsequent calls to the throttled function
|
|
20
|
+
* within the wait time will not trigger the execution of the original function.
|
|
21
|
+
*
|
|
22
|
+
* @template F - The type of function.
|
|
23
|
+
* @param {F} func - The function to throttle.
|
|
24
|
+
* @param {number} throttleMs - The number of milliseconds to throttle executions to.
|
|
25
|
+
* @param {ThrottleOptions} options - The options object
|
|
26
|
+
* @param {AbortSignal} options.signal - An optional AbortSignal to cancel the throttled function.
|
|
27
|
+
* @param {boolean} options.leading - If `true`, the function will be invoked on the leading edge of the timeout.
|
|
28
|
+
* @param {boolean} options.trailing - If `true`, the function will be invoked on the trailing edge of the timeout.
|
|
29
|
+
* @returns {(...args: Parameters<F>) => void} A new throttled function that accepts the same parameters as the original function.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const throttledFunction = throttle(() => {
|
|
33
|
+
* console.log('Function executed');
|
|
34
|
+
* }, 1000);
|
|
35
|
+
*
|
|
36
|
+
* // Will log 'Function executed' immediately
|
|
37
|
+
* throttledFunction();
|
|
38
|
+
*
|
|
39
|
+
* // Will not log anything as it is within the throttle time
|
|
40
|
+
* throttledFunction();
|
|
41
|
+
*
|
|
42
|
+
* // After 1 second
|
|
43
|
+
* setTimeout(() => {
|
|
44
|
+
* throttledFunction(); // Will log 'Function executed'
|
|
45
|
+
* }, 1000);
|
|
46
|
+
*/
|
|
17
47
|
declare function throttle<F extends (...args: any[]) => any>(func: F, throttleMs?: number, options?: ThrottleOptions): ((...args: Parameters<F>) => ReturnType<F> | undefined) & {
|
|
18
48
|
cancel: () => void;
|
|
19
49
|
flush: () => void;
|
package/dist/compat/index.d.mts
CHANGED
|
@@ -75,7 +75,6 @@ export { cloneDeep } from '../object/cloneDeep.mjs';
|
|
|
75
75
|
export { toMerged } from '../object/toMerged.mjs';
|
|
76
76
|
export { isDate } from '../predicate/isDate.mjs';
|
|
77
77
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
78
|
-
export { isNaN } from '../predicate/isNaN.mjs';
|
|
79
78
|
export { isNil } from '../predicate/isNil.mjs';
|
|
80
79
|
export { isNotNil } from '../predicate/isNotNil.mjs';
|
|
81
80
|
export { isNull } from '../predicate/isNull.mjs';
|
|
@@ -83,11 +82,9 @@ export { isUndefined } from '../predicate/isUndefined.mjs';
|
|
|
83
82
|
export { isLength } from '../predicate/isLength.mjs';
|
|
84
83
|
export { isFunction } from '../predicate/isFunction.mjs';
|
|
85
84
|
export { isPrimitive } from '../predicate/isPrimitive.mjs';
|
|
86
|
-
export { isNumber } from '../predicate/isNumber.mjs';
|
|
87
85
|
export { delay } from '../promise/delay.mjs';
|
|
88
86
|
export { withTimeout } from '../promise/withTimeout.mjs';
|
|
89
87
|
export { timeout } from '../promise/timeout.mjs';
|
|
90
|
-
export { upperCase } from '../string/upperCase.mjs';
|
|
91
88
|
export { capitalize } from '../string/capitalize.mjs';
|
|
92
89
|
export { pascalCase } from '../string/pascalCase.mjs';
|
|
93
90
|
export { upperFirst } from '../string/upperFirst.mjs';
|
|
@@ -158,11 +155,14 @@ export { conforms } from './predicate/conforms.mjs';
|
|
|
158
155
|
export { conformsTo } from './predicate/conformsTo.mjs';
|
|
159
156
|
export { isInteger } from './predicate/isInteger.mjs';
|
|
160
157
|
export { isSafeInteger } from './predicate/isSafeInteger.mjs';
|
|
158
|
+
export { isNumber } from './predicate/isNumber.mjs';
|
|
159
|
+
export { isNaN } from './predicate/isNaN.mjs';
|
|
161
160
|
export { camelCase } from './string/camelCase.mjs';
|
|
162
161
|
export { kebabCase } from './string/kebabCase.mjs';
|
|
163
162
|
export { snakeCase } from './string/snakeCase.mjs';
|
|
164
163
|
export { startCase } from './string/startCase.mjs';
|
|
165
164
|
export { lowerCase } from './string/lowerCase.mjs';
|
|
165
|
+
export { upperCase } from './string/upperCase.mjs';
|
|
166
166
|
export { startsWith } from './string/startsWith.mjs';
|
|
167
167
|
export { endsWith } from './string/endsWith.mjs';
|
|
168
168
|
export { padStart } from './string/padStart.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -75,7 +75,6 @@ export { cloneDeep } from '../object/cloneDeep.js';
|
|
|
75
75
|
export { toMerged } from '../object/toMerged.js';
|
|
76
76
|
export { isDate } from '../predicate/isDate.js';
|
|
77
77
|
export { isEqual } from '../predicate/isEqual.js';
|
|
78
|
-
export { isNaN } from '../predicate/isNaN.js';
|
|
79
78
|
export { isNil } from '../predicate/isNil.js';
|
|
80
79
|
export { isNotNil } from '../predicate/isNotNil.js';
|
|
81
80
|
export { isNull } from '../predicate/isNull.js';
|
|
@@ -83,11 +82,9 @@ export { isUndefined } from '../predicate/isUndefined.js';
|
|
|
83
82
|
export { isLength } from '../predicate/isLength.js';
|
|
84
83
|
export { isFunction } from '../predicate/isFunction.js';
|
|
85
84
|
export { isPrimitive } from '../predicate/isPrimitive.js';
|
|
86
|
-
export { isNumber } from '../predicate/isNumber.js';
|
|
87
85
|
export { delay } from '../promise/delay.js';
|
|
88
86
|
export { withTimeout } from '../promise/withTimeout.js';
|
|
89
87
|
export { timeout } from '../promise/timeout.js';
|
|
90
|
-
export { upperCase } from '../string/upperCase.js';
|
|
91
88
|
export { capitalize } from '../string/capitalize.js';
|
|
92
89
|
export { pascalCase } from '../string/pascalCase.js';
|
|
93
90
|
export { upperFirst } from '../string/upperFirst.js';
|
|
@@ -158,11 +155,14 @@ export { conforms } from './predicate/conforms.js';
|
|
|
158
155
|
export { conformsTo } from './predicate/conformsTo.js';
|
|
159
156
|
export { isInteger } from './predicate/isInteger.js';
|
|
160
157
|
export { isSafeInteger } from './predicate/isSafeInteger.js';
|
|
158
|
+
export { isNumber } from './predicate/isNumber.js';
|
|
159
|
+
export { isNaN } from './predicate/isNaN.js';
|
|
161
160
|
export { camelCase } from './string/camelCase.js';
|
|
162
161
|
export { kebabCase } from './string/kebabCase.js';
|
|
163
162
|
export { snakeCase } from './string/snakeCase.js';
|
|
164
163
|
export { startCase } from './string/startCase.js';
|
|
165
164
|
export { lowerCase } from './string/lowerCase.js';
|
|
165
|
+
export { upperCase } from './string/upperCase.js';
|
|
166
166
|
export { startsWith } from './string/startsWith.js';
|
|
167
167
|
export { endsWith } from './string/endsWith.js';
|
|
168
168
|
export { padStart } from './string/padStart.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -8,7 +8,7 @@ const rest$1 = require('../_chunk/rest-pUyjvl.js');
|
|
|
8
8
|
const range = require('../_chunk/range-BXlMmn.js');
|
|
9
9
|
const randomInt = require('../_chunk/randomInt-CF7bZK.js');
|
|
10
10
|
const toMerged = require('../_chunk/toMerged-Bzkqyz.js');
|
|
11
|
-
const
|
|
11
|
+
const isWeakSet$1 = require('../_chunk/isWeakSet-E_VMwB.js');
|
|
12
12
|
const isPlainObject$1 = require('../_chunk/isPlainObject-BIekvL.js');
|
|
13
13
|
const string_index = require('../string/index.js');
|
|
14
14
|
|
|
@@ -287,14 +287,14 @@ function cloneDeep(obj) {
|
|
|
287
287
|
return toMerged.cloneDeep(obj);
|
|
288
288
|
}
|
|
289
289
|
switch (Object.prototype.toString.call(obj)) {
|
|
290
|
-
case
|
|
291
|
-
case
|
|
292
|
-
case
|
|
290
|
+
case isWeakSet$1.numberTag:
|
|
291
|
+
case isWeakSet$1.stringTag:
|
|
292
|
+
case isWeakSet$1.booleanTag: {
|
|
293
293
|
const result = new obj.constructor(obj?.valueOf());
|
|
294
294
|
toMerged.copyProperties(result, obj);
|
|
295
295
|
return result;
|
|
296
296
|
}
|
|
297
|
-
case
|
|
297
|
+
case isWeakSet$1.argumentsTag: {
|
|
298
298
|
const result = {};
|
|
299
299
|
toMerged.copyProperties(result, obj);
|
|
300
300
|
result.length = obj.length;
|
|
@@ -323,7 +323,7 @@ function isIndex(value) {
|
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
function isArguments(value) {
|
|
326
|
-
return value !== null && typeof value === 'object' &&
|
|
326
|
+
return value !== null && typeof value === 'object' && isWeakSet$1.getTag(value) === '[object Arguments]';
|
|
327
327
|
}
|
|
328
328
|
|
|
329
329
|
function has(object, path) {
|
|
@@ -438,30 +438,30 @@ function findIndex(source, doesMatch) {
|
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
|
|
441
|
-
function findLastIndex(
|
|
441
|
+
function findLastIndex(arr, doesMatch, fromIndex = arr.length - 1) {
|
|
442
442
|
if (fromIndex < 0) {
|
|
443
|
-
fromIndex = Math.max(
|
|
443
|
+
fromIndex = Math.max(arr.length + fromIndex, 0);
|
|
444
444
|
}
|
|
445
445
|
else {
|
|
446
|
-
fromIndex = Math.min(fromIndex,
|
|
446
|
+
fromIndex = Math.min(fromIndex, arr.length - 1);
|
|
447
447
|
}
|
|
448
|
-
|
|
448
|
+
arr = arr.slice(0, fromIndex + 1);
|
|
449
449
|
switch (typeof doesMatch) {
|
|
450
450
|
case 'function': {
|
|
451
|
-
return
|
|
451
|
+
return arr.findLastIndex(doesMatch);
|
|
452
452
|
}
|
|
453
453
|
case 'object': {
|
|
454
454
|
if (Array.isArray(doesMatch) && doesMatch.length === 2) {
|
|
455
455
|
const key = doesMatch[0];
|
|
456
456
|
const value = doesMatch[1];
|
|
457
|
-
return
|
|
457
|
+
return arr.findLastIndex(matchesProperty(key, value));
|
|
458
458
|
}
|
|
459
459
|
else {
|
|
460
|
-
return
|
|
460
|
+
return arr.findLastIndex(matches(doesMatch));
|
|
461
461
|
}
|
|
462
462
|
}
|
|
463
463
|
case 'string': {
|
|
464
|
-
return
|
|
464
|
+
return arr.findLastIndex(property(doesMatch));
|
|
465
465
|
}
|
|
466
466
|
}
|
|
467
467
|
}
|
|
@@ -651,7 +651,7 @@ function sortBy(collection, criteria) {
|
|
|
651
651
|
}
|
|
652
652
|
|
|
653
653
|
function size(target) {
|
|
654
|
-
if (
|
|
654
|
+
if (isWeakSet$1.isNil(target)) {
|
|
655
655
|
return 0;
|
|
656
656
|
}
|
|
657
657
|
if (target instanceof Map || target instanceof Set) {
|
|
@@ -1158,7 +1158,7 @@ function mergeWithDeep(target, source, merge, stack) {
|
|
|
1158
1158
|
source[i] = source[i] ?? undefined;
|
|
1159
1159
|
}
|
|
1160
1160
|
}
|
|
1161
|
-
const sourceKeys = [...Object.keys(source), ...
|
|
1161
|
+
const sourceKeys = [...Object.keys(source), ...isWeakSet$1.getSymbols(source)];
|
|
1162
1162
|
for (let i = 0; i < sourceKeys.length; i++) {
|
|
1163
1163
|
const key = sourceKeys[i];
|
|
1164
1164
|
let sourceValue = source[key];
|
|
@@ -1214,7 +1214,7 @@ function merge(object, ...sources) {
|
|
|
1214
1214
|
}
|
|
1215
1215
|
|
|
1216
1216
|
function isArrayLike(value) {
|
|
1217
|
-
return value != null && typeof value !== 'function' &&
|
|
1217
|
+
return value != null && typeof value !== 'function' && isWeakSet$1.isLength(value.length);
|
|
1218
1218
|
}
|
|
1219
1219
|
|
|
1220
1220
|
function fromPairs(pairs) {
|
|
@@ -1240,32 +1240,32 @@ function isBoolean(x) {
|
|
|
1240
1240
|
if (x === true || x === false) {
|
|
1241
1241
|
return true;
|
|
1242
1242
|
}
|
|
1243
|
-
if (typeof x === 'object' && x != null &&
|
|
1243
|
+
if (typeof x === 'object' && x != null && isWeakSet$1.getTag(x) === '[object Boolean]') {
|
|
1244
1244
|
return true;
|
|
1245
1245
|
}
|
|
1246
1246
|
return false;
|
|
1247
1247
|
}
|
|
1248
1248
|
|
|
1249
1249
|
function isRegExp(value) {
|
|
1250
|
-
return
|
|
1250
|
+
return isWeakSet$1.getTag(value) === '[object RegExp]';
|
|
1251
1251
|
}
|
|
1252
1252
|
|
|
1253
1253
|
function isString(value) {
|
|
1254
1254
|
if (typeof value === 'string') {
|
|
1255
1255
|
return true;
|
|
1256
1256
|
}
|
|
1257
|
-
if (typeof value === 'object' && value != null &&
|
|
1257
|
+
if (typeof value === 'object' && value != null && isWeakSet$1.getTag(value) === '[object String]') {
|
|
1258
1258
|
return true;
|
|
1259
1259
|
}
|
|
1260
1260
|
return false;
|
|
1261
1261
|
}
|
|
1262
1262
|
|
|
1263
1263
|
function isWeakMap(value) {
|
|
1264
|
-
return
|
|
1264
|
+
return isWeakSet$1.isWeakMap(value);
|
|
1265
1265
|
}
|
|
1266
1266
|
|
|
1267
1267
|
function isWeakSet(value) {
|
|
1268
|
-
return
|
|
1268
|
+
return isWeakSet$1.isWeakSet(value);
|
|
1269
1269
|
}
|
|
1270
1270
|
|
|
1271
1271
|
function conformsTo(target, source) {
|
|
@@ -1300,6 +1300,17 @@ function isSafeInteger(value) {
|
|
|
1300
1300
|
return Number.isSafeInteger(value);
|
|
1301
1301
|
}
|
|
1302
1302
|
|
|
1303
|
+
function isNumber(value) {
|
|
1304
|
+
if (typeof value === 'object' && value != null && isWeakSet$1.getTag(value) === '[object Number]') {
|
|
1305
|
+
return true;
|
|
1306
|
+
}
|
|
1307
|
+
return typeof value === 'number';
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
function isNaN(value) {
|
|
1311
|
+
return Number.isNaN(value);
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1303
1314
|
function toString(value) {
|
|
1304
1315
|
if (value == null) {
|
|
1305
1316
|
return '';
|
|
@@ -1341,6 +1352,10 @@ function lowerCase(str) {
|
|
|
1341
1352
|
return string_index.lowerCase(normalizeForCase(str));
|
|
1342
1353
|
}
|
|
1343
1354
|
|
|
1355
|
+
function upperCase(str) {
|
|
1356
|
+
return string_index.upperCase(normalizeForCase(str));
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1344
1359
|
function startsWith(str, target, position = 0) {
|
|
1345
1360
|
return str.startsWith(target, position);
|
|
1346
1361
|
}
|
|
@@ -1568,16 +1583,14 @@ exports.isObjectLike = toMerged.isObjectLike;
|
|
|
1568
1583
|
exports.omitBy = toMerged.omitBy;
|
|
1569
1584
|
exports.pickBy = toMerged.pickBy;
|
|
1570
1585
|
exports.toMerged = toMerged.toMerged;
|
|
1571
|
-
exports.isDate =
|
|
1572
|
-
exports.isEqual =
|
|
1573
|
-
exports.isFunction =
|
|
1574
|
-
exports.isLength =
|
|
1575
|
-
exports.
|
|
1576
|
-
exports.
|
|
1577
|
-
exports.
|
|
1578
|
-
exports.
|
|
1579
|
-
exports.isNumber = isNumber.isNumber;
|
|
1580
|
-
exports.isUndefined = isNumber.isUndefined;
|
|
1586
|
+
exports.isDate = isWeakSet$1.isDate;
|
|
1587
|
+
exports.isEqual = isWeakSet$1.isEqual;
|
|
1588
|
+
exports.isFunction = isWeakSet$1.isFunction;
|
|
1589
|
+
exports.isLength = isWeakSet$1.isLength;
|
|
1590
|
+
exports.isNil = isWeakSet$1.isNil;
|
|
1591
|
+
exports.isNotNil = isWeakSet$1.isNotNil;
|
|
1592
|
+
exports.isNull = isWeakSet$1.isNull;
|
|
1593
|
+
exports.isUndefined = isWeakSet$1.isUndefined;
|
|
1581
1594
|
exports.isPrimitive = isPlainObject$1.isPrimitive;
|
|
1582
1595
|
exports.capitalize = string_index.capitalize;
|
|
1583
1596
|
exports.deburr = string_index.deburr;
|
|
@@ -1587,7 +1600,6 @@ exports.lowerFirst = string_index.lowerFirst;
|
|
|
1587
1600
|
exports.pad = string_index.pad;
|
|
1588
1601
|
exports.pascalCase = string_index.pascalCase;
|
|
1589
1602
|
exports.unescape = string_index.unescape;
|
|
1590
|
-
exports.upperCase = string_index.upperCase;
|
|
1591
1603
|
exports.upperFirst = string_index.upperFirst;
|
|
1592
1604
|
exports.ary = ary;
|
|
1593
1605
|
exports.attempt = attempt;
|
|
@@ -1623,6 +1635,8 @@ exports.isArrayLike = isArrayLike;
|
|
|
1623
1635
|
exports.isBoolean = isBoolean;
|
|
1624
1636
|
exports.isInteger = isInteger;
|
|
1625
1637
|
exports.isMatch = isMatch;
|
|
1638
|
+
exports.isNaN = isNaN;
|
|
1639
|
+
exports.isNumber = isNumber;
|
|
1626
1640
|
exports.isObject = isObject;
|
|
1627
1641
|
exports.isPlainObject = isPlainObject;
|
|
1628
1642
|
exports.isRegExp = isRegExp;
|
|
@@ -1669,4 +1683,5 @@ exports.trim = trim;
|
|
|
1669
1683
|
exports.trimEnd = trimEnd;
|
|
1670
1684
|
exports.trimStart = trimStart;
|
|
1671
1685
|
exports.unset = unset;
|
|
1686
|
+
exports.upperCase = upperCase;
|
|
1672
1687
|
exports.zipObjectDeep = zipObjectDeep;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -76,7 +76,6 @@ export { isObjectLike } from './predicate/isObjectLike.mjs';
|
|
|
76
76
|
export { toMerged } from '../object/toMerged.mjs';
|
|
77
77
|
export { isDate } from '../predicate/isDate.mjs';
|
|
78
78
|
export { isEqual } from '../predicate/isEqual.mjs';
|
|
79
|
-
export { isNaN } from '../predicate/isNaN.mjs';
|
|
80
79
|
export { isNil } from '../predicate/isNil.mjs';
|
|
81
80
|
export { isNotNil } from '../predicate/isNotNil.mjs';
|
|
82
81
|
export { isNull } from '../predicate/isNull.mjs';
|
|
@@ -84,12 +83,10 @@ export { isUndefined } from '../predicate/isUndefined.mjs';
|
|
|
84
83
|
export { isLength } from '../predicate/isLength.mjs';
|
|
85
84
|
export { isFunction } from '../predicate/isFunction.mjs';
|
|
86
85
|
export { isPrimitive } from '../predicate/isPrimitive.mjs';
|
|
87
|
-
export { isNumber } from '../predicate/isNumber.mjs';
|
|
88
86
|
export { delay } from '../promise/delay.mjs';
|
|
89
87
|
export { withTimeout } from '../promise/withTimeout.mjs';
|
|
90
88
|
export { timeout } from '../promise/timeout.mjs';
|
|
91
89
|
export { capitalize } from '../string/capitalize.mjs';
|
|
92
|
-
export { upperCase } from '../string/upperCase.mjs';
|
|
93
90
|
export { pascalCase } from '../string/pascalCase.mjs';
|
|
94
91
|
export { upperFirst } from '../string/upperFirst.mjs';
|
|
95
92
|
export { lowerFirst } from '../string/lowerFirst.mjs';
|
|
@@ -158,11 +155,14 @@ export { conforms } from './predicate/conforms.mjs';
|
|
|
158
155
|
export { conformsTo } from './predicate/conformsTo.mjs';
|
|
159
156
|
export { isInteger } from './predicate/isInteger.mjs';
|
|
160
157
|
export { isSafeInteger } from './predicate/isSafeInteger.mjs';
|
|
158
|
+
export { isNumber } from './predicate/isNumber.mjs';
|
|
159
|
+
export { isNaN } from './predicate/isNaN.mjs';
|
|
161
160
|
export { camelCase } from './string/camelCase.mjs';
|
|
162
161
|
export { kebabCase } from './string/kebabCase.mjs';
|
|
163
162
|
export { snakeCase } from './string/snakeCase.mjs';
|
|
164
163
|
export { startCase } from './string/startCase.mjs';
|
|
165
164
|
export { lowerCase } from './string/lowerCase.mjs';
|
|
165
|
+
export { upperCase } from './string/upperCase.mjs';
|
|
166
166
|
export { startsWith } from './string/startsWith.mjs';
|
|
167
167
|
export { endsWith } from './string/endsWith.mjs';
|
|
168
168
|
export { padStart } from './string/padStart.mjs';
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
* const convertedStr3 = camelCase('hyphen-text') // returns 'hyphenText'
|
|
14
14
|
* const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest'
|
|
15
15
|
*/
|
|
16
|
-
declare function camelCase(str
|
|
16
|
+
declare function camelCase(str?: string | object): string;
|
|
17
17
|
|
|
18
18
|
export { camelCase };
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
* const convertedStr3 = camelCase('hyphen-text') // returns 'hyphenText'
|
|
14
14
|
* const convertedStr4 = camelCase('HTTPRequest') // returns 'httpRequest'
|
|
15
15
|
*/
|
|
16
|
-
declare function camelCase(str
|
|
16
|
+
declare function camelCase(str?: string | object): string;
|
|
17
17
|
|
|
18
18
|
export { camelCase };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character.
|
|
5
5
|
*
|
|
6
|
-
* @param {string} str - The string that is to be changed to kebab case.
|
|
6
|
+
* @param {string | object} str - The string that is to be changed to kebab case.
|
|
7
7
|
* @returns {string} - The converted string to kebab case.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
* const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text'
|
|
13
13
|
* const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request'
|
|
14
14
|
*/
|
|
15
|
-
declare function kebabCase(str
|
|
15
|
+
declare function kebabCase(str?: string | object): string;
|
|
16
16
|
|
|
17
17
|
export { kebabCase };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Kebab case is the naming convention in which each word is written in lowercase and separated by a dash (-) character.
|
|
5
5
|
*
|
|
6
|
-
* @param {string} str - The string that is to be changed to kebab case.
|
|
6
|
+
* @param {string | object} str - The string that is to be changed to kebab case.
|
|
7
7
|
* @returns {string} - The converted string to kebab case.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
* const convertedStr3 = kebabCase('hyphen-text') // returns 'hyphen-text'
|
|
13
13
|
* const convertedStr4 = kebabCase('HTTPRequest') // returns 'http-request'
|
|
14
14
|
*/
|
|
15
|
-
declare function kebabCase(str
|
|
15
|
+
declare function kebabCase(str?: string | object): string;
|
|
16
16
|
|
|
17
17
|
export { kebabCase };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character.
|
|
5
5
|
*
|
|
6
|
-
* @param {string} str - The string that is to be changed to lower case.
|
|
6
|
+
* @param {string | object} str - The string that is to be changed to lower case.
|
|
7
7
|
* @returns {string} - The converted string to lower case.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
* const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text'
|
|
13
13
|
* const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request'
|
|
14
14
|
*/
|
|
15
|
-
declare function lowerCase(str
|
|
15
|
+
declare function lowerCase(str?: string | object): string;
|
|
16
16
|
|
|
17
17
|
export { lowerCase };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Lower case is the naming convention in which each word is written in lowercase and separated by an space ( ) character.
|
|
5
5
|
*
|
|
6
|
-
* @param {string} str - The string that is to be changed to lower case.
|
|
6
|
+
* @param {string | object} str - The string that is to be changed to lower case.
|
|
7
7
|
* @returns {string} - The converted string to lower case.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
* const convertedStr3 = lowerCase('hyphen-text') // returns 'hyphen text'
|
|
13
13
|
* const convertedStr4 = lowerCase('HTTPRequest') // returns 'http request'
|
|
14
14
|
*/
|
|
15
|
-
declare function lowerCase(str
|
|
15
|
+
declare function lowerCase(str?: string | object): string;
|
|
16
16
|
|
|
17
17
|
export { lowerCase };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.
|
|
5
5
|
*
|
|
6
|
-
* @param {string} str - The string that is to be changed to snake case.
|
|
6
|
+
* @param {string | object} str - The string that is to be changed to snake case.
|
|
7
7
|
* @returns {string} - The converted string to snake case.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
* const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text'
|
|
13
13
|
* const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request'
|
|
14
14
|
*/
|
|
15
|
-
declare function snakeCase(str
|
|
15
|
+
declare function snakeCase(str?: string | object): string;
|
|
16
16
|
|
|
17
17
|
export { snakeCase };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Snake case is the naming convention in which each word is written in lowercase and separated by an underscore (_) character.
|
|
5
5
|
*
|
|
6
|
-
* @param {string} str - The string that is to be changed to snake case.
|
|
6
|
+
* @param {string | object} str - The string that is to be changed to snake case.
|
|
7
7
|
* @returns {string} - The converted string to snake case.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
* const convertedStr3 = snakeCase('hyphen-text') // returns 'hyphen_text'
|
|
13
13
|
* const convertedStr4 = snakeCase('HTTPRequest') // returns 'http_request'
|
|
14
14
|
*/
|
|
15
|
-
declare function snakeCase(str
|
|
15
|
+
declare function snakeCase(str?: string | object): string;
|
|
16
16
|
|
|
17
17
|
export { snakeCase };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Converts the first character of each word in a string to uppercase and the remaining characters to lowercase.
|
|
3
3
|
*
|
|
4
4
|
* Start case is the naming convention in which each word is written with an initial capital letter.
|
|
5
|
-
* @param {string} str - The string to convert.
|
|
5
|
+
* @param {string | object} str - The string to convert.
|
|
6
6
|
* @returns {string} The converted string.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
* const result3 = startCase('hello-world'); // result will be 'Hello World'
|
|
12
12
|
* const result4 = startCase('hello_world'); // result will be 'Hello World'
|
|
13
13
|
*/
|
|
14
|
-
declare function startCase(str
|
|
14
|
+
declare function startCase(str?: string | object): string;
|
|
15
15
|
|
|
16
16
|
export { startCase };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Converts the first character of each word in a string to uppercase and the remaining characters to lowercase.
|
|
3
3
|
*
|
|
4
4
|
* Start case is the naming convention in which each word is written with an initial capital letter.
|
|
5
|
-
* @param {string} str - The string to convert.
|
|
5
|
+
* @param {string | object} str - The string to convert.
|
|
6
6
|
* @returns {string} The converted string.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
@@ -11,6 +11,6 @@
|
|
|
11
11
|
* const result3 = startCase('hello-world'); // result will be 'Hello World'
|
|
12
12
|
* const result4 = startCase('hello_world'); // result will be 'Hello World'
|
|
13
13
|
*/
|
|
14
|
-
declare function startCase(str
|
|
14
|
+
declare function startCase(str?: string | object): string;
|
|
15
15
|
|
|
16
16
|
export { startCase };
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param {string} str - The string from which leading and trailing characters will be trimmed.
|
|
5
5
|
* @param {string | string[]} chars - The character(s) to remove from the end of the string. Defaults to `" "`.
|
|
6
|
-
* @param guard
|
|
7
6
|
* @returns {string} - The resulting string after the specified leading and trailing characters have been removed.
|
|
8
7
|
*
|
|
9
8
|
* @example
|