es-toolkit 1.35.0-dev.1202 → 1.35.0-dev.1209
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/{isPromise-ByAybB.js → isPromise-BqEEYJ.js} +126 -40
- package/dist/_chunk/{reverseString-D-wK2p.js → reverseString-BixeGz.js} +84 -13
- package/dist/_chunk/toSnakeCaseKeys-Bvb9j3.js +4578 -0
- package/dist/_chunk/{unary-BsNWRM.js → unary-EIEhcF.js} +46 -0
- package/dist/_chunk/{zip-DxZJSH.js → zipWith-CsbMsR.js} +114 -3
- package/dist/array/index.js +57 -126
- package/dist/array/take.d.mts +1 -1
- package/dist/array/take.d.ts +1 -1
- package/dist/array/take.mjs +4 -1
- package/dist/array/takeRight.d.mts +1 -1
- package/dist/array/takeRight.d.ts +1 -1
- package/dist/array/takeRight.mjs +5 -2
- package/dist/browser.global.js +1 -1
- package/dist/browser.global.js.map +1 -1
- package/dist/compat/compat.d.mts +301 -0
- package/dist/compat/compat.d.ts +301 -0
- package/dist/compat/compat.mjs +303 -0
- package/dist/compat/function/partial.d.mts +575 -0
- package/dist/compat/function/partial.d.ts +575 -0
- package/dist/compat/function/partial.mjs +8 -0
- package/dist/compat/function/partialRight.d.mts +651 -0
- package/dist/compat/function/partialRight.d.ts +651 -0
- package/dist/compat/function/partialRight.mjs +8 -0
- package/dist/compat/index.d.mts +10 -18
- package/dist/compat/index.d.ts +10 -18
- package/dist/compat/index.js +280 -4043
- package/dist/compat/index.mjs +13 -19
- package/dist/compat/object/defaults.mjs +7 -1
- package/dist/compat/string/repeat.d.mts +1 -1
- package/dist/compat/string/repeat.d.ts +1 -1
- package/dist/compat/string/repeat.mjs +12 -2
- package/dist/compat/string/words.d.mts +1 -1
- package/dist/compat/string/words.d.ts +1 -1
- package/dist/compat/string/words.mjs +2 -1
- package/dist/compat/toolkit.d.mts +9 -0
- package/dist/compat/toolkit.d.ts +9 -0
- package/dist/compat/toolkit.mjs +10 -0
- package/dist/function/index.js +3 -4
- package/dist/function/partial.d.mts +3 -3
- package/dist/function/partial.d.ts +3 -3
- package/dist/function/partial.mjs +17 -19
- package/dist/function/partialRight.d.mts +3 -3
- package/dist/function/partialRight.d.ts +3 -3
- package/dist/function/partialRight.mjs +18 -20
- package/dist/index.js +84 -87
- package/dist/object/index.js +15 -15
- package/dist/object/toCamelCaseKeys.mjs +3 -0
- package/dist/object/toSnakeCaseKeys.mjs +3 -0
- package/dist/predicate/index.js +4 -5
- package/dist/string/index.js +7 -8
- package/package.json +1 -1
- package/dist/_chunk/isPlainObject-Xaozpc.js +0 -93
- package/dist/_chunk/partialRight-B0_CSB.js +0 -50
- package/dist/_chunk/snakeCase-BtVEeB.js +0 -75
- package/dist/_chunk/toSnakeCaseKeys-BNpS71.js +0 -569
- package/dist/compat/_internal/copyArray.mjs +0 -12
- package/dist/compat/array/flatMap.d.mts +0 -20
- package/dist/compat/array/flatMap.d.ts +0 -20
- package/dist/compat/array/flatMap.mjs +0 -13
- package/dist/compat/array/forEachRight.d.mts +0 -106
- package/dist/compat/array/forEachRight.d.ts +0 -106
- package/dist/compat/array/forEachRight.mjs +0 -21
- package/dist/compat/array/partition.d.mts +0 -65
- package/dist/compat/array/partition.d.ts +0 -65
- package/dist/compat/array/partition.mjs +0 -24
- package/dist/compat/array/pullAllWith.d.mts +0 -59
- package/dist/compat/array/pullAllWith.d.ts +0 -59
- package/dist/compat/array/pullAllWith.mjs +0 -33
- package/dist/compat/array/pullAt.d.mts +0 -32
- package/dist/compat/array/pullAt.d.ts +0 -32
- package/dist/compat/array/pullAt.mjs +0 -34
- package/dist/compat/array/zipObject.d.mts +0 -49
- package/dist/compat/array/zipObject.d.ts +0 -49
- package/dist/compat/array/zipObject.mjs +0 -11
- package/dist/compat/array/zipWith.d.mts +0 -92
- package/dist/compat/array/zipWith.d.ts +0 -92
- package/dist/compat/array/zipWith.mjs +0 -20
- package/dist/compat/object/at.d.mts +0 -19
- package/dist/compat/object/at.d.ts +0 -19
- package/dist/compat/object/at.mjs +0 -27
- package/dist/compat/object/forIn.d.mts +0 -58
- package/dist/compat/object/forIn.d.ts +0 -58
- package/dist/compat/object/forIn.mjs +0 -16
- package/dist/compat/object/forInRight.d.mts +0 -58
- package/dist/compat/object/forInRight.d.ts +0 -58
- package/dist/compat/object/forInRight.mjs +0 -21
- package/dist/compat/object/forOwn.d.mts +0 -54
- package/dist/compat/object/forOwn.d.ts +0 -54
- package/dist/compat/object/forOwn.mjs +0 -19
- package/dist/compat/object/forOwnRight.d.mts +0 -54
- package/dist/compat/object/forOwnRight.d.ts +0 -54
- package/dist/compat/object/forOwnRight.mjs +0 -19
- package/dist/compat/object/hasIn.d.mts +0 -40
- package/dist/compat/object/hasIn.d.ts +0 -40
- package/dist/compat/object/hasIn.mjs +0 -34
- package/dist/compat/string/split.d.mts +0 -19
- package/dist/compat/string/split.d.ts +0 -19
- package/dist/compat/string/split.mjs +0 -7
- package/dist/compat/util/overEvery.d.mts +0 -67
- package/dist/compat/util/overEvery.d.ts +0 -67
- package/dist/compat/util/overEvery.mjs +0 -23
- package/dist/compat/util/overSome.d.mts +0 -69
- package/dist/compat/util/overSome.d.ts +0 -69
- package/dist/compat/util/overSome.mjs +0 -23
|
@@ -1,8 +1,67 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const isPlainObject = require('./isPlainObject-Xaozpc.js');
|
|
4
3
|
const noop = require('./noop-2IwLUk.js');
|
|
5
4
|
|
|
5
|
+
function isPrimitive(value) {
|
|
6
|
+
return value == null || (typeof value !== 'object' && typeof value !== 'function');
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
function isTypedArray(x) {
|
|
10
|
+
return ArrayBuffer.isView(x) && !(x instanceof DataView);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function getSymbols(object) {
|
|
14
|
+
return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getTag(value) {
|
|
18
|
+
if (value == null) {
|
|
19
|
+
return value === undefined ? '[object Undefined]' : '[object Null]';
|
|
20
|
+
}
|
|
21
|
+
return Object.prototype.toString.call(value);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const regexpTag = '[object RegExp]';
|
|
25
|
+
const stringTag = '[object String]';
|
|
26
|
+
const numberTag = '[object Number]';
|
|
27
|
+
const booleanTag = '[object Boolean]';
|
|
28
|
+
const argumentsTag = '[object Arguments]';
|
|
29
|
+
const symbolTag = '[object Symbol]';
|
|
30
|
+
const dateTag = '[object Date]';
|
|
31
|
+
const mapTag = '[object Map]';
|
|
32
|
+
const setTag = '[object Set]';
|
|
33
|
+
const arrayTag = '[object Array]';
|
|
34
|
+
const functionTag = '[object Function]';
|
|
35
|
+
const arrayBufferTag = '[object ArrayBuffer]';
|
|
36
|
+
const objectTag = '[object Object]';
|
|
37
|
+
const errorTag = '[object Error]';
|
|
38
|
+
const dataViewTag = '[object DataView]';
|
|
39
|
+
const uint8ArrayTag = '[object Uint8Array]';
|
|
40
|
+
const uint8ClampedArrayTag = '[object Uint8ClampedArray]';
|
|
41
|
+
const uint16ArrayTag = '[object Uint16Array]';
|
|
42
|
+
const uint32ArrayTag = '[object Uint32Array]';
|
|
43
|
+
const bigUint64ArrayTag = '[object BigUint64Array]';
|
|
44
|
+
const int8ArrayTag = '[object Int8Array]';
|
|
45
|
+
const int16ArrayTag = '[object Int16Array]';
|
|
46
|
+
const int32ArrayTag = '[object Int32Array]';
|
|
47
|
+
const bigInt64ArrayTag = '[object BigInt64Array]';
|
|
48
|
+
const float32ArrayTag = '[object Float32Array]';
|
|
49
|
+
const float64ArrayTag = '[object Float64Array]';
|
|
50
|
+
|
|
51
|
+
function isPlainObject(value) {
|
|
52
|
+
if (!value || typeof value !== 'object') {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const proto = Object.getPrototypeOf(value);
|
|
56
|
+
const hasObjectPrototype = proto === null ||
|
|
57
|
+
proto === Object.prototype ||
|
|
58
|
+
Object.getPrototypeOf(proto) === null;
|
|
59
|
+
if (!hasObjectPrototype) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
63
|
+
}
|
|
64
|
+
|
|
6
65
|
function isLength(value) {
|
|
7
66
|
return Number.isSafeInteger(value) && value >= 0;
|
|
8
67
|
}
|
|
@@ -27,14 +86,14 @@ function isSymbol(value) {
|
|
|
27
86
|
return typeof value === 'symbol';
|
|
28
87
|
}
|
|
29
88
|
|
|
30
|
-
function isFunction(value) {
|
|
31
|
-
return typeof value === 'function';
|
|
32
|
-
}
|
|
33
|
-
|
|
34
89
|
function isBuffer(x) {
|
|
35
90
|
return typeof Buffer !== 'undefined' && Buffer.isBuffer(x);
|
|
36
91
|
}
|
|
37
92
|
|
|
93
|
+
function isFunction(value) {
|
|
94
|
+
return typeof value === 'function';
|
|
95
|
+
}
|
|
96
|
+
|
|
38
97
|
function isArrayBuffer(value) {
|
|
39
98
|
return value instanceof ArrayBuffer;
|
|
40
99
|
}
|
|
@@ -77,33 +136,33 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
77
136
|
if (Object.is(a, b)) {
|
|
78
137
|
return true;
|
|
79
138
|
}
|
|
80
|
-
let aTag =
|
|
81
|
-
let bTag =
|
|
82
|
-
if (aTag ===
|
|
83
|
-
aTag =
|
|
139
|
+
let aTag = getTag(a);
|
|
140
|
+
let bTag = getTag(b);
|
|
141
|
+
if (aTag === argumentsTag) {
|
|
142
|
+
aTag = objectTag;
|
|
84
143
|
}
|
|
85
|
-
if (bTag ===
|
|
86
|
-
bTag =
|
|
144
|
+
if (bTag === argumentsTag) {
|
|
145
|
+
bTag = objectTag;
|
|
87
146
|
}
|
|
88
147
|
if (aTag !== bTag) {
|
|
89
148
|
return false;
|
|
90
149
|
}
|
|
91
150
|
switch (aTag) {
|
|
92
|
-
case
|
|
151
|
+
case stringTag:
|
|
93
152
|
return a.toString() === b.toString();
|
|
94
|
-
case
|
|
153
|
+
case numberTag: {
|
|
95
154
|
const x = a.valueOf();
|
|
96
155
|
const y = b.valueOf();
|
|
97
156
|
return eq(x, y);
|
|
98
157
|
}
|
|
99
|
-
case
|
|
100
|
-
case
|
|
101
|
-
case
|
|
158
|
+
case booleanTag:
|
|
159
|
+
case dateTag:
|
|
160
|
+
case symbolTag:
|
|
102
161
|
return Object.is(a.valueOf(), b.valueOf());
|
|
103
|
-
case
|
|
162
|
+
case regexpTag: {
|
|
104
163
|
return a.source === b.source && a.flags === b.flags;
|
|
105
164
|
}
|
|
106
|
-
case
|
|
165
|
+
case functionTag: {
|
|
107
166
|
return a === b;
|
|
108
167
|
}
|
|
109
168
|
}
|
|
@@ -117,7 +176,7 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
117
176
|
stack.set(b, a);
|
|
118
177
|
try {
|
|
119
178
|
switch (aTag) {
|
|
120
|
-
case
|
|
179
|
+
case mapTag: {
|
|
121
180
|
if (a.size !== b.size) {
|
|
122
181
|
return false;
|
|
123
182
|
}
|
|
@@ -128,7 +187,7 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
128
187
|
}
|
|
129
188
|
return true;
|
|
130
189
|
}
|
|
131
|
-
case
|
|
190
|
+
case setTag: {
|
|
132
191
|
if (a.size !== b.size) {
|
|
133
192
|
return false;
|
|
134
193
|
}
|
|
@@ -146,18 +205,18 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
146
205
|
}
|
|
147
206
|
return true;
|
|
148
207
|
}
|
|
149
|
-
case
|
|
150
|
-
case
|
|
151
|
-
case
|
|
152
|
-
case
|
|
153
|
-
case
|
|
154
|
-
case
|
|
155
|
-
case
|
|
156
|
-
case
|
|
157
|
-
case
|
|
158
|
-
case
|
|
159
|
-
case
|
|
160
|
-
case
|
|
208
|
+
case arrayTag:
|
|
209
|
+
case uint8ArrayTag:
|
|
210
|
+
case uint8ClampedArrayTag:
|
|
211
|
+
case uint16ArrayTag:
|
|
212
|
+
case uint32ArrayTag:
|
|
213
|
+
case bigUint64ArrayTag:
|
|
214
|
+
case int8ArrayTag:
|
|
215
|
+
case int16ArrayTag:
|
|
216
|
+
case int32ArrayTag:
|
|
217
|
+
case bigInt64ArrayTag:
|
|
218
|
+
case float32ArrayTag:
|
|
219
|
+
case float64ArrayTag: {
|
|
161
220
|
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) {
|
|
162
221
|
return false;
|
|
163
222
|
}
|
|
@@ -171,29 +230,29 @@ function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
|
171
230
|
}
|
|
172
231
|
return true;
|
|
173
232
|
}
|
|
174
|
-
case
|
|
233
|
+
case arrayBufferTag: {
|
|
175
234
|
if (a.byteLength !== b.byteLength) {
|
|
176
235
|
return false;
|
|
177
236
|
}
|
|
178
237
|
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
179
238
|
}
|
|
180
|
-
case
|
|
239
|
+
case dataViewTag: {
|
|
181
240
|
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {
|
|
182
241
|
return false;
|
|
183
242
|
}
|
|
184
243
|
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
185
244
|
}
|
|
186
|
-
case
|
|
245
|
+
case errorTag: {
|
|
187
246
|
return a.name === b.name && a.message === b.message;
|
|
188
247
|
}
|
|
189
|
-
case
|
|
248
|
+
case objectTag: {
|
|
190
249
|
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) ||
|
|
191
|
-
(isPlainObject
|
|
250
|
+
(isPlainObject(a) && isPlainObject(b));
|
|
192
251
|
if (!areEqualInstances) {
|
|
193
252
|
return false;
|
|
194
253
|
}
|
|
195
|
-
const aKeys = [...Object.keys(a), ...
|
|
196
|
-
const bKeys = [...Object.keys(b), ...
|
|
254
|
+
const aKeys = [...Object.keys(a), ...getSymbols(a)];
|
|
255
|
+
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
|
197
256
|
if (aKeys.length !== bKeys.length) {
|
|
198
257
|
return false;
|
|
199
258
|
}
|
|
@@ -298,7 +357,7 @@ function isJSONArray(value) {
|
|
|
298
357
|
return value.every(item => isJSONValue(item));
|
|
299
358
|
}
|
|
300
359
|
function isJSONObject(obj) {
|
|
301
|
-
if (!isPlainObject
|
|
360
|
+
if (!isPlainObject(obj)) {
|
|
302
361
|
return false;
|
|
303
362
|
}
|
|
304
363
|
const keys = Reflect.ownKeys(obj);
|
|
@@ -327,7 +386,20 @@ function isPromise(value) {
|
|
|
327
386
|
return value instanceof Promise;
|
|
328
387
|
}
|
|
329
388
|
|
|
389
|
+
exports.argumentsTag = argumentsTag;
|
|
390
|
+
exports.arrayBufferTag = arrayBufferTag;
|
|
391
|
+
exports.arrayTag = arrayTag;
|
|
392
|
+
exports.booleanTag = booleanTag;
|
|
393
|
+
exports.dataViewTag = dataViewTag;
|
|
394
|
+
exports.dateTag = dateTag;
|
|
330
395
|
exports.eq = eq;
|
|
396
|
+
exports.float32ArrayTag = float32ArrayTag;
|
|
397
|
+
exports.float64ArrayTag = float64ArrayTag;
|
|
398
|
+
exports.getSymbols = getSymbols;
|
|
399
|
+
exports.getTag = getTag;
|
|
400
|
+
exports.int16ArrayTag = int16ArrayTag;
|
|
401
|
+
exports.int32ArrayTag = int32ArrayTag;
|
|
402
|
+
exports.int8ArrayTag = int8ArrayTag;
|
|
331
403
|
exports.isArrayBuffer = isArrayBuffer;
|
|
332
404
|
exports.isBlob = isBlob;
|
|
333
405
|
exports.isBrowser = isBrowser;
|
|
@@ -347,10 +419,24 @@ exports.isNil = isNil;
|
|
|
347
419
|
exports.isNode = isNode;
|
|
348
420
|
exports.isNotNil = isNotNil;
|
|
349
421
|
exports.isNull = isNull;
|
|
422
|
+
exports.isPlainObject = isPlainObject;
|
|
423
|
+
exports.isPrimitive = isPrimitive;
|
|
350
424
|
exports.isPromise = isPromise;
|
|
351
425
|
exports.isRegExp = isRegExp;
|
|
352
426
|
exports.isSet = isSet;
|
|
353
427
|
exports.isSymbol = isSymbol;
|
|
428
|
+
exports.isTypedArray = isTypedArray;
|
|
354
429
|
exports.isUndefined = isUndefined;
|
|
355
430
|
exports.isWeakMap = isWeakMap;
|
|
356
431
|
exports.isWeakSet = isWeakSet;
|
|
432
|
+
exports.mapTag = mapTag;
|
|
433
|
+
exports.numberTag = numberTag;
|
|
434
|
+
exports.objectTag = objectTag;
|
|
435
|
+
exports.regexpTag = regexpTag;
|
|
436
|
+
exports.setTag = setTag;
|
|
437
|
+
exports.stringTag = stringTag;
|
|
438
|
+
exports.symbolTag = symbolTag;
|
|
439
|
+
exports.uint16ArrayTag = uint16ArrayTag;
|
|
440
|
+
exports.uint32ArrayTag = uint32ArrayTag;
|
|
441
|
+
exports.uint8ArrayTag = uint8ArrayTag;
|
|
442
|
+
exports.uint8ClampedArrayTag = uint8ClampedArrayTag;
|
|
@@ -1,6 +1,66 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
function capitalize(str) {
|
|
4
|
+
return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const CASE_SPLIT_PATTERN = /\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;
|
|
8
|
+
function words(str) {
|
|
9
|
+
return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function camelCase(str) {
|
|
13
|
+
const words$1 = words(str);
|
|
14
|
+
if (words$1.length === 0) {
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
17
|
+
const [first, ...rest] = words$1;
|
|
18
|
+
return `${first.toLowerCase()}${rest.map(word => capitalize(word)).join('')}`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const deburrMap = new Map(Object.entries({
|
|
22
|
+
Æ: 'Ae',
|
|
23
|
+
Ð: 'D',
|
|
24
|
+
Ø: 'O',
|
|
25
|
+
Þ: 'Th',
|
|
26
|
+
ß: 'ss',
|
|
27
|
+
æ: 'ae',
|
|
28
|
+
ð: 'd',
|
|
29
|
+
ø: 'o',
|
|
30
|
+
þ: 'th',
|
|
31
|
+
Đ: 'D',
|
|
32
|
+
đ: 'd',
|
|
33
|
+
Ħ: 'H',
|
|
34
|
+
ħ: 'h',
|
|
35
|
+
ı: 'i',
|
|
36
|
+
IJ: 'IJ',
|
|
37
|
+
ij: 'ij',
|
|
38
|
+
ĸ: 'k',
|
|
39
|
+
Ŀ: 'L',
|
|
40
|
+
ŀ: 'l',
|
|
41
|
+
Ł: 'L',
|
|
42
|
+
ł: 'l',
|
|
43
|
+
ʼn: "'n",
|
|
44
|
+
Ŋ: 'N',
|
|
45
|
+
ŋ: 'n',
|
|
46
|
+
Œ: 'Oe',
|
|
47
|
+
œ: 'oe',
|
|
48
|
+
Ŧ: 'T',
|
|
49
|
+
ŧ: 't',
|
|
50
|
+
ſ: 's',
|
|
51
|
+
}));
|
|
52
|
+
function deburr(str) {
|
|
53
|
+
str = str.normalize('NFD');
|
|
54
|
+
let result = '';
|
|
55
|
+
for (let i = 0; i < str.length; i++) {
|
|
56
|
+
const char = str[i];
|
|
57
|
+
if ((char >= '\u0300' && char <= '\u036f') || (char >= '\ufe20' && char <= '\ufe23')) {
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
result += deburrMap.get(char) ?? char;
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
4
64
|
|
|
5
65
|
const htmlEscapes = {
|
|
6
66
|
'&': '&',
|
|
@@ -18,13 +78,13 @@ function escapeRegExp(str) {
|
|
|
18
78
|
}
|
|
19
79
|
|
|
20
80
|
function kebabCase(str) {
|
|
21
|
-
const words =
|
|
22
|
-
return words.map(word => word.toLowerCase()).join('-');
|
|
81
|
+
const words$1 = words(str);
|
|
82
|
+
return words$1.map(word => word.toLowerCase()).join('-');
|
|
23
83
|
}
|
|
24
84
|
|
|
25
85
|
function lowerCase(str) {
|
|
26
|
-
const words =
|
|
27
|
-
return words.map(word => word.toLowerCase()).join(' ');
|
|
86
|
+
const words$1 = words(str);
|
|
87
|
+
return words$1.map(word => word.toLowerCase()).join(' ');
|
|
28
88
|
}
|
|
29
89
|
|
|
30
90
|
function lowerFirst(str) {
|
|
@@ -35,6 +95,11 @@ function pad(str, length, chars = ' ') {
|
|
|
35
95
|
return str.padStart(Math.floor((length - str.length) / 2) + str.length, chars).padEnd(length, chars);
|
|
36
96
|
}
|
|
37
97
|
|
|
98
|
+
function snakeCase(str) {
|
|
99
|
+
const words$1 = words(str);
|
|
100
|
+
return words$1.map(word => word.toLowerCase()).join('_');
|
|
101
|
+
}
|
|
102
|
+
|
|
38
103
|
function trimEnd(str, chars) {
|
|
39
104
|
if (chars === undefined) {
|
|
40
105
|
return str.trimEnd();
|
|
@@ -99,11 +164,11 @@ function unescape(str) {
|
|
|
99
164
|
}
|
|
100
165
|
|
|
101
166
|
function upperCase(str) {
|
|
102
|
-
const words =
|
|
167
|
+
const words$1 = words(str);
|
|
103
168
|
let result = '';
|
|
104
|
-
for (let i = 0; i < words.length; i++) {
|
|
105
|
-
result += words[i].toUpperCase();
|
|
106
|
-
if (i < words.length - 1) {
|
|
169
|
+
for (let i = 0; i < words$1.length; i++) {
|
|
170
|
+
result += words$1[i].toUpperCase();
|
|
171
|
+
if (i < words$1.length - 1) {
|
|
107
172
|
result += ' ';
|
|
108
173
|
}
|
|
109
174
|
}
|
|
@@ -115,20 +180,24 @@ function upperFirst(str) {
|
|
|
115
180
|
}
|
|
116
181
|
|
|
117
182
|
function constantCase(str) {
|
|
118
|
-
const words =
|
|
119
|
-
return words.map(word => word.toUpperCase()).join('_');
|
|
183
|
+
const words$1 = words(str);
|
|
184
|
+
return words$1.map(word => word.toUpperCase()).join('_');
|
|
120
185
|
}
|
|
121
186
|
|
|
122
187
|
function pascalCase(str) {
|
|
123
|
-
const words =
|
|
124
|
-
return words.map(word =>
|
|
188
|
+
const words$1 = words(str);
|
|
189
|
+
return words$1.map(word => capitalize(word)).join('');
|
|
125
190
|
}
|
|
126
191
|
|
|
127
192
|
function reverseString(value) {
|
|
128
193
|
return [...value].reverse().join('');
|
|
129
194
|
}
|
|
130
195
|
|
|
196
|
+
exports.CASE_SPLIT_PATTERN = CASE_SPLIT_PATTERN;
|
|
197
|
+
exports.camelCase = camelCase;
|
|
198
|
+
exports.capitalize = capitalize;
|
|
131
199
|
exports.constantCase = constantCase;
|
|
200
|
+
exports.deburr = deburr;
|
|
132
201
|
exports.escape = escape;
|
|
133
202
|
exports.escapeRegExp = escapeRegExp;
|
|
134
203
|
exports.kebabCase = kebabCase;
|
|
@@ -137,9 +206,11 @@ exports.lowerFirst = lowerFirst;
|
|
|
137
206
|
exports.pad = pad;
|
|
138
207
|
exports.pascalCase = pascalCase;
|
|
139
208
|
exports.reverseString = reverseString;
|
|
209
|
+
exports.snakeCase = snakeCase;
|
|
140
210
|
exports.trim = trim;
|
|
141
211
|
exports.trimEnd = trimEnd;
|
|
142
212
|
exports.trimStart = trimStart;
|
|
143
213
|
exports.unescape = unescape;
|
|
144
214
|
exports.upperCase = upperCase;
|
|
145
215
|
exports.upperFirst = upperFirst;
|
|
216
|
+
exports.words = words;
|