@hairy/utils 1.32.0 → 1.34.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/index.cjs CHANGED
@@ -54,6 +54,8 @@ __export(index_exports, {
54
54
  dotCase: () => dotCase,
55
55
  downloadBlobFile: () => downloadBlobFile,
56
56
  downloadNetworkFile: () => downloadNetworkFile,
57
+ ensurePrefix: () => ensurePrefix,
58
+ ensureSuffix: () => ensureSuffix,
57
59
  find: () => find_default,
58
60
  formToObject: () => formToObject,
59
61
  formatNumeric: () => formatNumeric,
@@ -65,15 +67,21 @@ __export(index_exports, {
65
67
  gte: () => gte,
66
68
  integer: () => integer,
67
69
  isAndroid: () => isAndroid,
70
+ isArguments: () => isArguments_default,
68
71
  isArray: () => isArray_default,
72
+ isArrayBuffer: () => isArrayBuffer_default,
69
73
  isArrayLike: () => isArrayLike_default,
74
+ isArrayLikeObject: () => isArrayLikeObject_default,
70
75
  isBoolean: () => isBoolean_default,
71
76
  isBrowser: () => isBrowser,
77
+ isBuffer: () => isBuffer_default,
72
78
  isChrome: () => isChrome,
73
79
  isDate: () => isDate_default,
74
80
  isEdge: () => isEdge,
81
+ isElement: () => isElement_default,
75
82
  isEmpty: () => isEmpty_default,
76
83
  isEqual: () => isEqual_default,
84
+ isEqualWith: () => isEqualWith_default,
77
85
  isError: () => isError_default,
78
86
  isFF: () => isFF,
79
87
  isFormData: () => isFormData,
@@ -82,23 +90,34 @@ __export(index_exports, {
82
90
  isIE11: () => isIE11,
83
91
  isIE9: () => isIE9,
84
92
  isIOS: () => isIOS,
93
+ isInteger: () => isInteger_default,
94
+ isMap: () => isMap_default,
95
+ isMatch: () => isMatch_default,
96
+ isMatchWith: () => isMatchWith_default,
85
97
  isMobile: () => isMobile,
86
98
  isNaN: () => isNaN_default,
87
99
  isNative: () => isNative_default,
88
100
  isNull: () => isNull_default,
89
101
  isNumber: () => isNumber_default,
90
102
  isObject: () => isObject_default,
103
+ isObjectLike: () => isObjectLike_default,
91
104
  isPhantomJS: () => isPhantomJS,
92
105
  isPlainObject: () => isPlainObject_default,
106
+ isRegexp: () => isRegExp_default,
107
+ isSet: () => isSet_default,
93
108
  isString: () => isString_default,
109
+ isSymbol: () => isSymbol_default,
94
110
  isTruthy: () => isTruthy,
95
111
  isTypeof: () => isTypeof,
96
112
  isUndefined: () => isUndefined_default,
113
+ isWeakMap: () => isWeakMap_default,
114
+ isWeakSet: () => isWeakSet_default,
97
115
  isWeex: () => isWeex,
98
116
  isWindow: () => isWindow,
99
117
  join: () => join_default,
100
118
  jsonTryParse: () => jsonTryParse,
101
119
  kebabCase: () => kebabCase,
120
+ keyBy: () => keyBy_default,
102
121
  keys: () => keys_default,
103
122
  loop: () => loop,
104
123
  lt: () => lt,
@@ -120,18 +139,23 @@ __export(index_exports, {
120
139
  plus: () => plus,
121
140
  proxy: () => proxy,
122
141
  randomArray: () => randomArray,
123
- randomNumer: () => randomNumer,
142
+ randomNumber: () => randomNumber,
143
+ randomString: () => randomString,
124
144
  readFileReader: () => readFileReader,
125
145
  redirectTo: () => redirectTo,
126
146
  riposte: () => riposte,
127
147
  selectImages: () => selectImages,
128
148
  sentenceCase: () => sentenceCase,
149
+ set: () => set_default,
129
150
  showOpenFilePicker: () => showOpenFilePicker,
130
151
  showOpenImagePicker: () => showOpenImagePicker,
152
+ slash: () => slash,
131
153
  snakeCase: () => snakeCase,
154
+ template: () => template,
132
155
  to: () => to,
133
156
  trainCase: () => trainCase,
134
157
  truncate: () => truncate_default,
158
+ unindent: () => unindent,
135
159
  uniq: () => uniq_default,
136
160
  uniqBy: () => uniqBy_default,
137
161
  uniqWith: () => uniqWith_default,
@@ -218,142 +242,6 @@ function off(obj, ...args) {
218
242
  obj.removeEventListener(...args);
219
243
  }
220
244
 
221
- // ../../node_modules/.pnpm/change-case@5.4.4/node_modules/change-case/dist/index.js
222
- var SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
223
- var SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
224
- var SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
225
- var DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
226
- var SPLIT_REPLACE_VALUE = "$1\0$2";
227
- var DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
228
- function split(value) {
229
- let result = value.trim();
230
- result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
231
- result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
232
- let start = 0;
233
- let end = result.length;
234
- while (result.charAt(start) === "\0")
235
- start++;
236
- if (start === end)
237
- return [];
238
- while (result.charAt(end - 1) === "\0")
239
- end--;
240
- return result.slice(start, end).split(/\0/g);
241
- }
242
- function splitSeparateNumbers(value) {
243
- const words = split(value);
244
- for (let i = 0; i < words.length; i++) {
245
- const word = words[i];
246
- const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
247
- if (match) {
248
- const offset = match.index + (match[1] ?? match[2]).length;
249
- words.splice(i, 1, word.slice(0, offset), word.slice(offset));
250
- }
251
- }
252
- return words;
253
- }
254
- function noCase(input, options) {
255
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
256
- return prefix + words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? " ") + suffix;
257
- }
258
- function camelCase(input, options) {
259
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
260
- const lower = lowerFactory(options?.locale);
261
- const upper = upperFactory(options?.locale);
262
- const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
263
- return prefix + words.map((word, index) => {
264
- if (index === 0)
265
- return lower(word);
266
- return transform(word, index);
267
- }).join(options?.delimiter ?? "") + suffix;
268
- }
269
- function pascalCase(input, options) {
270
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
271
- const lower = lowerFactory(options?.locale);
272
- const upper = upperFactory(options?.locale);
273
- const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
274
- return prefix + words.map(transform).join(options?.delimiter ?? "") + suffix;
275
- }
276
- function pascalSnakeCase(input, options) {
277
- return capitalCase(input, { delimiter: "_", ...options });
278
- }
279
- function capitalCase(input, options) {
280
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
281
- const lower = lowerFactory(options?.locale);
282
- const upper = upperFactory(options?.locale);
283
- return prefix + words.map(capitalCaseTransformFactory(lower, upper)).join(options?.delimiter ?? " ") + suffix;
284
- }
285
- function constantCase(input, options) {
286
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
287
- return prefix + words.map(upperFactory(options?.locale)).join(options?.delimiter ?? "_") + suffix;
288
- }
289
- function dotCase(input, options) {
290
- return noCase(input, { delimiter: ".", ...options });
291
- }
292
- function kebabCase(input, options) {
293
- return noCase(input, { delimiter: "-", ...options });
294
- }
295
- function pathCase(input, options) {
296
- return noCase(input, { delimiter: "/", ...options });
297
- }
298
- function sentenceCase(input, options) {
299
- const [prefix, words, suffix] = splitPrefixSuffix(input, options);
300
- const lower = lowerFactory(options?.locale);
301
- const upper = upperFactory(options?.locale);
302
- const transform = capitalCaseTransformFactory(lower, upper);
303
- return prefix + words.map((word, index) => {
304
- if (index === 0)
305
- return transform(word);
306
- return lower(word);
307
- }).join(options?.delimiter ?? " ") + suffix;
308
- }
309
- function snakeCase(input, options) {
310
- return noCase(input, { delimiter: "_", ...options });
311
- }
312
- function trainCase(input, options) {
313
- return capitalCase(input, { delimiter: "-", ...options });
314
- }
315
- function lowerFactory(locale) {
316
- return locale === false ? (input) => input.toLowerCase() : (input) => input.toLocaleLowerCase(locale);
317
- }
318
- function upperFactory(locale) {
319
- return locale === false ? (input) => input.toUpperCase() : (input) => input.toLocaleUpperCase(locale);
320
- }
321
- function capitalCaseTransformFactory(lower, upper) {
322
- return (word) => `${upper(word[0])}${lower(word.slice(1))}`;
323
- }
324
- function pascalCaseTransformFactory(lower, upper) {
325
- return (word, index) => {
326
- const char0 = word[0];
327
- const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
328
- return initial + lower(word.slice(1));
329
- };
330
- }
331
- function splitPrefixSuffix(input, options = {}) {
332
- const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
333
- const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
334
- const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
335
- let prefixIndex = 0;
336
- let suffixIndex = input.length;
337
- while (prefixIndex < input.length) {
338
- const char = input.charAt(prefixIndex);
339
- if (!prefixCharacters.includes(char))
340
- break;
341
- prefixIndex++;
342
- }
343
- while (suffixIndex > prefixIndex) {
344
- const index = suffixIndex - 1;
345
- const char = input.charAt(index);
346
- if (!suffixCharacters.includes(char))
347
- break;
348
- suffixIndex = index;
349
- }
350
- return [
351
- input.slice(0, prefixIndex),
352
- splitFn(input.slice(prefixIndex, suffixIndex)),
353
- input.slice(suffixIndex)
354
- ];
355
- }
356
-
357
245
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_freeGlobal.js
358
246
  var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
359
247
  var freeGlobal_default = freeGlobal;
@@ -2198,9 +2086,9 @@ function mapToArray(map) {
2198
2086
  var mapToArray_default = mapToArray;
2199
2087
 
2200
2088
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_setToArray.js
2201
- function setToArray(set) {
2202
- var index = -1, result = Array(set.size);
2203
- set.forEach(function(value) {
2089
+ function setToArray(set2) {
2090
+ var index = -1, result = Array(set2.size);
2091
+ set2.forEach(function(value) {
2204
2092
  result[++index] = value;
2205
2093
  });
2206
2094
  return result;
@@ -2885,6 +2773,18 @@ function values(object) {
2885
2773
  }
2886
2774
  var values_default = values;
2887
2775
 
2776
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseIsArrayBuffer.js
2777
+ var arrayBufferTag5 = "[object ArrayBuffer]";
2778
+ function baseIsArrayBuffer(value) {
2779
+ return isObjectLike_default(value) && baseGetTag_default(value) == arrayBufferTag5;
2780
+ }
2781
+ var baseIsArrayBuffer_default = baseIsArrayBuffer;
2782
+
2783
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isArrayBuffer.js
2784
+ var nodeIsArrayBuffer = nodeUtil_default && nodeUtil_default.isArrayBuffer;
2785
+ var isArrayBuffer = nodeIsArrayBuffer ? baseUnary_default(nodeIsArrayBuffer) : baseIsArrayBuffer_default;
2786
+ var isArrayBuffer_default = isArrayBuffer;
2787
+
2888
2788
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isBoolean.js
2889
2789
  var boolTag5 = "[object Boolean]";
2890
2790
  function isBoolean(value) {
@@ -2904,6 +2804,12 @@ var nodeIsDate = nodeUtil_default && nodeUtil_default.isDate;
2904
2804
  var isDate = nodeIsDate ? baseUnary_default(nodeIsDate) : baseIsDate_default;
2905
2805
  var isDate_default = isDate;
2906
2806
 
2807
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isElement.js
2808
+ function isElement(value) {
2809
+ return isObjectLike_default(value) && value.nodeType === 1 && !isPlainObject_default(value);
2810
+ }
2811
+ var isElement_default = isElement;
2812
+
2907
2813
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEmpty.js
2908
2814
  var mapTag7 = "[object Map]";
2909
2815
  var setTag7 = "[object Set]";
@@ -2938,6 +2844,33 @@ function isEqual(value, other) {
2938
2844
  }
2939
2845
  var isEqual_default = isEqual;
2940
2846
 
2847
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isEqualWith.js
2848
+ function isEqualWith(value, other, customizer) {
2849
+ customizer = typeof customizer == "function" ? customizer : void 0;
2850
+ var result = customizer ? customizer(value, other) : void 0;
2851
+ return result === void 0 ? baseIsEqual_default(value, other, void 0, customizer) : !!result;
2852
+ }
2853
+ var isEqualWith_default = isEqualWith;
2854
+
2855
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isInteger.js
2856
+ function isInteger(value) {
2857
+ return typeof value == "number" && value == toInteger_default(value);
2858
+ }
2859
+ var isInteger_default = isInteger;
2860
+
2861
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isMatch.js
2862
+ function isMatch(object, source) {
2863
+ return object === source || baseIsMatch_default(object, source, getMatchData_default(source));
2864
+ }
2865
+ var isMatch_default = isMatch;
2866
+
2867
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isMatchWith.js
2868
+ function isMatchWith(object, source, customizer) {
2869
+ customizer = typeof customizer == "function" ? customizer : void 0;
2870
+ return baseIsMatch_default(object, source, getMatchData_default(source), customizer);
2871
+ }
2872
+ var isMatchWith_default = isMatchWith;
2873
+
2941
2874
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isNumber.js
2942
2875
  var numberTag5 = "[object Number]";
2943
2876
  function isNumber(value) {
@@ -2989,6 +2922,20 @@ function isUndefined(value) {
2989
2922
  }
2990
2923
  var isUndefined_default = isUndefined;
2991
2924
 
2925
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isWeakMap.js
2926
+ var weakMapTag4 = "[object WeakMap]";
2927
+ function isWeakMap(value) {
2928
+ return isObjectLike_default(value) && getTag_default(value) == weakMapTag4;
2929
+ }
2930
+ var isWeakMap_default = isWeakMap;
2931
+
2932
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/isWeakSet.js
2933
+ var weakSetTag = "[object WeakSet]";
2934
+ function isWeakSet(value) {
2935
+ return isObjectLike_default(value) && baseGetTag_default(value) == weakSetTag;
2936
+ }
2937
+ var isWeakSet_default = isWeakSet;
2938
+
2992
2939
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/join.js
2993
2940
  var arrayProto2 = Array.prototype;
2994
2941
  var nativeJoin = arrayProto2.join;
@@ -2997,12 +2944,44 @@ function join(array, separator) {
2997
2944
  }
2998
2945
  var join_default = join;
2999
2946
 
2947
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/keyBy.js
2948
+ var keyBy = createAggregator_default(function(result, value, key) {
2949
+ baseAssignValue_default(result, key, value);
2950
+ });
2951
+ var keyBy_default = keyBy;
2952
+
3000
2953
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/merge.js
3001
2954
  var merge = createAssigner_default(function(object, source, srcIndex) {
3002
2955
  baseMerge_default(object, source, srcIndex);
3003
2956
  });
3004
2957
  var merge_default = merge;
3005
2958
 
2959
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_baseSet.js
2960
+ function baseSet(object, path, value, customizer) {
2961
+ if (!isObject_default(object)) {
2962
+ return object;
2963
+ }
2964
+ path = castPath_default(path, object);
2965
+ var index = -1, length = path.length, lastIndex = length - 1, nested = object;
2966
+ while (nested != null && ++index < length) {
2967
+ var key = toKey_default(path[index]), newValue = value;
2968
+ if (key === "__proto__" || key === "constructor" || key === "prototype") {
2969
+ return object;
2970
+ }
2971
+ if (index != lastIndex) {
2972
+ var objValue = nested[key];
2973
+ newValue = customizer ? customizer(objValue, key, nested) : void 0;
2974
+ if (newValue === void 0) {
2975
+ newValue = isObject_default(objValue) ? objValue : isIndex_default(path[index + 1]) ? [] : {};
2976
+ }
2977
+ }
2978
+ assignValue_default(nested, key, newValue);
2979
+ nested = nested[key];
2980
+ }
2981
+ return object;
2982
+ }
2983
+ var baseSet_default = baseSet;
2984
+
3006
2985
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/_asciiSize.js
3007
2986
  var asciiSize = baseProperty_default("length");
3008
2987
  var asciiSize_default = asciiSize;
@@ -3043,6 +3022,12 @@ function stringSize(string) {
3043
3022
  }
3044
3023
  var stringSize_default = stringSize;
3045
3024
 
3025
+ // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/set.js
3026
+ function set(object, path, value) {
3027
+ return object == null ? object : baseSet_default(object, path, value);
3028
+ }
3029
+ var set_default = set;
3030
+
3046
3031
  // ../../node_modules/.pnpm/lodash-es@4.17.21/node_modules/lodash-es/truncate.js
3047
3032
  var DEFAULT_TRUNC_LENGTH = 30;
3048
3033
  var DEFAULT_TRUNC_OMISSION = "...";
@@ -3111,9 +3096,9 @@ function baseUniq(array, iteratee, comparator) {
3111
3096
  isCommon = false;
3112
3097
  includes = arrayIncludesWith_default;
3113
3098
  } else if (length >= LARGE_ARRAY_SIZE2) {
3114
- var set = iteratee ? null : createSet_default(array);
3115
- if (set) {
3116
- return setToArray_default(set);
3099
+ var set2 = iteratee ? null : createSet_default(array);
3100
+ if (set2) {
3101
+ return setToArray_default(set2);
3117
3102
  }
3118
3103
  isCommon = false;
3119
3104
  includes = cacheHas_default;
@@ -3166,6 +3151,161 @@ function uniqWith(array, comparator) {
3166
3151
  }
3167
3152
  var uniqWith_default = uniqWith;
3168
3153
 
3154
+ // src/is/index.ts
3155
+ var isBrowser = () => typeof window !== "undefined";
3156
+ var isWeex = () => typeof WXEnvironment !== "undefined" && !!WXEnvironment.platform;
3157
+ var weexPlatform = () => isWeex() && WXEnvironment.platform.toLowerCase();
3158
+ var UA = () => isBrowser() && window.navigator.userAgent.toLowerCase() || "";
3159
+ var isIE = () => UA() && /msie|trident/.test(UA());
3160
+ var isIE9 = () => UA() && UA().indexOf("msie 9.0") > 0;
3161
+ var isIE11 = () => isBrowser() && navigator.userAgent.includes("Trident") && navigator.userAgent.includes("rv:11.0");
3162
+ var isEdge = () => UA() && UA().indexOf("edge/") > 0;
3163
+ var isAndroid = () => UA() && UA().indexOf("android") > 0 || weexPlatform() === "android";
3164
+ var isIOS = () => UA() && /iphone|ipad|ipod|ios/.test(UA()) || weexPlatform() === "ios";
3165
+ var isChrome = () => UA() && /chrome\/\d+/.test(UA()) && !isEdge();
3166
+ var isPhantomJS = () => UA() && /phantomjs/.test(UA());
3167
+ var isFF = () => typeof UA() === "string" && UA().match(/firefox\/(\d+)/);
3168
+ var isMobile = () => isBrowser() && navigator.userAgent.toLowerCase().includes("mobile");
3169
+ var isFormData = (value) => isObject_default(value) && isBrowser() && value instanceof FormData;
3170
+ var isWindow = (value) => typeof window !== "undefined" && toString.call(value) === "[object Window]";
3171
+ var isTruthy = (value) => Boolean(value);
3172
+
3173
+ // ../../node_modules/.pnpm/change-case@5.4.4/node_modules/change-case/dist/index.js
3174
+ var SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
3175
+ var SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
3176
+ var SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
3177
+ var DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
3178
+ var SPLIT_REPLACE_VALUE = "$1\0$2";
3179
+ var DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
3180
+ function split(value) {
3181
+ let result = value.trim();
3182
+ result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
3183
+ result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
3184
+ let start = 0;
3185
+ let end = result.length;
3186
+ while (result.charAt(start) === "\0")
3187
+ start++;
3188
+ if (start === end)
3189
+ return [];
3190
+ while (result.charAt(end - 1) === "\0")
3191
+ end--;
3192
+ return result.slice(start, end).split(/\0/g);
3193
+ }
3194
+ function splitSeparateNumbers(value) {
3195
+ const words = split(value);
3196
+ for (let i = 0; i < words.length; i++) {
3197
+ const word = words[i];
3198
+ const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
3199
+ if (match) {
3200
+ const offset = match.index + (match[1] ?? match[2]).length;
3201
+ words.splice(i, 1, word.slice(0, offset), word.slice(offset));
3202
+ }
3203
+ }
3204
+ return words;
3205
+ }
3206
+ function noCase(input, options) {
3207
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
3208
+ return prefix + words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? " ") + suffix;
3209
+ }
3210
+ function camelCase(input, options) {
3211
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
3212
+ const lower = lowerFactory(options?.locale);
3213
+ const upper = upperFactory(options?.locale);
3214
+ const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
3215
+ return prefix + words.map((word, index) => {
3216
+ if (index === 0)
3217
+ return lower(word);
3218
+ return transform(word, index);
3219
+ }).join(options?.delimiter ?? "") + suffix;
3220
+ }
3221
+ function pascalCase(input, options) {
3222
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
3223
+ const lower = lowerFactory(options?.locale);
3224
+ const upper = upperFactory(options?.locale);
3225
+ const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
3226
+ return prefix + words.map(transform).join(options?.delimiter ?? "") + suffix;
3227
+ }
3228
+ function pascalSnakeCase(input, options) {
3229
+ return capitalCase(input, { delimiter: "_", ...options });
3230
+ }
3231
+ function capitalCase(input, options) {
3232
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
3233
+ const lower = lowerFactory(options?.locale);
3234
+ const upper = upperFactory(options?.locale);
3235
+ return prefix + words.map(capitalCaseTransformFactory(lower, upper)).join(options?.delimiter ?? " ") + suffix;
3236
+ }
3237
+ function constantCase(input, options) {
3238
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
3239
+ return prefix + words.map(upperFactory(options?.locale)).join(options?.delimiter ?? "_") + suffix;
3240
+ }
3241
+ function dotCase(input, options) {
3242
+ return noCase(input, { delimiter: ".", ...options });
3243
+ }
3244
+ function kebabCase(input, options) {
3245
+ return noCase(input, { delimiter: "-", ...options });
3246
+ }
3247
+ function pathCase(input, options) {
3248
+ return noCase(input, { delimiter: "/", ...options });
3249
+ }
3250
+ function sentenceCase(input, options) {
3251
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
3252
+ const lower = lowerFactory(options?.locale);
3253
+ const upper = upperFactory(options?.locale);
3254
+ const transform = capitalCaseTransformFactory(lower, upper);
3255
+ return prefix + words.map((word, index) => {
3256
+ if (index === 0)
3257
+ return transform(word);
3258
+ return lower(word);
3259
+ }).join(options?.delimiter ?? " ") + suffix;
3260
+ }
3261
+ function snakeCase(input, options) {
3262
+ return noCase(input, { delimiter: "_", ...options });
3263
+ }
3264
+ function trainCase(input, options) {
3265
+ return capitalCase(input, { delimiter: "-", ...options });
3266
+ }
3267
+ function lowerFactory(locale) {
3268
+ return locale === false ? (input) => input.toLowerCase() : (input) => input.toLocaleLowerCase(locale);
3269
+ }
3270
+ function upperFactory(locale) {
3271
+ return locale === false ? (input) => input.toUpperCase() : (input) => input.toLocaleUpperCase(locale);
3272
+ }
3273
+ function capitalCaseTransformFactory(lower, upper) {
3274
+ return (word) => `${upper(word[0])}${lower(word.slice(1))}`;
3275
+ }
3276
+ function pascalCaseTransformFactory(lower, upper) {
3277
+ return (word, index) => {
3278
+ const char0 = word[0];
3279
+ const initial = index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0);
3280
+ return initial + lower(word.slice(1));
3281
+ };
3282
+ }
3283
+ function splitPrefixSuffix(input, options = {}) {
3284
+ const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
3285
+ const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
3286
+ const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
3287
+ let prefixIndex = 0;
3288
+ let suffixIndex = input.length;
3289
+ while (prefixIndex < input.length) {
3290
+ const char = input.charAt(prefixIndex);
3291
+ if (!prefixCharacters.includes(char))
3292
+ break;
3293
+ prefixIndex++;
3294
+ }
3295
+ while (suffixIndex > prefixIndex) {
3296
+ const index = suffixIndex - 1;
3297
+ const char = input.charAt(index);
3298
+ if (!suffixCharacters.includes(char))
3299
+ break;
3300
+ suffixIndex = index;
3301
+ }
3302
+ return [
3303
+ input.slice(0, prefixIndex),
3304
+ splitFn(input.slice(prefixIndex, suffixIndex)),
3305
+ input.slice(suffixIndex)
3306
+ ];
3307
+ }
3308
+
3169
3309
  // src/number/index.ts
3170
3310
  var import_bignumber = __toESM(require("bignumber.js"), 1);
3171
3311
  var BIG_INTS = {
@@ -3296,6 +3436,51 @@ function formatSize(dimension, unit) {
3296
3436
  function cover(value, mode, symbol = "*") {
3297
3437
  return value.slice(0, mode[0]) + symbol.repeat(mode[1]) + value.slice(-mode[2]);
3298
3438
  }
3439
+ function slash(str) {
3440
+ return str.replace(/\\/g, "/");
3441
+ }
3442
+ function ensurePrefix(prefix, str) {
3443
+ if (!str.startsWith(prefix))
3444
+ return prefix + str;
3445
+ return str;
3446
+ }
3447
+ function ensureSuffix(suffix, str) {
3448
+ if (!str.endsWith(suffix))
3449
+ return str + suffix;
3450
+ return str;
3451
+ }
3452
+ function template(str, ...args) {
3453
+ const [firstArg, fallback] = args;
3454
+ if (isObject_default(firstArg)) {
3455
+ const vars = firstArg;
3456
+ return str.replace(/\{(\w+)\}/g, (_, key) => vars[key] || ((typeof fallback === "function" ? fallback(key) : fallback) ?? key));
3457
+ } else {
3458
+ return str.replace(/\{(\d+)\}/g, (_, key) => {
3459
+ const index = Number(key);
3460
+ if (Number.isNaN(index))
3461
+ return key;
3462
+ return args[index];
3463
+ });
3464
+ }
3465
+ }
3466
+ var _reFullWs = /^\s*$/;
3467
+ function unindent(str) {
3468
+ const lines = (typeof str === "string" ? str : str[0]).split("\n");
3469
+ const whitespaceLines = lines.map((line) => _reFullWs.test(line));
3470
+ const commonIndent = lines.reduce((min, line, idx) => {
3471
+ if (whitespaceLines[idx])
3472
+ return min;
3473
+ const indent = line.match(/^\s*/)?.[0].length;
3474
+ return indent === void 0 ? min : Math.min(min, indent);
3475
+ }, Number.POSITIVE_INFINITY);
3476
+ let emptyLinesHead = 0;
3477
+ while (emptyLinesHead < lines.length && whitespaceLines[emptyLinesHead])
3478
+ emptyLinesHead++;
3479
+ let emptyLinesTail = 0;
3480
+ while (emptyLinesTail < lines.length && whitespaceLines[lines.length - emptyLinesTail - 1])
3481
+ emptyLinesTail++;
3482
+ return lines.slice(emptyLinesHead, lines.length - emptyLinesTail).map((line) => line.slice(commonIndent)).join("\n");
3483
+ }
3299
3484
 
3300
3485
  // src/typeof/index.ts
3301
3486
  function getTypeof(target) {
@@ -3366,25 +3551,6 @@ function delay(ms) {
3366
3551
  return new Promise((resolve) => setTimeout(resolve, ms));
3367
3552
  }
3368
3553
 
3369
- // src/util/is.ts
3370
- var isBrowser = () => typeof window !== "undefined";
3371
- var isWeex = () => typeof WXEnvironment !== "undefined" && !!WXEnvironment.platform;
3372
- var weexPlatform = () => isWeex() && WXEnvironment.platform.toLowerCase();
3373
- var UA = () => isBrowser() && window.navigator.userAgent.toLowerCase() || "";
3374
- var isIE = () => UA() && /msie|trident/.test(UA());
3375
- var isIE9 = () => UA() && UA().indexOf("msie 9.0") > 0;
3376
- var isIE11 = () => isBrowser() && navigator.userAgent.includes("Trident") && navigator.userAgent.includes("rv:11.0");
3377
- var isEdge = () => UA() && UA().indexOf("edge/") > 0;
3378
- var isAndroid = () => UA() && UA().indexOf("android") > 0 || weexPlatform() === "android";
3379
- var isIOS = () => UA() && /iphone|ipad|ipod|ios/.test(UA()) || weexPlatform() === "ios";
3380
- var isChrome = () => UA() && /chrome\/\d+/.test(UA()) && !isEdge();
3381
- var isPhantomJS = () => UA() && /phantomjs/.test(UA());
3382
- var isFF = () => typeof UA() === "string" && UA().match(/firefox\/(\d+)/);
3383
- var isMobile = () => isBrowser() && navigator.userAgent.toLowerCase().includes("mobile");
3384
- var isFormData = (value) => isObject_default(value) && isBrowser() && value instanceof FormData;
3385
- var isWindow = (value) => typeof window !== "undefined" && toString.call(value) === "[object Window]";
3386
- var isTruthy = (value) => Boolean(value);
3387
-
3388
3554
  // src/util/json.ts
3389
3555
  function jsonTryParse(text) {
3390
3556
  try {
@@ -3467,12 +3633,21 @@ proxy.resolve = (target) => {
3467
3633
  };
3468
3634
 
3469
3635
  // src/util/random.ts
3470
- function randomNumer(min, max) {
3471
- return Math.random() * (max - min) + min;
3472
- }
3473
3636
  function randomArray(array) {
3474
3637
  return array[Math.floor(Math.random() * array.length)];
3475
3638
  }
3639
+ function randomNumber(min, max) {
3640
+ return Math.random() * (max - min) + min;
3641
+ }
3642
+ var urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
3643
+ function randomString(size, chars = urlAlphabet) {
3644
+ let id = "";
3645
+ let i = size;
3646
+ const len = chars.length;
3647
+ while (i--)
3648
+ id += chars[Math.random() * len | 0];
3649
+ return id;
3650
+ }
3476
3651
 
3477
3652
  // src/util/to.ts
3478
3653
  async function to(promise, error) {
@@ -3535,6 +3710,8 @@ function call(fn, ...args) {
3535
3710
  dotCase,
3536
3711
  downloadBlobFile,
3537
3712
  downloadNetworkFile,
3713
+ ensurePrefix,
3714
+ ensureSuffix,
3538
3715
  find,
3539
3716
  formToObject,
3540
3717
  formatNumeric,
@@ -3546,15 +3723,21 @@ function call(fn, ...args) {
3546
3723
  gte,
3547
3724
  integer,
3548
3725
  isAndroid,
3726
+ isArguments,
3549
3727
  isArray,
3728
+ isArrayBuffer,
3550
3729
  isArrayLike,
3730
+ isArrayLikeObject,
3551
3731
  isBoolean,
3552
3732
  isBrowser,
3733
+ isBuffer,
3553
3734
  isChrome,
3554
3735
  isDate,
3555
3736
  isEdge,
3737
+ isElement,
3556
3738
  isEmpty,
3557
3739
  isEqual,
3740
+ isEqualWith,
3558
3741
  isError,
3559
3742
  isFF,
3560
3743
  isFormData,
@@ -3563,23 +3746,34 @@ function call(fn, ...args) {
3563
3746
  isIE11,
3564
3747
  isIE9,
3565
3748
  isIOS,
3749
+ isInteger,
3750
+ isMap,
3751
+ isMatch,
3752
+ isMatchWith,
3566
3753
  isMobile,
3567
3754
  isNaN,
3568
3755
  isNative,
3569
3756
  isNull,
3570
3757
  isNumber,
3571
3758
  isObject,
3759
+ isObjectLike,
3572
3760
  isPhantomJS,
3573
3761
  isPlainObject,
3762
+ isRegexp,
3763
+ isSet,
3574
3764
  isString,
3765
+ isSymbol,
3575
3766
  isTruthy,
3576
3767
  isTypeof,
3577
3768
  isUndefined,
3769
+ isWeakMap,
3770
+ isWeakSet,
3578
3771
  isWeex,
3579
3772
  isWindow,
3580
3773
  join,
3581
3774
  jsonTryParse,
3582
3775
  kebabCase,
3776
+ keyBy,
3583
3777
  keys,
3584
3778
  loop,
3585
3779
  lt,
@@ -3601,18 +3795,23 @@ function call(fn, ...args) {
3601
3795
  plus,
3602
3796
  proxy,
3603
3797
  randomArray,
3604
- randomNumer,
3798
+ randomNumber,
3799
+ randomString,
3605
3800
  readFileReader,
3606
3801
  redirectTo,
3607
3802
  riposte,
3608
3803
  selectImages,
3609
3804
  sentenceCase,
3805
+ set,
3610
3806
  showOpenFilePicker,
3611
3807
  showOpenImagePicker,
3808
+ slash,
3612
3809
  snakeCase,
3810
+ template,
3613
3811
  to,
3614
3812
  trainCase,
3615
3813
  truncate,
3814
+ unindent,
3616
3815
  uniq,
3617
3816
  uniqBy,
3618
3817
  uniqWith,