es-toolkit 1.18.0-dev.585 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunk/{isWeakSet-Dob5v4.js → isWeakSet-CogETi.js} +3 -3
- package/dist/_chunk/{toMerged-LBvzaK.js → toMerged-DN1PPP.js} +37 -28
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/_internal/toPath.mjs +10 -10
- package/dist/compat/index.d.mts +6 -13
- package/dist/compat/index.d.ts +6 -13
- package/dist/compat/index.js +30 -200
- package/dist/compat/index.mjs +6 -13
- package/dist/compat/predicate/isObject.d.mts +4 -4
- package/dist/compat/predicate/isObject.d.ts +4 -4
- package/dist/index.d.mts +0 -4
- package/dist/index.d.ts +0 -4
- package/dist/index.js +16 -21
- package/dist/index.mjs +0 -4
- package/dist/math/index.js +66 -8
- package/dist/object/clone.mjs +25 -28
- package/dist/object/index.js +2 -10
- package/dist/predicate/index.js +5 -5
- package/dist/predicate/isNotNil.mjs +1 -1
- package/dist/string/index.d.mts +0 -4
- package/dist/string/index.d.ts +0 -4
- package/dist/string/index.js +0 -65
- package/dist/string/index.mjs +0 -4
- package/dist/string/startCase.d.mts +1 -1
- package/dist/string/startCase.d.ts +1 -1
- package/package.json +1 -1
- package/dist/_chunk/range-BXlMmn.js +0 -68
- package/dist/compat/_internal/decimalAdjust.mjs +0 -19
- package/dist/compat/math/ceil.d.mts +0 -15
- package/dist/compat/math/ceil.d.ts +0 -15
- package/dist/compat/math/ceil.mjs +0 -7
- package/dist/compat/math/floor.d.mts +0 -15
- package/dist/compat/math/floor.d.ts +0 -15
- package/dist/compat/math/floor.mjs +0 -7
- package/dist/compat/math/round.d.mts +0 -15
- package/dist/compat/math/round.d.ts +0 -15
- package/dist/compat/math/round.mjs +0 -7
- package/dist/compat/object/pick.d.mts +0 -46
- package/dist/compat/object/pick.d.ts +0 -46
- package/dist/compat/object/pick.mjs +0 -38
- package/dist/compat/predicate/isNil.mjs +0 -5
- package/dist/compat/string/kebabCase.d.mts +0 -17
- package/dist/compat/string/kebabCase.d.ts +0 -17
- package/dist/compat/string/kebabCase.mjs +0 -9
- package/dist/compat/string/lowerCase.d.mts +0 -17
- package/dist/compat/string/lowerCase.d.ts +0 -17
- package/dist/compat/string/lowerCase.mjs +0 -8
- package/dist/compat/string/snakeCase.d.mts +0 -17
- package/dist/compat/string/snakeCase.d.ts +0 -17
- package/dist/compat/string/snakeCase.mjs +0 -8
- package/dist/compat/string/startCase.d.mts +0 -16
- package/dist/compat/string/startCase.d.ts +0 -16
- package/dist/compat/string/startCase.mjs +0 -8
- package/dist/compat/string/toString.d.mts +0 -19
- package/dist/compat/string/toString.d.ts +0 -19
- package/dist/compat/string/toString.mjs +0 -15
- package/dist/compat/string/trim.d.mts +0 -15
- package/dist/compat/string/trim.d.ts +0 -15
- package/dist/compat/string/trim.mjs +0 -25
- package/dist/compat/string/trimEnd.d.mts +0 -16
- package/dist/compat/string/trimEnd.d.ts +0 -16
- package/dist/compat/string/trimEnd.mjs +0 -25
- package/dist/compat/string/trimStart.d.mts +0 -16
- package/dist/compat/string/trimStart.d.ts +0 -16
- package/dist/compat/string/trimStart.mjs +0 -25
- package/dist/string/trim.d.mts +0 -15
- package/dist/string/trim.d.ts +0 -15
- package/dist/string/trim.mjs +0 -11
- package/dist/string/trimEnd.d.mts +0 -16
- package/dist/string/trimEnd.d.ts +0 -16
- package/dist/string/trimEnd.mjs +0 -22
- package/dist/string/trimStart.d.mts +0 -16
- package/dist/string/trimStart.d.ts +0 -16
- package/dist/string/trimStart.mjs +0 -22
- package/dist/string/upperCase.d.mts +0 -17
- package/dist/string/upperCase.d.ts +0 -17
- package/dist/string/upperCase.mjs +0 -15
- package/dist/_chunk/{isPlainObject-BIekvL.js → isTypedArray-Dsrnb1.js} +8 -8
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const ESCAPE_REGEXP = /\\(\\)?/g;
|
|
2
|
-
const PROPERTY_REGEXP = RegExp('[^.[\\]]+' +
|
|
3
|
-
'|' +
|
|
4
|
-
'\\[(?:' +
|
|
5
|
-
'([^"\'][^[]*)' +
|
|
6
|
-
'|' +
|
|
7
|
-
'(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2' +
|
|
8
|
-
')\\]' +
|
|
9
|
-
'|' +
|
|
10
|
-
'(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g');
|
|
11
1
|
function toPath(deepKey) {
|
|
2
|
+
const ESCAPE_REGEXP = /\\(\\)?/g;
|
|
3
|
+
const PROPERTY_REGEXP = RegExp('[^.[\\]]+' +
|
|
4
|
+
'|' +
|
|
5
|
+
'\\[(?:' +
|
|
6
|
+
'([^"\'][^[]*)' +
|
|
7
|
+
'|' +
|
|
8
|
+
'(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2' +
|
|
9
|
+
')\\]' +
|
|
10
|
+
'|' +
|
|
11
|
+
'(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g');
|
|
12
12
|
const result = [];
|
|
13
13
|
if (deepKey[0] === '.') {
|
|
14
14
|
result.push('');
|
package/dist/compat/index.d.mts
CHANGED
|
@@ -66,11 +66,13 @@ export { mean } from '../math/mean.mjs';
|
|
|
66
66
|
export { meanBy } from '../math/meanBy.mjs';
|
|
67
67
|
export { random } from '../math/random.mjs';
|
|
68
68
|
export { randomInt } from '../math/randomInt.mjs';
|
|
69
|
+
export { round } from '../math/round.mjs';
|
|
69
70
|
export { sum } from '../math/sum.mjs';
|
|
70
71
|
export { sumBy } from '../math/sumBy.mjs';
|
|
71
72
|
export { range } from '../math/range.mjs';
|
|
72
73
|
export { omit } from '../object/omit.mjs';
|
|
73
74
|
export { omitBy } from '../object/omitBy.mjs';
|
|
75
|
+
export { pick } from '../object/pick.mjs';
|
|
74
76
|
export { pickBy } from '../object/pickBy.mjs';
|
|
75
77
|
export { invert } from '../object/invert.mjs';
|
|
76
78
|
export { clone } from '../object/clone.mjs';
|
|
@@ -88,7 +90,10 @@ export { isPrimitive } from '../predicate/isPrimitive.mjs';
|
|
|
88
90
|
export { delay } from '../promise/delay.mjs';
|
|
89
91
|
export { withTimeout } from '../promise/withTimeout.mjs';
|
|
90
92
|
export { timeout } from '../promise/timeout.mjs';
|
|
91
|
-
export {
|
|
93
|
+
export { snakeCase } from '../string/snakeCase.mjs';
|
|
94
|
+
export { kebabCase } from '../string/kebabCase.mjs';
|
|
95
|
+
export { lowerCase } from '../string/lowerCase.mjs';
|
|
96
|
+
export { startCase } from '../string/startCase.mjs';
|
|
92
97
|
export { capitalize } from '../string/capitalize.mjs';
|
|
93
98
|
export { pascalCase } from '../string/pascalCase.mjs';
|
|
94
99
|
export { upperFirst } from '../string/upperFirst.mjs';
|
|
@@ -125,7 +130,6 @@ export { attempt } from './function/attempt.mjs';
|
|
|
125
130
|
export { rearg } from './function/rearg.mjs';
|
|
126
131
|
export { get } from './object/get.mjs';
|
|
127
132
|
export { set } from './object/set.mjs';
|
|
128
|
-
export { pick } from './object/pick.mjs';
|
|
129
133
|
export { has } from './object/has.mjs';
|
|
130
134
|
export { property } from './object/property.mjs';
|
|
131
135
|
export { mapKeys } from './object/mapKeys.mjs';
|
|
@@ -152,22 +156,11 @@ export { isWeakSet } from './predicate/isWeakSet.mjs';
|
|
|
152
156
|
export { conforms } from './predicate/conforms.mjs';
|
|
153
157
|
export { conformsTo } from './predicate/conformsTo.mjs';
|
|
154
158
|
export { camelCase } from './string/camelCase.mjs';
|
|
155
|
-
export { kebabCase } from './string/kebabCase.mjs';
|
|
156
|
-
export { snakeCase } from './string/snakeCase.mjs';
|
|
157
|
-
export { startCase } from './string/startCase.mjs';
|
|
158
|
-
export { lowerCase } from './string/lowerCase.mjs';
|
|
159
159
|
export { startsWith } from './string/startsWith.mjs';
|
|
160
160
|
export { endsWith } from './string/endsWith.mjs';
|
|
161
161
|
export { padStart } from './string/padStart.mjs';
|
|
162
162
|
export { padEnd } from './string/padEnd.mjs';
|
|
163
163
|
export { repeat } from './string/repeat.mjs';
|
|
164
|
-
export { toString } from './string/toString.mjs';
|
|
165
|
-
export { trim } from './string/trim.mjs';
|
|
166
|
-
export { trimStart } from './string/trimStart.mjs';
|
|
167
|
-
export { trimEnd } from './string/trimEnd.mjs';
|
|
168
164
|
export { max } from './math/max.mjs';
|
|
169
165
|
export { min } from './math/min.mjs';
|
|
170
|
-
export { ceil } from './math/ceil.mjs';
|
|
171
|
-
export { floor } from './math/floor.mjs';
|
|
172
|
-
export { round } from './math/round.mjs';
|
|
173
166
|
export { parseInt } from './math/parseInt.mjs';
|
package/dist/compat/index.d.ts
CHANGED
|
@@ -66,11 +66,13 @@ export { mean } from '../math/mean.js';
|
|
|
66
66
|
export { meanBy } from '../math/meanBy.js';
|
|
67
67
|
export { random } from '../math/random.js';
|
|
68
68
|
export { randomInt } from '../math/randomInt.js';
|
|
69
|
+
export { round } from '../math/round.js';
|
|
69
70
|
export { sum } from '../math/sum.js';
|
|
70
71
|
export { sumBy } from '../math/sumBy.js';
|
|
71
72
|
export { range } from '../math/range.js';
|
|
72
73
|
export { omit } from '../object/omit.js';
|
|
73
74
|
export { omitBy } from '../object/omitBy.js';
|
|
75
|
+
export { pick } from '../object/pick.js';
|
|
74
76
|
export { pickBy } from '../object/pickBy.js';
|
|
75
77
|
export { invert } from '../object/invert.js';
|
|
76
78
|
export { clone } from '../object/clone.js';
|
|
@@ -88,7 +90,10 @@ export { isPrimitive } from '../predicate/isPrimitive.js';
|
|
|
88
90
|
export { delay } from '../promise/delay.js';
|
|
89
91
|
export { withTimeout } from '../promise/withTimeout.js';
|
|
90
92
|
export { timeout } from '../promise/timeout.js';
|
|
91
|
-
export {
|
|
93
|
+
export { snakeCase } from '../string/snakeCase.js';
|
|
94
|
+
export { kebabCase } from '../string/kebabCase.js';
|
|
95
|
+
export { lowerCase } from '../string/lowerCase.js';
|
|
96
|
+
export { startCase } from '../string/startCase.js';
|
|
92
97
|
export { capitalize } from '../string/capitalize.js';
|
|
93
98
|
export { pascalCase } from '../string/pascalCase.js';
|
|
94
99
|
export { upperFirst } from '../string/upperFirst.js';
|
|
@@ -125,7 +130,6 @@ export { attempt } from './function/attempt.js';
|
|
|
125
130
|
export { rearg } from './function/rearg.js';
|
|
126
131
|
export { get } from './object/get.js';
|
|
127
132
|
export { set } from './object/set.js';
|
|
128
|
-
export { pick } from './object/pick.js';
|
|
129
133
|
export { has } from './object/has.js';
|
|
130
134
|
export { property } from './object/property.js';
|
|
131
135
|
export { mapKeys } from './object/mapKeys.js';
|
|
@@ -152,22 +156,11 @@ export { isWeakSet } from './predicate/isWeakSet.js';
|
|
|
152
156
|
export { conforms } from './predicate/conforms.js';
|
|
153
157
|
export { conformsTo } from './predicate/conformsTo.js';
|
|
154
158
|
export { camelCase } from './string/camelCase.js';
|
|
155
|
-
export { kebabCase } from './string/kebabCase.js';
|
|
156
|
-
export { snakeCase } from './string/snakeCase.js';
|
|
157
|
-
export { startCase } from './string/startCase.js';
|
|
158
|
-
export { lowerCase } from './string/lowerCase.js';
|
|
159
159
|
export { startsWith } from './string/startsWith.js';
|
|
160
160
|
export { endsWith } from './string/endsWith.js';
|
|
161
161
|
export { padStart } from './string/padStart.js';
|
|
162
162
|
export { padEnd } from './string/padEnd.js';
|
|
163
163
|
export { repeat } from './string/repeat.js';
|
|
164
|
-
export { toString } from './string/toString.js';
|
|
165
|
-
export { trim } from './string/trim.js';
|
|
166
|
-
export { trimStart } from './string/trimStart.js';
|
|
167
|
-
export { trimEnd } from './string/trimEnd.js';
|
|
168
164
|
export { max } from './math/max.js';
|
|
169
165
|
export { min } from './math/min.js';
|
|
170
|
-
export { ceil } from './math/ceil.js';
|
|
171
|
-
export { floor } from './math/floor.js';
|
|
172
|
-
export { round } from './math/round.js';
|
|
173
166
|
export { parseInt } from './math/parseInt.js';
|
package/dist/compat/index.js
CHANGED
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
const zipWith = require('../_chunk/zipWith-CYaH1Y.js');
|
|
6
6
|
const promise_index = require('../_chunk/index-BGZDR9.js');
|
|
7
7
|
const rest$1 = require('../_chunk/rest-CXt9w3.js');
|
|
8
|
-
const
|
|
8
|
+
const math_index = require('../math/index.js');
|
|
9
9
|
const randomInt = require('../_chunk/randomInt-CF7bZK.js');
|
|
10
|
-
const toMerged = require('../_chunk/toMerged-
|
|
11
|
-
const isWeakSet$1 = require('../_chunk/isWeakSet-
|
|
12
|
-
const
|
|
10
|
+
const toMerged = require('../_chunk/toMerged-DN1PPP.js');
|
|
11
|
+
const isWeakSet$1 = require('../_chunk/isWeakSet-CogETi.js');
|
|
12
|
+
const isTypedArray$1 = require('../_chunk/isTypedArray-Dsrnb1.js');
|
|
13
13
|
const string_index = require('../string/index.js');
|
|
14
14
|
|
|
15
15
|
function castArray(value) {
|
|
@@ -77,17 +77,17 @@ function toKey(value) {
|
|
|
77
77
|
return `${value}`;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
const ESCAPE_REGEXP = /\\(\\)?/g;
|
|
81
|
-
const PROPERTY_REGEXP = RegExp('[^.[\\]]+' +
|
|
82
|
-
'|' +
|
|
83
|
-
'\\[(?:' +
|
|
84
|
-
'([^"\'][^[]*)' +
|
|
85
|
-
'|' +
|
|
86
|
-
'(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2' +
|
|
87
|
-
')\\]' +
|
|
88
|
-
'|' +
|
|
89
|
-
'(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g');
|
|
90
80
|
function toPath(deepKey) {
|
|
81
|
+
const ESCAPE_REGEXP = /\\(\\)?/g;
|
|
82
|
+
const PROPERTY_REGEXP = RegExp('[^.[\\]]+' +
|
|
83
|
+
'|' +
|
|
84
|
+
'\\[(?:' +
|
|
85
|
+
'([^"\'][^[]*)' +
|
|
86
|
+
'|' +
|
|
87
|
+
'(["\'])((?:(?!\\2)[^\\\\]|\\\\.)*?)\\2' +
|
|
88
|
+
')\\]' +
|
|
89
|
+
'|' +
|
|
90
|
+
'(?=(?:\\.|\\[\\])(?:\\.|\\[\\]|$))', 'g');
|
|
91
91
|
const result = [];
|
|
92
92
|
if (deepKey[0] === '.') {
|
|
93
93
|
result.push('');
|
|
@@ -221,7 +221,7 @@ function isMatch(target, source) {
|
|
|
221
221
|
}
|
|
222
222
|
for (let i = 0; i < keys.length; i++) {
|
|
223
223
|
const key = keys[i];
|
|
224
|
-
if (!
|
|
224
|
+
if (!isTypedArray$1.isPrimitive(target) && !(key in target)) {
|
|
225
225
|
return false;
|
|
226
226
|
}
|
|
227
227
|
if (source[key] === undefined && target[key] !== undefined) {
|
|
@@ -782,43 +782,6 @@ function rearg(func, ...indices) {
|
|
|
782
782
|
};
|
|
783
783
|
}
|
|
784
784
|
|
|
785
|
-
function isNil(x) {
|
|
786
|
-
return x == null;
|
|
787
|
-
}
|
|
788
|
-
|
|
789
|
-
function pick(obj, ...keysArr) {
|
|
790
|
-
if (isNil(obj)) {
|
|
791
|
-
return {};
|
|
792
|
-
}
|
|
793
|
-
const result = {};
|
|
794
|
-
for (let keys of keysArr) {
|
|
795
|
-
switch (typeof keys) {
|
|
796
|
-
case 'object': {
|
|
797
|
-
if (!Array.isArray(keys)) {
|
|
798
|
-
keys = Array.from(keys);
|
|
799
|
-
}
|
|
800
|
-
break;
|
|
801
|
-
}
|
|
802
|
-
case 'string':
|
|
803
|
-
case 'symbol':
|
|
804
|
-
case 'number': {
|
|
805
|
-
keys = [keys];
|
|
806
|
-
break;
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
for (const key of keys) {
|
|
810
|
-
const value = get(obj, key);
|
|
811
|
-
if (typeof key === 'string' && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
812
|
-
result[key] = value;
|
|
813
|
-
}
|
|
814
|
-
else {
|
|
815
|
-
set(result, key, value);
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
return result;
|
|
820
|
-
}
|
|
821
|
-
|
|
822
785
|
function mapKeys(object, getNewKey) {
|
|
823
786
|
getNewKey = getNewKey ?? identity;
|
|
824
787
|
switch (typeof getNewKey) {
|
|
@@ -878,7 +841,7 @@ function isPlainObject(object) {
|
|
|
878
841
|
}
|
|
879
842
|
|
|
880
843
|
function isTypedArray(x) {
|
|
881
|
-
return
|
|
844
|
+
return isTypedArray$1.isTypedArray(x);
|
|
882
845
|
}
|
|
883
846
|
|
|
884
847
|
function mergeWith(object, ...otherArgs) {
|
|
@@ -1040,22 +1003,6 @@ function camelCase(str) {
|
|
|
1040
1003
|
return string_index.camelCase(normalizeForCase(str));
|
|
1041
1004
|
}
|
|
1042
1005
|
|
|
1043
|
-
function kebabCase(str) {
|
|
1044
|
-
return string_index.kebabCase(normalizeForCase(str));
|
|
1045
|
-
}
|
|
1046
|
-
|
|
1047
|
-
function snakeCase(str) {
|
|
1048
|
-
return string_index.snakeCase(normalizeForCase(str));
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
function startCase(str) {
|
|
1052
|
-
return string_index.startCase(normalizeForCase(str));
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
function lowerCase(str) {
|
|
1056
|
-
return string_index.lowerCase(normalizeForCase(str));
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
1006
|
function startsWith(str, target, position = 0) {
|
|
1060
1007
|
return str.startsWith(target, position);
|
|
1061
1008
|
}
|
|
@@ -1076,86 +1023,6 @@ function repeat(str, n) {
|
|
|
1076
1023
|
return str.repeat(n);
|
|
1077
1024
|
}
|
|
1078
1025
|
|
|
1079
|
-
function toString(value) {
|
|
1080
|
-
if (value == null) {
|
|
1081
|
-
return '';
|
|
1082
|
-
}
|
|
1083
|
-
if (Array.isArray(value)) {
|
|
1084
|
-
return value.map(toString).join(',');
|
|
1085
|
-
}
|
|
1086
|
-
const result = String(value);
|
|
1087
|
-
if (result === '0' && Object.is(Number(value), -0)) {
|
|
1088
|
-
return '-0';
|
|
1089
|
-
}
|
|
1090
|
-
return result;
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1093
|
-
function trim(str, chars, guard) {
|
|
1094
|
-
if (str == null) {
|
|
1095
|
-
return '';
|
|
1096
|
-
}
|
|
1097
|
-
if (guard != null || chars == null) {
|
|
1098
|
-
return str.toString().trim();
|
|
1099
|
-
}
|
|
1100
|
-
switch (typeof chars) {
|
|
1101
|
-
case 'string': {
|
|
1102
|
-
return string_index.trim(str, chars.toString().split(''));
|
|
1103
|
-
}
|
|
1104
|
-
case 'object': {
|
|
1105
|
-
if (Array.isArray(chars)) {
|
|
1106
|
-
return string_index.trim(str, chars.map(x => x.toString()));
|
|
1107
|
-
}
|
|
1108
|
-
else {
|
|
1109
|
-
return string_index.trim(str, chars.toString().split(''));
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
function trimStart(str, chars, guard) {
|
|
1116
|
-
if (str == null) {
|
|
1117
|
-
return '';
|
|
1118
|
-
}
|
|
1119
|
-
if (guard != null || chars == null) {
|
|
1120
|
-
return str.toString().trimStart();
|
|
1121
|
-
}
|
|
1122
|
-
switch (typeof chars) {
|
|
1123
|
-
case 'string': {
|
|
1124
|
-
return string_index.trimStart(str, chars.toString().split(''));
|
|
1125
|
-
}
|
|
1126
|
-
case 'object': {
|
|
1127
|
-
if (Array.isArray(chars)) {
|
|
1128
|
-
return string_index.trimStart(str, chars.map(x => x.toString()));
|
|
1129
|
-
}
|
|
1130
|
-
else {
|
|
1131
|
-
return string_index.trimStart(str, chars.toString().split(''));
|
|
1132
|
-
}
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
function trimEnd(str, chars, guard) {
|
|
1138
|
-
if (str == null) {
|
|
1139
|
-
return '';
|
|
1140
|
-
}
|
|
1141
|
-
if (guard != null || chars == null) {
|
|
1142
|
-
return str.toString().trimEnd();
|
|
1143
|
-
}
|
|
1144
|
-
switch (typeof chars) {
|
|
1145
|
-
case 'string': {
|
|
1146
|
-
return string_index.trimEnd(str, chars.toString().split(''));
|
|
1147
|
-
}
|
|
1148
|
-
case 'object': {
|
|
1149
|
-
if (Array.isArray(chars)) {
|
|
1150
|
-
return string_index.trimEnd(str, chars.map(x => x.toString()));
|
|
1151
|
-
}
|
|
1152
|
-
else {
|
|
1153
|
-
return string_index.trimEnd(str, chars.toString().split(''));
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
1026
|
function max(items = []) {
|
|
1160
1027
|
let maxElement = items[0];
|
|
1161
1028
|
let max = undefined;
|
|
@@ -1180,36 +1047,6 @@ function min(items = []) {
|
|
|
1180
1047
|
return minElement;
|
|
1181
1048
|
}
|
|
1182
1049
|
|
|
1183
|
-
function decimalAdjust(type, number, precision = 0) {
|
|
1184
|
-
number = Number(number);
|
|
1185
|
-
if (Object.is(number, -0)) {
|
|
1186
|
-
number = '-0';
|
|
1187
|
-
}
|
|
1188
|
-
precision = Math.min(Number.parseInt(precision, 10), 292);
|
|
1189
|
-
if (precision) {
|
|
1190
|
-
const [magnitude, exponent = 0] = number.toString().split('e');
|
|
1191
|
-
let adjustedValue = Math[type](Number(`${magnitude}e${Number(exponent) + precision}`));
|
|
1192
|
-
if (Object.is(adjustedValue, -0)) {
|
|
1193
|
-
adjustedValue = '-0';
|
|
1194
|
-
}
|
|
1195
|
-
const [newMagnitude, newExponent = 0] = adjustedValue.toString().split('e');
|
|
1196
|
-
return Number(`${newMagnitude}e${Number(newExponent) - precision}`);
|
|
1197
|
-
}
|
|
1198
|
-
return Math[type](Number(number));
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
function ceil(number, precision = 0) {
|
|
1202
|
-
return decimalAdjust('ceil', number, precision);
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
function floor(number, precision = 0) {
|
|
1206
|
-
return decimalAdjust('floor', number, precision);
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
function round(number, precision = 0) {
|
|
1210
|
-
return decimalAdjust('round', number, precision);
|
|
1211
|
-
}
|
|
1212
|
-
|
|
1213
1050
|
function parseInt(string, radix = 0, guard) {
|
|
1214
1051
|
if (guard) {
|
|
1215
1052
|
radix = 0;
|
|
@@ -1283,13 +1120,14 @@ exports.partial = rest$1.partial;
|
|
|
1283
1120
|
exports.partialRight = rest$1.partialRight;
|
|
1284
1121
|
exports.throttle = rest$1.throttle;
|
|
1285
1122
|
exports.unary = rest$1.unary;
|
|
1286
|
-
exports.clamp =
|
|
1287
|
-
exports.inRange =
|
|
1288
|
-
exports.mean =
|
|
1289
|
-
exports.meanBy =
|
|
1290
|
-
exports.range =
|
|
1291
|
-
exports.
|
|
1292
|
-
exports.
|
|
1123
|
+
exports.clamp = math_index.clamp;
|
|
1124
|
+
exports.inRange = math_index.inRange;
|
|
1125
|
+
exports.mean = math_index.mean;
|
|
1126
|
+
exports.meanBy = math_index.meanBy;
|
|
1127
|
+
exports.range = math_index.range;
|
|
1128
|
+
exports.round = math_index.round;
|
|
1129
|
+
exports.sum = math_index.sum;
|
|
1130
|
+
exports.sumBy = math_index.sumBy;
|
|
1293
1131
|
exports.random = randomInt.random;
|
|
1294
1132
|
exports.randomInt = randomInt.randomInt;
|
|
1295
1133
|
exports.clone = toMerged.clone;
|
|
@@ -1299,6 +1137,7 @@ exports.invert = toMerged.invert;
|
|
|
1299
1137
|
exports.isObjectLike = toMerged.isObjectLike;
|
|
1300
1138
|
exports.omit = toMerged.omit;
|
|
1301
1139
|
exports.omitBy = toMerged.omitBy;
|
|
1140
|
+
exports.pick = toMerged.pick;
|
|
1302
1141
|
exports.pickBy = toMerged.pickBy;
|
|
1303
1142
|
exports.toMerged = toMerged.toMerged;
|
|
1304
1143
|
exports.isEqual = isWeakSet$1.isEqual;
|
|
@@ -1308,16 +1147,19 @@ exports.isNil = isWeakSet$1.isNil;
|
|
|
1308
1147
|
exports.isNotNil = isWeakSet$1.isNotNil;
|
|
1309
1148
|
exports.isNull = isWeakSet$1.isNull;
|
|
1310
1149
|
exports.isUndefined = isWeakSet$1.isUndefined;
|
|
1311
|
-
exports.isPrimitive =
|
|
1150
|
+
exports.isPrimitive = isTypedArray$1.isPrimitive;
|
|
1312
1151
|
exports.capitalize = string_index.capitalize;
|
|
1313
1152
|
exports.deburr = string_index.deburr;
|
|
1314
1153
|
exports.escape = string_index.escape;
|
|
1315
1154
|
exports.escapeRegExp = string_index.escapeRegExp;
|
|
1155
|
+
exports.kebabCase = string_index.kebabCase;
|
|
1156
|
+
exports.lowerCase = string_index.lowerCase;
|
|
1316
1157
|
exports.lowerFirst = string_index.lowerFirst;
|
|
1317
1158
|
exports.pad = string_index.pad;
|
|
1318
1159
|
exports.pascalCase = string_index.pascalCase;
|
|
1160
|
+
exports.snakeCase = string_index.snakeCase;
|
|
1161
|
+
exports.startCase = string_index.startCase;
|
|
1319
1162
|
exports.unescape = string_index.unescape;
|
|
1320
|
-
exports.upperCase = string_index.upperCase;
|
|
1321
1163
|
exports.upperFirst = string_index.upperFirst;
|
|
1322
1164
|
exports.ary = ary;
|
|
1323
1165
|
exports.attempt = attempt;
|
|
@@ -1325,7 +1167,6 @@ exports.bind = bind;
|
|
|
1325
1167
|
exports.bindKey = bindKey;
|
|
1326
1168
|
exports.camelCase = camelCase;
|
|
1327
1169
|
exports.castArray = castArray;
|
|
1328
|
-
exports.ceil = ceil;
|
|
1329
1170
|
exports.chunk = chunk;
|
|
1330
1171
|
exports.concat = concat;
|
|
1331
1172
|
exports.conforms = conforms;
|
|
@@ -1339,7 +1180,6 @@ exports.findLastIndex = findLastIndex;
|
|
|
1339
1180
|
exports.flatten = flatten;
|
|
1340
1181
|
exports.flattenDeep = flattenDeep;
|
|
1341
1182
|
exports.flattenDepth = flattenDepth;
|
|
1342
|
-
exports.floor = floor;
|
|
1343
1183
|
exports.fromPairs = fromPairs;
|
|
1344
1184
|
exports.get = get;
|
|
1345
1185
|
exports.has = has;
|
|
@@ -1358,8 +1198,6 @@ exports.isTypedArray = isTypedArray;
|
|
|
1358
1198
|
exports.isWeakMap = isWeakMap;
|
|
1359
1199
|
exports.isWeakSet = isWeakSet;
|
|
1360
1200
|
exports.join = join;
|
|
1361
|
-
exports.kebabCase = kebabCase;
|
|
1362
|
-
exports.lowerCase = lowerCase;
|
|
1363
1201
|
exports.mapKeys = mapKeys;
|
|
1364
1202
|
exports.mapValues = mapValues;
|
|
1365
1203
|
exports.matches = matches;
|
|
@@ -1372,22 +1210,14 @@ exports.orderBy = orderBy;
|
|
|
1372
1210
|
exports.padEnd = padEnd;
|
|
1373
1211
|
exports.padStart = padStart;
|
|
1374
1212
|
exports.parseInt = parseInt;
|
|
1375
|
-
exports.pick = pick;
|
|
1376
1213
|
exports.property = property;
|
|
1377
1214
|
exports.rearg = rearg;
|
|
1378
1215
|
exports.repeat = repeat;
|
|
1379
1216
|
exports.rest = rest;
|
|
1380
|
-
exports.round = round;
|
|
1381
1217
|
exports.set = set;
|
|
1382
1218
|
exports.size = size;
|
|
1383
|
-
exports.snakeCase = snakeCase;
|
|
1384
1219
|
exports.some = some;
|
|
1385
1220
|
exports.sortBy = sortBy;
|
|
1386
1221
|
exports.spread = spread;
|
|
1387
|
-
exports.startCase = startCase;
|
|
1388
1222
|
exports.startsWith = startsWith;
|
|
1389
|
-
exports.toString = toString;
|
|
1390
|
-
exports.trim = trim;
|
|
1391
|
-
exports.trimEnd = trimEnd;
|
|
1392
|
-
exports.trimStart = trimStart;
|
|
1393
1223
|
exports.zipObjectDeep = zipObjectDeep;
|
package/dist/compat/index.mjs
CHANGED
|
@@ -66,11 +66,13 @@ export { mean } from '../math/mean.mjs';
|
|
|
66
66
|
export { meanBy } from '../math/meanBy.mjs';
|
|
67
67
|
export { random } from '../math/random.mjs';
|
|
68
68
|
export { randomInt } from '../math/randomInt.mjs';
|
|
69
|
+
export { round } from '../math/round.mjs';
|
|
69
70
|
export { sum } from '../math/sum.mjs';
|
|
70
71
|
export { sumBy } from '../math/sumBy.mjs';
|
|
71
72
|
export { range } from '../math/range.mjs';
|
|
72
73
|
export { omit } from '../object/omit.mjs';
|
|
73
74
|
export { omitBy } from '../object/omitBy.mjs';
|
|
75
|
+
export { pick } from '../object/pick.mjs';
|
|
74
76
|
export { pickBy } from '../object/pickBy.mjs';
|
|
75
77
|
export { invert } from '../object/invert.mjs';
|
|
76
78
|
export { clone } from '../object/clone.mjs';
|
|
@@ -90,7 +92,10 @@ export { delay } from '../promise/delay.mjs';
|
|
|
90
92
|
export { withTimeout } from '../promise/withTimeout.mjs';
|
|
91
93
|
export { timeout } from '../promise/timeout.mjs';
|
|
92
94
|
export { capitalize } from '../string/capitalize.mjs';
|
|
93
|
-
export {
|
|
95
|
+
export { snakeCase } from '../string/snakeCase.mjs';
|
|
96
|
+
export { kebabCase } from '../string/kebabCase.mjs';
|
|
97
|
+
export { lowerCase } from '../string/lowerCase.mjs';
|
|
98
|
+
export { startCase } from '../string/startCase.mjs';
|
|
94
99
|
export { pascalCase } from '../string/pascalCase.mjs';
|
|
95
100
|
export { upperFirst } from '../string/upperFirst.mjs';
|
|
96
101
|
export { lowerFirst } from '../string/lowerFirst.mjs';
|
|
@@ -126,7 +131,6 @@ export { attempt } from './function/attempt.mjs';
|
|
|
126
131
|
export { rearg } from './function/rearg.mjs';
|
|
127
132
|
export { get } from './object/get.mjs';
|
|
128
133
|
export { set } from './object/set.mjs';
|
|
129
|
-
export { pick } from './object/pick.mjs';
|
|
130
134
|
export { has } from './object/has.mjs';
|
|
131
135
|
export { property } from './object/property.mjs';
|
|
132
136
|
export { mapKeys } from './object/mapKeys.mjs';
|
|
@@ -152,22 +156,11 @@ export { isWeakSet } from './predicate/isWeakSet.mjs';
|
|
|
152
156
|
export { conforms } from './predicate/conforms.mjs';
|
|
153
157
|
export { conformsTo } from './predicate/conformsTo.mjs';
|
|
154
158
|
export { camelCase } from './string/camelCase.mjs';
|
|
155
|
-
export { kebabCase } from './string/kebabCase.mjs';
|
|
156
|
-
export { snakeCase } from './string/snakeCase.mjs';
|
|
157
|
-
export { startCase } from './string/startCase.mjs';
|
|
158
|
-
export { lowerCase } from './string/lowerCase.mjs';
|
|
159
159
|
export { startsWith } from './string/startsWith.mjs';
|
|
160
160
|
export { endsWith } from './string/endsWith.mjs';
|
|
161
161
|
export { padStart } from './string/padStart.mjs';
|
|
162
162
|
export { padEnd } from './string/padEnd.mjs';
|
|
163
163
|
export { repeat } from './string/repeat.mjs';
|
|
164
|
-
export { toString } from './string/toString.mjs';
|
|
165
|
-
export { trim } from './string/trim.mjs';
|
|
166
|
-
export { trimStart } from './string/trimStart.mjs';
|
|
167
|
-
export { trimEnd } from './string/trimEnd.mjs';
|
|
168
164
|
export { max } from './math/max.mjs';
|
|
169
165
|
export { min } from './math/min.mjs';
|
|
170
|
-
export { ceil } from './math/ceil.mjs';
|
|
171
|
-
export { floor } from './math/floor.mjs';
|
|
172
|
-
export { round } from './math/round.mjs';
|
|
173
166
|
export { parseInt } from './math/parseInt.mjs';
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
* const value3 = () => {};
|
|
17
17
|
* const value4 = null;
|
|
18
18
|
*
|
|
19
|
-
* console.log(
|
|
20
|
-
* console.log(
|
|
21
|
-
* console.log(
|
|
22
|
-
* console.log(
|
|
19
|
+
* console.log(isArray(value1)); // true
|
|
20
|
+
* console.log(isArray(value2)); // true
|
|
21
|
+
* console.log(isArray(value3)); // true
|
|
22
|
+
* console.log(isArray(value4)); // false
|
|
23
23
|
*/
|
|
24
24
|
declare function isObject(value: unknown): value is object;
|
|
25
25
|
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
* const value3 = () => {};
|
|
17
17
|
* const value4 = null;
|
|
18
18
|
*
|
|
19
|
-
* console.log(
|
|
20
|
-
* console.log(
|
|
21
|
-
* console.log(
|
|
22
|
-
* console.log(
|
|
19
|
+
* console.log(isArray(value1)); // true
|
|
20
|
+
* console.log(isArray(value2)); // true
|
|
21
|
+
* console.log(isArray(value3)); // true
|
|
22
|
+
* console.log(isArray(value4)); // false
|
|
23
23
|
*/
|
|
24
24
|
declare function isObject(value: unknown): value is object;
|
|
25
25
|
|
package/dist/index.d.mts
CHANGED
|
@@ -115,14 +115,10 @@ export { timeout } from './promise/timeout.mjs';
|
|
|
115
115
|
export { camelCase } from './string/camelCase.mjs';
|
|
116
116
|
export { snakeCase } from './string/snakeCase.mjs';
|
|
117
117
|
export { kebabCase } from './string/kebabCase.mjs';
|
|
118
|
-
export { upperCase } from './string/upperCase.mjs';
|
|
119
118
|
export { lowerCase } from './string/lowerCase.mjs';
|
|
120
119
|
export { startCase } from './string/startCase.mjs';
|
|
121
120
|
export { capitalize } from './string/capitalize.mjs';
|
|
122
121
|
export { pascalCase } from './string/pascalCase.mjs';
|
|
123
|
-
export { trim } from './string/trim.mjs';
|
|
124
|
-
export { trimStart } from './string/trimStart.mjs';
|
|
125
|
-
export { trimEnd } from './string/trimEnd.mjs';
|
|
126
122
|
export { upperFirst } from './string/upperFirst.mjs';
|
|
127
123
|
export { lowerFirst } from './string/lowerFirst.mjs';
|
|
128
124
|
export { deburr } from './string/deburr.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -115,14 +115,10 @@ export { timeout } from './promise/timeout.js';
|
|
|
115
115
|
export { camelCase } from './string/camelCase.js';
|
|
116
116
|
export { snakeCase } from './string/snakeCase.js';
|
|
117
117
|
export { kebabCase } from './string/kebabCase.js';
|
|
118
|
-
export { upperCase } from './string/upperCase.js';
|
|
119
118
|
export { lowerCase } from './string/lowerCase.js';
|
|
120
119
|
export { startCase } from './string/startCase.js';
|
|
121
120
|
export { capitalize } from './string/capitalize.js';
|
|
122
121
|
export { pascalCase } from './string/pascalCase.js';
|
|
123
|
-
export { trim } from './string/trim.js';
|
|
124
|
-
export { trimStart } from './string/trimStart.js';
|
|
125
|
-
export { trimEnd } from './string/trimEnd.js';
|
|
126
122
|
export { upperFirst } from './string/upperFirst.js';
|
|
127
123
|
export { lowerFirst } from './string/lowerFirst.js';
|
|
128
124
|
export { deburr } from './string/deburr.js';
|