mazey 3.7.4 → 3.8.1

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/lib/index.esm.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * mazey v3.7.4
2
+ * mazey v3.8.1
3
3
  * (c) 2018-2023 Mazey Chu
4
4
  * Released under the MIT License.
5
5
  */
@@ -70,19 +70,19 @@ var functionCall = functionBindNative ? call$2.bind(call$2) : function () {
70
70
  return call$2.apply(call$2, arguments);
71
71
  };
72
72
 
73
- var $propertyIsEnumerable = {}.propertyIsEnumerable;
73
+ var $propertyIsEnumerable$1 = {}.propertyIsEnumerable;
74
74
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
75
75
  var getOwnPropertyDescriptor$4 = Object.getOwnPropertyDescriptor;
76
76
 
77
77
  // Nashorn ~ JDK8 bug
78
- var NASHORN_BUG = getOwnPropertyDescriptor$4 && !$propertyIsEnumerable.call({ 1: 2 }, 1);
78
+ var NASHORN_BUG = getOwnPropertyDescriptor$4 && !$propertyIsEnumerable$1.call({ 1: 2 }, 1);
79
79
 
80
80
  // `Object.prototype.propertyIsEnumerable` method implementation
81
81
  // https://tc39.es/ecma262/#sec-object.prototype.propertyisenumerable
82
82
  var f$6 = NASHORN_BUG ? function propertyIsEnumerable(V) {
83
83
  var descriptor = getOwnPropertyDescriptor$4(this, V);
84
84
  return !!descriptor && descriptor.enumerable;
85
- } : $propertyIsEnumerable;
85
+ } : $propertyIsEnumerable$1;
86
86
 
87
87
  var objectPropertyIsEnumerable = {
88
88
  f: f$6
@@ -697,7 +697,7 @@ var lengthOfArrayLike = function (obj) {
697
697
  };
698
698
 
699
699
  // `Array.prototype.{ indexOf, includes }` methods implementation
700
- var createMethod$4 = function (IS_INCLUDES) {
700
+ var createMethod$5 = function (IS_INCLUDES) {
701
701
  return function ($this, el, fromIndex) {
702
702
  var O = toIndexedObject($this);
703
703
  var length = lengthOfArrayLike(O);
@@ -719,26 +719,26 @@ var createMethod$4 = function (IS_INCLUDES) {
719
719
  var arrayIncludes = {
720
720
  // `Array.prototype.includes` method
721
721
  // https://tc39.es/ecma262/#sec-array.prototype.includes
722
- includes: createMethod$4(true),
722
+ includes: createMethod$5(true),
723
723
  // `Array.prototype.indexOf` method
724
724
  // https://tc39.es/ecma262/#sec-array.prototype.indexof
725
- indexOf: createMethod$4(false)
725
+ indexOf: createMethod$5(false)
726
726
  };
727
727
 
728
728
  var indexOf$1 = arrayIncludes.indexOf;
729
729
 
730
730
 
731
- var push$3 = functionUncurryThis([].push);
731
+ var push$4 = functionUncurryThis([].push);
732
732
 
733
733
  var objectKeysInternal = function (object, names) {
734
734
  var O = toIndexedObject(object);
735
735
  var i = 0;
736
736
  var result = [];
737
737
  var key;
738
- for (key in O) !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push$3(result, key);
738
+ for (key in O) !hasOwnProperty_1(hiddenKeys$1, key) && hasOwnProperty_1(O, key) && push$4(result, key);
739
739
  // Don't enum bug & hidden keys
740
740
  while (names.length > i) if (hasOwnProperty_1(O, key = names[i++])) {
741
- ~indexOf$1(result, key) || push$3(result, key);
741
+ ~indexOf$1(result, key) || push$4(result, key);
742
742
  }
743
743
  return result;
744
744
  };
@@ -1795,7 +1795,7 @@ var charAt$4 = functionUncurryThis(''.charAt);
1795
1795
  var charCodeAt$1 = functionUncurryThis(''.charCodeAt);
1796
1796
  var stringSlice$5 = functionUncurryThis(''.slice);
1797
1797
 
1798
- var createMethod$3 = function (CONVERT_TO_STRING) {
1798
+ var createMethod$4 = function (CONVERT_TO_STRING) {
1799
1799
  return function ($this, pos) {
1800
1800
  var S = toString_1(requireObjectCoercible($this));
1801
1801
  var position = toIntegerOrInfinity(pos);
@@ -1817,10 +1817,10 @@ var createMethod$3 = function (CONVERT_TO_STRING) {
1817
1817
  var stringMultibyte = {
1818
1818
  // `String.prototype.codePointAt` method
1819
1819
  // https://tc39.es/ecma262/#sec-string.prototype.codepointat
1820
- codeAt: createMethod$3(false),
1820
+ codeAt: createMethod$4(false),
1821
1821
  // `String.prototype.at` method
1822
1822
  // https://github.com/mathiasbynens/String.prototype.at
1823
- charAt: createMethod$3(true)
1823
+ charAt: createMethod$4(true)
1824
1824
  };
1825
1825
 
1826
1826
  var charAt$3 = stringMultibyte.charAt;
@@ -1975,7 +1975,7 @@ var REPLACE = wellKnownSymbol('replace');
1975
1975
  var max$3 = Math.max;
1976
1976
  var min$2 = Math.min;
1977
1977
  var concat$1 = functionUncurryThis([].concat);
1978
- var push$2 = functionUncurryThis([].push);
1978
+ var push$3 = functionUncurryThis([].push);
1979
1979
  var stringIndexOf$1 = functionUncurryThis(''.indexOf);
1980
1980
  var stringSlice$3 = functionUncurryThis(''.slice);
1981
1981
 
@@ -2051,7 +2051,7 @@ fixRegexpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa
2051
2051
  var result = regexpExecAbstract(rx, S);
2052
2052
  if (result === null) break;
2053
2053
 
2054
- push$2(results, result);
2054
+ push$3(results, result);
2055
2055
  if (!global) break;
2056
2056
 
2057
2057
  var matchStr = toString_1(result[0]);
@@ -2071,11 +2071,11 @@ fixRegexpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa
2071
2071
  // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
2072
2072
  // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
2073
2073
  // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
2074
- for (var j = 1; j < result.length; j++) push$2(captures, maybeToString(result[j]));
2074
+ for (var j = 1; j < result.length; j++) push$3(captures, maybeToString(result[j]));
2075
2075
  var namedCaptures = result.groups;
2076
2076
  if (functionalReplace) {
2077
2077
  var replacerArgs = concat$1([matched], captures, position, S);
2078
- if (namedCaptures !== undefined) push$2(replacerArgs, namedCaptures);
2078
+ if (namedCaptures !== undefined) push$3(replacerArgs, namedCaptures);
2079
2079
  var replacement = toString_1(functionApply(replaceValue, undefined, replacerArgs));
2080
2080
  } else {
2081
2081
  replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
@@ -2124,7 +2124,7 @@ _export({ target: 'Array', proto: true, forced: FORCED$5 }, {
2124
2124
  var $TypeError$9 = TypeError;
2125
2125
 
2126
2126
  // `Array.prototype.{ reduce, reduceRight }` methods implementation
2127
- var createMethod$2 = function (IS_RIGHT) {
2127
+ var createMethod$3 = function (IS_RIGHT) {
2128
2128
  return function (that, callbackfn, argumentsLength, memo) {
2129
2129
  aCallable(callbackfn);
2130
2130
  var O = toObject(that);
@@ -2153,10 +2153,10 @@ var createMethod$2 = function (IS_RIGHT) {
2153
2153
  var arrayReduce = {
2154
2154
  // `Array.prototype.reduce` method
2155
2155
  // https://tc39.es/ecma262/#sec-array.prototype.reduce
2156
- left: createMethod$2(false),
2156
+ left: createMethod$3(false),
2157
2157
  // `Array.prototype.reduceRight` method
2158
2158
  // https://tc39.es/ecma262/#sec-array.prototype.reduceright
2159
- right: createMethod$2(true)
2159
+ right: createMethod$3(true)
2160
2160
  };
2161
2161
 
2162
2162
  var engineIsNode = typeof process != 'undefined' && classofRaw(process) == 'process';
@@ -2231,6 +2231,160 @@ _export({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT$1 }, {
2231
2231
  }
2232
2232
  });
2233
2233
 
2234
+ var $propertyIsEnumerable = objectPropertyIsEnumerable.f;
2235
+
2236
+ var propertyIsEnumerable = functionUncurryThis($propertyIsEnumerable);
2237
+ var push$2 = functionUncurryThis([].push);
2238
+
2239
+ // `Object.{ entries, values }` methods implementation
2240
+ var createMethod$2 = function (TO_ENTRIES) {
2241
+ return function (it) {
2242
+ var O = toIndexedObject(it);
2243
+ var keys = objectKeys(O);
2244
+ var length = keys.length;
2245
+ var i = 0;
2246
+ var result = [];
2247
+ var key;
2248
+ while (length > i) {
2249
+ key = keys[i++];
2250
+ if (!descriptors || propertyIsEnumerable(O, key)) {
2251
+ push$2(result, TO_ENTRIES ? [key, O[key]] : O[key]);
2252
+ }
2253
+ }
2254
+ return result;
2255
+ };
2256
+ };
2257
+
2258
+ var objectToArray = {
2259
+ // `Object.entries` method
2260
+ // https://tc39.es/ecma262/#sec-object.entries
2261
+ entries: createMethod$2(true),
2262
+ // `Object.values` method
2263
+ // https://tc39.es/ecma262/#sec-object.values
2264
+ values: createMethod$2(false)
2265
+ };
2266
+
2267
+ var $values = objectToArray.values;
2268
+
2269
+ // `Object.values` method
2270
+ // https://tc39.es/ecma262/#sec-object.values
2271
+ _export({ target: 'Object', stat: true }, {
2272
+ values: function values(O) {
2273
+ return $values(O);
2274
+ }
2275
+ });
2276
+
2277
+ var bind$1 = functionUncurryThisClause(functionUncurryThisClause.bind);
2278
+
2279
+ // optional / simple context binding
2280
+ var functionBindContext = function (fn, that) {
2281
+ aCallable(fn);
2282
+ return that === undefined ? fn : functionBindNative ? bind$1(fn, that) : function (/* ...args */) {
2283
+ return fn.apply(that, arguments);
2284
+ };
2285
+ };
2286
+
2287
+ var push$1 = functionUncurryThis([].push);
2288
+
2289
+ // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
2290
+ var createMethod$1 = function (TYPE) {
2291
+ var IS_MAP = TYPE == 1;
2292
+ var IS_FILTER = TYPE == 2;
2293
+ var IS_SOME = TYPE == 3;
2294
+ var IS_EVERY = TYPE == 4;
2295
+ var IS_FIND_INDEX = TYPE == 6;
2296
+ var IS_FILTER_REJECT = TYPE == 7;
2297
+ var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
2298
+ return function ($this, callbackfn, that, specificCreate) {
2299
+ var O = toObject($this);
2300
+ var self = indexedObject(O);
2301
+ var boundFunction = functionBindContext(callbackfn, that);
2302
+ var length = lengthOfArrayLike(self);
2303
+ var index = 0;
2304
+ var create = specificCreate || arraySpeciesCreate;
2305
+ var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
2306
+ var value, result;
2307
+ for (;length > index; index++) if (NO_HOLES || index in self) {
2308
+ value = self[index];
2309
+ result = boundFunction(value, index, O);
2310
+ if (TYPE) {
2311
+ if (IS_MAP) target[index] = result; // map
2312
+ else if (result) switch (TYPE) {
2313
+ case 3: return true; // some
2314
+ case 5: return value; // find
2315
+ case 6: return index; // findIndex
2316
+ case 2: push$1(target, value); // filter
2317
+ } else switch (TYPE) {
2318
+ case 4: return false; // every
2319
+ case 7: push$1(target, value); // filterReject
2320
+ }
2321
+ }
2322
+ }
2323
+ return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
2324
+ };
2325
+ };
2326
+
2327
+ var arrayIteration = {
2328
+ // `Array.prototype.forEach` method
2329
+ // https://tc39.es/ecma262/#sec-array.prototype.foreach
2330
+ forEach: createMethod$1(0),
2331
+ // `Array.prototype.map` method
2332
+ // https://tc39.es/ecma262/#sec-array.prototype.map
2333
+ map: createMethod$1(1),
2334
+ // `Array.prototype.filter` method
2335
+ // https://tc39.es/ecma262/#sec-array.prototype.filter
2336
+ filter: createMethod$1(2),
2337
+ // `Array.prototype.some` method
2338
+ // https://tc39.es/ecma262/#sec-array.prototype.some
2339
+ some: createMethod$1(3),
2340
+ // `Array.prototype.every` method
2341
+ // https://tc39.es/ecma262/#sec-array.prototype.every
2342
+ every: createMethod$1(4),
2343
+ // `Array.prototype.find` method
2344
+ // https://tc39.es/ecma262/#sec-array.prototype.find
2345
+ find: createMethod$1(5),
2346
+ // `Array.prototype.findIndex` method
2347
+ // https://tc39.es/ecma262/#sec-array.prototype.findIndex
2348
+ findIndex: createMethod$1(6),
2349
+ // `Array.prototype.filterReject` method
2350
+ // https://github.com/tc39/proposal-array-filtering
2351
+ filterReject: createMethod$1(7)
2352
+ };
2353
+
2354
+ var $every = arrayIteration.every;
2355
+
2356
+
2357
+ var STRICT_METHOD$1 = arrayMethodIsStrict('every');
2358
+
2359
+ // `Array.prototype.every` method
2360
+ // https://tc39.es/ecma262/#sec-array.prototype.every
2361
+ _export({ target: 'Array', proto: true, forced: !STRICT_METHOD$1 }, {
2362
+ every: function every(callbackfn /* , thisArg */) {
2363
+ return $every(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
2364
+ }
2365
+ });
2366
+
2367
+ var $includes = arrayIncludes.includes;
2368
+
2369
+
2370
+
2371
+ // FF99+ bug
2372
+ var BROKEN_ON_SPARSE = fails(function () {
2373
+ // eslint-disable-next-line es/no-array-prototype-includes -- detection
2374
+ return !Array(1).includes();
2375
+ });
2376
+
2377
+ // `Array.prototype.includes` method
2378
+ // https://tc39.es/ecma262/#sec-array.prototype.includes
2379
+ _export({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
2380
+ includes: function includes(el /* , fromIndex = 0 */) {
2381
+ return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
2382
+ }
2383
+ });
2384
+
2385
+ // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
2386
+ addToUnscopables('includes');
2387
+
2234
2388
  // `thisNumberValue` abstract operation
2235
2389
  // https://tc39.es/ecma262/#sec-thisnumbervalue
2236
2390
  var thisNumberValue = functionUncurryThis(1.0.valueOf);
@@ -2381,7 +2535,7 @@ var ltrim = RegExp('^[' + whitespaces + ']+');
2381
2535
  var rtrim = RegExp('(^|[^' + whitespaces + '])[' + whitespaces + ']+$');
2382
2536
 
2383
2537
  // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
2384
- var createMethod$1 = function (TYPE) {
2538
+ var createMethod = function (TYPE) {
2385
2539
  return function ($this) {
2386
2540
  var string = toString_1(requireObjectCoercible($this));
2387
2541
  if (TYPE & 1) string = replace(string, ltrim, '');
@@ -2393,13 +2547,13 @@ var createMethod$1 = function (TYPE) {
2393
2547
  var stringTrim = {
2394
2548
  // `String.prototype.{ trimLeft, trimStart }` methods
2395
2549
  // https://tc39.es/ecma262/#sec-string.prototype.trimstart
2396
- start: createMethod$1(1),
2550
+ start: createMethod(1),
2397
2551
  // `String.prototype.{ trimRight, trimEnd }` methods
2398
2552
  // https://tc39.es/ecma262/#sec-string.prototype.trimend
2399
- end: createMethod$1(2),
2553
+ end: createMethod(2),
2400
2554
  // `String.prototype.trim` method
2401
2555
  // https://tc39.es/ecma262/#sec-string.prototype.trim
2402
- trim: createMethod$1(3)
2556
+ trim: createMethod(3)
2403
2557
  };
2404
2558
 
2405
2559
  var trim$1 = stringTrim.trim;
@@ -2463,7 +2617,7 @@ var MAX_UINT32 = 0xFFFFFFFF;
2463
2617
  var min$1 = Math.min;
2464
2618
  var $push = [].push;
2465
2619
  var exec = functionUncurryThis(/./.exec);
2466
- var push$1 = functionUncurryThis($push);
2620
+ var push = functionUncurryThis($push);
2467
2621
  var stringSlice$1 = functionUncurryThis(''.slice);
2468
2622
 
2469
2623
  // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
@@ -2512,7 +2666,7 @@ fixRegexpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa
2512
2666
  while (match = functionCall(regexpExec, separatorCopy, string)) {
2513
2667
  lastIndex = separatorCopy.lastIndex;
2514
2668
  if (lastIndex > lastLastIndex) {
2515
- push$1(output, stringSlice$1(string, lastLastIndex, match.index));
2669
+ push(output, stringSlice$1(string, lastLastIndex, match.index));
2516
2670
  if (match.length > 1 && match.index < string.length) functionApply($push, output, arraySliceSimple(match, 1));
2517
2671
  lastLength = match[0].length;
2518
2672
  lastLastIndex = lastIndex;
@@ -2521,8 +2675,8 @@ fixRegexpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa
2521
2675
  if (separatorCopy.lastIndex === match.index) separatorCopy.lastIndex++; // Avoid an infinite loop
2522
2676
  }
2523
2677
  if (lastLastIndex === string.length) {
2524
- if (lastLength || !exec(separatorCopy, '')) push$1(output, '');
2525
- } else push$1(output, stringSlice$1(string, lastLastIndex));
2678
+ if (lastLength || !exec(separatorCopy, '')) push(output, '');
2679
+ } else push(output, stringSlice$1(string, lastLastIndex));
2526
2680
  return output.length > lim ? arraySliceSimple(output, 0, lim) : output;
2527
2681
  };
2528
2682
  // Chakra, V8
@@ -2581,16 +2735,16 @@ fixRegexpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa
2581
2735
  ) {
2582
2736
  q = advanceStringIndex(S, q, unicodeMatching);
2583
2737
  } else {
2584
- push$1(A, stringSlice$1(S, p, q));
2738
+ push(A, stringSlice$1(S, p, q));
2585
2739
  if (A.length === lim) return A;
2586
2740
  for (var i = 1; i <= z.length - 1; i++) {
2587
- push$1(A, z[i]);
2741
+ push(A, z[i]);
2588
2742
  if (A.length === lim) return A;
2589
2743
  }
2590
2744
  q = p = e;
2591
2745
  }
2592
2746
  }
2593
- push$1(A, stringSlice$1(S, p));
2747
+ push(A, stringSlice$1(S, p));
2594
2748
  return A;
2595
2749
  }
2596
2750
  ];
@@ -2761,16 +2915,6 @@ var anInstance = function (it, Prototype) {
2761
2915
  throw $TypeError$7('Incorrect invocation');
2762
2916
  };
2763
2917
 
2764
- var bind$1 = functionUncurryThisClause(functionUncurryThisClause.bind);
2765
-
2766
- // optional / simple context binding
2767
- var functionBindContext = function (fn, that) {
2768
- aCallable(fn);
2769
- return that === undefined ? fn : functionBindNative ? bind$1(fn, that) : function (/* ...args */) {
2770
- return fn.apply(that, arguments);
2771
- };
2772
- };
2773
-
2774
2918
  var $TypeError$6 = TypeError;
2775
2919
 
2776
2920
  var validateArgumentsLength = function (passed, required) {
@@ -3641,73 +3785,6 @@ _export({ target: 'Array', proto: true, forced: FORCED }, {
3641
3785
  }
3642
3786
  });
3643
3787
 
3644
- var push = functionUncurryThis([].push);
3645
-
3646
- // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation
3647
- var createMethod = function (TYPE) {
3648
- var IS_MAP = TYPE == 1;
3649
- var IS_FILTER = TYPE == 2;
3650
- var IS_SOME = TYPE == 3;
3651
- var IS_EVERY = TYPE == 4;
3652
- var IS_FIND_INDEX = TYPE == 6;
3653
- var IS_FILTER_REJECT = TYPE == 7;
3654
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
3655
- return function ($this, callbackfn, that, specificCreate) {
3656
- var O = toObject($this);
3657
- var self = indexedObject(O);
3658
- var boundFunction = functionBindContext(callbackfn, that);
3659
- var length = lengthOfArrayLike(self);
3660
- var index = 0;
3661
- var create = specificCreate || arraySpeciesCreate;
3662
- var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined;
3663
- var value, result;
3664
- for (;length > index; index++) if (NO_HOLES || index in self) {
3665
- value = self[index];
3666
- result = boundFunction(value, index, O);
3667
- if (TYPE) {
3668
- if (IS_MAP) target[index] = result; // map
3669
- else if (result) switch (TYPE) {
3670
- case 3: return true; // some
3671
- case 5: return value; // find
3672
- case 6: return index; // findIndex
3673
- case 2: push(target, value); // filter
3674
- } else switch (TYPE) {
3675
- case 4: return false; // every
3676
- case 7: push(target, value); // filterReject
3677
- }
3678
- }
3679
- }
3680
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : target;
3681
- };
3682
- };
3683
-
3684
- var arrayIteration = {
3685
- // `Array.prototype.forEach` method
3686
- // https://tc39.es/ecma262/#sec-array.prototype.foreach
3687
- forEach: createMethod(0),
3688
- // `Array.prototype.map` method
3689
- // https://tc39.es/ecma262/#sec-array.prototype.map
3690
- map: createMethod(1),
3691
- // `Array.prototype.filter` method
3692
- // https://tc39.es/ecma262/#sec-array.prototype.filter
3693
- filter: createMethod(2),
3694
- // `Array.prototype.some` method
3695
- // https://tc39.es/ecma262/#sec-array.prototype.some
3696
- some: createMethod(3),
3697
- // `Array.prototype.every` method
3698
- // https://tc39.es/ecma262/#sec-array.prototype.every
3699
- every: createMethod(4),
3700
- // `Array.prototype.find` method
3701
- // https://tc39.es/ecma262/#sec-array.prototype.find
3702
- find: createMethod(5),
3703
- // `Array.prototype.findIndex` method
3704
- // https://tc39.es/ecma262/#sec-array.prototype.findIndex
3705
- findIndex: createMethod(6),
3706
- // `Array.prototype.filterReject` method
3707
- // https://github.com/tc39/proposal-array-filtering
3708
- filterReject: createMethod(7)
3709
- };
3710
-
3711
3788
  var $forEach = arrayIteration.forEach;
3712
3789
 
3713
3790
 
@@ -3831,27 +3908,6 @@ _export({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES, sham: !corr
3831
3908
  }
3832
3909
  });
3833
3910
 
3834
- var $includes = arrayIncludes.includes;
3835
-
3836
-
3837
-
3838
- // FF99+ bug
3839
- var BROKEN_ON_SPARSE = fails(function () {
3840
- // eslint-disable-next-line es/no-array-prototype-includes -- detection
3841
- return !Array(1).includes();
3842
- });
3843
-
3844
- // `Array.prototype.includes` method
3845
- // https://tc39.es/ecma262/#sec-array.prototype.includes
3846
- _export({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
3847
- includes: function includes(el /* , fromIndex = 0 */) {
3848
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
3849
- }
3850
- });
3851
-
3852
- // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables
3853
- addToUnscopables('includes');
3854
-
3855
3911
  var $TypeError$2 = TypeError;
3856
3912
 
3857
3913
  var notARegexp = function (it) {
@@ -4281,7 +4337,7 @@ function __spreadArray(to, from) {
4281
4337
  * Usage:
4282
4338
  *
4283
4339
  * ```
4284
- * calLongestCommonSubstring('fish', 'finish');
4340
+ * longestComSubstring('fish', 'finish');
4285
4341
  * ```
4286
4342
  *
4287
4343
  * Output:
@@ -4295,7 +4351,7 @@ function __spreadArray(to, from) {
4295
4351
  * @returns {number} Length
4296
4352
  * @category Calculate and Formula
4297
4353
  */
4298
- function calLongestCommonSubstring(aStr, bStr) {
4354
+ function longestComSubstring(aStr, bStr) {
4299
4355
  var aLen = aStr.length;
4300
4356
  var bLen = bStr.length;
4301
4357
  // 创建二维数组并且深拷贝
@@ -4317,6 +4373,14 @@ function calLongestCommonSubstring(aStr, bStr) {
4317
4373
  var maxLong = Math.max.apply(Math, arr1);
4318
4374
  return maxLong;
4319
4375
  }
4376
+ /**
4377
+ * Alias of `longestComSubstring`
4378
+ *
4379
+ * @hidden
4380
+ */
4381
+ function calLongestCommonSubstring(aStr, bStr) {
4382
+ return longestComSubstring(aStr, bStr);
4383
+ }
4320
4384
  /**
4321
4385
  * EN: Computes the longest common subsequence of two strings.
4322
4386
  *
@@ -4325,7 +4389,7 @@ function calLongestCommonSubstring(aStr, bStr) {
4325
4389
  * Usage:
4326
4390
  *
4327
4391
  * ```
4328
- * calLongestCommonSubsequence('fish', 'finish');
4392
+ * longestComSubsequence('fish', 'finish');
4329
4393
  * ```
4330
4394
  *
4331
4395
  * Output:
@@ -4339,7 +4403,7 @@ function calLongestCommonSubstring(aStr, bStr) {
4339
4403
  * @returns {number} 长度
4340
4404
  * @category Calculate and Formula
4341
4405
  */
4342
- function calLongestCommonSubsequence(aStr, bStr) {
4406
+ function longestComSubsequence(aStr, bStr) {
4343
4407
  var aLen = aStr.length;
4344
4408
  var bLen = bStr.length;
4345
4409
  // 创建二维数组并且深拷贝
@@ -4372,6 +4436,14 @@ function calLongestCommonSubsequence(aStr, bStr) {
4372
4436
  var maxLong = Math.max.apply(Math, arr1);
4373
4437
  return maxLong;
4374
4438
  }
4439
+ /**
4440
+ * Alias of `longestComSubsequence`
4441
+ *
4442
+ * @hidden
4443
+ */
4444
+ function calLongestCommonSubsequence(aStr, bStr) {
4445
+ return longestComSubsequence(aStr, bStr);
4446
+ }
4375
4447
  /**
4376
4448
  * Get the query param's value of the current Web URL(`location.search`).
4377
4449
  *
@@ -4579,6 +4651,8 @@ function camelCase2Underscore(camelCase) {
4579
4651
  /**
4580
4652
  * Remove leading and trailing whitespace or specified characters from string.
4581
4653
  *
4654
+ * Note: This method is used to replace the native `String.prototype.trim()`. But it is not necessary to use it in modern browsers.
4655
+ *
4582
4656
  * ```
4583
4657
  * mTrim(' 1 2 3 '); // '1 2 3'
4584
4658
  * mTrim('abc '); // 'abc'
@@ -4587,6 +4661,7 @@ function camelCase2Underscore(camelCase) {
4587
4661
  * @param {string} str The string to trim.
4588
4662
  * @returns {string} Trimmed string.
4589
4663
  * @category Util
4664
+ * @hidden
4590
4665
  */
4591
4666
  function mTrim(str) {
4592
4667
  str = str.replace(/^\s+/, ''); // 去除头部空格
@@ -4618,13 +4693,13 @@ function newLine(str) {
4618
4693
  return str.replace(reg, '<br />');
4619
4694
  }
4620
4695
  /**
4621
- * Clone Object deeply.
4696
+ * Copy/Clone Object deeply.
4622
4697
  *
4623
4698
  * Usage:
4624
4699
  *
4625
4700
  * ```
4626
- * deepCopyObject(['a', 'b', 'c']);
4627
- * deepCopyObject('abc');
4701
+ * deepCopy(['a', 'b', 'c']);
4702
+ * deepCopy('abc');
4628
4703
  * ```
4629
4704
  *
4630
4705
  * Output:
@@ -4638,9 +4713,33 @@ function newLine(str) {
4638
4713
  * @returns {object} Returns the deep cloned value.
4639
4714
  * @category Util
4640
4715
  */
4641
- function deepCopyObject(obj) {
4716
+ function deepCopy(obj) {
4717
+ // Jugde whether it is a primitive type
4718
+ if (_typeof(obj) !== 'object') {
4719
+ return obj;
4720
+ }
4721
+ // Judge whether its key-value is simple type, string | number | boolean | null | undefined
4722
+ // ...rest
4723
+ var simpleTypes = ['string', 'number', 'boolean', 'undefined'];
4724
+ var values = Object.values(obj);
4725
+ var isSimpleTypeObj = values.every(function (v) {
4726
+ return simpleTypes.includes(_typeof(v));
4727
+ });
4728
+ if (isSimpleTypeObj) {
4729
+ // console.log('it is isSimpleTypeObj');
4730
+ return __assign({}, obj);
4731
+ }
4732
+ // console.log('it is not isSimpleTypeObj');
4642
4733
  return JSON.parse(JSON.stringify(obj));
4643
4734
  }
4735
+ /**
4736
+ * Alias of deepCopy
4737
+ *
4738
+ * @hidden
4739
+ */
4740
+ function deepCopyObject(obj) {
4741
+ return deepCopy(obj);
4742
+ }
4644
4743
  /**
4645
4744
  * Check whether it is a valid JSON string.
4646
4745
  *
@@ -4681,18 +4780,18 @@ function isJsonString(str) {
4681
4780
  return isJSONString(str);
4682
4781
  }
4683
4782
  /**
4684
- * Produce a random string of number, `generateRndNum(7)` => '7658495'.
4783
+ * Produce a random string of number, `genRndNumString(7)` => '7658495'.
4685
4784
  *
4686
4785
  * ```
4687
- * generateRndNum(4); // '9730'
4688
- * generateRndNum(7); // '2262490'
4786
+ * genRndNumString(4); // '9730'
4787
+ * genRndNumString(7); // '2262490'
4689
4788
  * ```
4690
4789
  *
4691
4790
  * @param {number} n Length
4692
4791
  * @returns {string} Return the random string.
4693
4792
  * @category Util
4694
4793
  */
4695
- function generateRndNum(n) {
4794
+ function genRndNumString(n) {
4696
4795
  if (n === void 0) {
4697
4796
  n = 5;
4698
4797
  }
@@ -4702,6 +4801,17 @@ function generateRndNum(n) {
4702
4801
  }
4703
4802
  return ret;
4704
4803
  }
4804
+ /**
4805
+ * Alias of genRndNumString
4806
+ *
4807
+ * @hidden
4808
+ */
4809
+ function generateRndNum(n) {
4810
+ if (n === void 0) {
4811
+ n = 5;
4812
+ }
4813
+ return genRndNumString(n);
4814
+ }
4705
4815
  /**
4706
4816
  * 根据时间生成唯一标志的数字 mGenerateUniqueNum() => 1538324722364123
4707
4817
  *
@@ -5246,7 +5356,7 @@ function getLocalStorage(key) {
5246
5356
  *
5247
5357
  * @param {string} url -- css资源路径
5248
5358
  * @param {string} options.id -- link标签id
5249
- * @returns {Promise<boolean>} true -- 加载成功
5359
+ * @returns {Promise<string>} true -- 加载成功
5250
5360
  * @category Load Resource
5251
5361
  */
5252
5362
  function loadCSS(url, options) {
@@ -5264,7 +5374,7 @@ function loadCSS(url, options) {
5264
5374
  // const tempCB = (typeof callback === 'function' ? callback : function () { });
5265
5375
  var callback = function callback() {
5266
5376
  // doFn(success, true);
5267
- success(true);
5377
+ success('loaded');
5268
5378
  };
5269
5379
  var node = document.createElement('link');
5270
5380
  var supportOnload = ('onload' in node);
@@ -5387,7 +5497,7 @@ function loadCSS(url, options) {
5387
5497
  * @param {function} options.callback -- 加载后回调函数
5388
5498
  * @param {number} options.timeout -- 超时时长
5389
5499
  * @param {boolean} options.isDefer -- 是否添加 defer 标签
5390
- * @returns {Promise<boolean>} -- true 成功
5500
+ * @returns {Promise<string>} -- true 成功
5391
5501
  * @category Load Resource
5392
5502
  */
5393
5503
  function loadScript(url, options) {
@@ -5431,14 +5541,14 @@ function loadScript(url, options) {
5431
5541
  if (script.readyState === 'loaded' || script.readyState === 'complete') {
5432
5542
  script.onreadystatechange = null;
5433
5543
  doFn(callback);
5434
- doFn(success, true);
5544
+ doFn(success, 'loaded');
5435
5545
  }
5436
5546
  };
5437
5547
  } else {
5438
5548
  // Others
5439
5549
  script.onload = function () {
5440
5550
  doFn(callback);
5441
- doFn(success, true);
5551
+ doFn(success, 'loaded');
5442
5552
  };
5443
5553
  }
5444
5554
  script.src = url;
@@ -5447,7 +5557,7 @@ function loadScript(url, options) {
5447
5557
  var _a;
5448
5558
  _a = [resolve, reject], success = _a[0], fail = _a[1];
5449
5559
  if (timeout) {
5450
- setTimeout(fail.bind(null, Error('timeout')), timeout);
5560
+ setTimeout(fail.bind(null, 'timeout'), timeout);
5451
5561
  }
5452
5562
  });
5453
5563
  }
@@ -6573,8 +6683,11 @@ function isNonEmptyArray(arr) {
6573
6683
  */
6574
6684
  function isValidData(data, attributes, validValue) {
6575
6685
  var ret = false;
6686
+ if (_typeof(data) !== 'object') {
6687
+ return ret;
6688
+ }
6576
6689
  var foundRet = attributes.reduce(function (foundValue, curr) {
6577
- if (foundValue[curr]) {
6690
+ if (typeof foundValue[curr] !== 'undefined') {
6578
6691
  foundValue = foundValue[curr];
6579
6692
  } else {
6580
6693
  return Object.create(null);
@@ -6688,7 +6801,7 @@ function formatDate(dateIns, format) {
6688
6801
  var o = {
6689
6802
  yyyy: tempDate.getFullYear(),
6690
6803
  MM: tempDate.getMonth() + 1,
6691
- dd: tempDate.getDate(),
6804
+ dd: tempDate.getDate() < 10 ? '0' + tempDate.getDate() : tempDate.getDate(),
6692
6805
  hh: tempDate.getHours() < 10 ? '0' + tempDate.getHours() : tempDate.getHours(),
6693
6806
  mm: tempDate.getMinutes() < 10 ? '0' + tempDate.getMinutes() : tempDate.getMinutes(),
6694
6807
  ss: tempDate.getSeconds() < 10 ? '0' + tempDate.getSeconds() : tempDate.getSeconds()
@@ -6988,27 +7101,25 @@ function genStyleString(className, styleArray) {
6988
7101
  return ".".concat(className, "{").concat(style, "}");
6989
7102
  }
6990
7103
  /**
6991
- * Load the image from the given url.
6992
- * The target image will be loaded in the background, and the Promise status will change after the image is loaded.
6993
- * If the image fails to load, the Promise status will change to `reject`.
6994
- * If the image is loaded successfully, the Promise status will change to `resolve`.
6995
- * If the image is loaded successfully, the Promise will return the image object.
6996
- * If the image fails to load, the Promise will return the error object.
6997
- * The method will help Web to preload the image. And the image will be cached by the browser.
6998
- * We can use it to implement the lazy loading of images.
6999
- * The method will not add the image to the DOM.
7104
+ * Load an image from the given URL.
7105
+ *
7106
+ * The target image will be loaded in the background, and the Promise status will change after the image is loaded. If the image fails to load, the Promise status will change to `reject` with the error object. If the image is loaded successfully, the Promise status will change to `resolve` with the image object. This method can be used to preload images and cache them in the browser. It can also be used to implement lazy loading of images.
7107
+ *
7108
+ * Note that this method will not add the image to the DOM.
7000
7109
  *
7001
7110
  * @example
7002
7111
  * ```js
7003
- * loadImage('https://example.com/example.png').then((img) => {
7004
- * console.log(img);
7005
- * }).catch((err) => {
7006
- * console.log(err);
7007
- * });
7112
+ * loadImage('https://example.com/example.png')
7113
+ * .then((img) => {
7114
+ * console.log(img);
7115
+ * })
7116
+ * .catch((err) => {
7117
+ * console.log(err);
7118
+ * });
7008
7119
  * ```
7009
7120
  *
7010
- * @param {string} url - The image url.
7011
- * @returns {Promise} Return the Promise object.
7121
+ * @param {string} url - The URL of the image to load.
7122
+ * @returns {Promise} A Promise that resolves with the loaded image or rejects with an error.
7012
7123
  * @category Load Resource
7013
7124
  */
7014
7125
  function loadImage(url) {
@@ -7092,5 +7203,30 @@ function repeatUntilConditionMet(callback, options, condition) {
7092
7203
  }
7093
7204
  clearAndInvokeNext();
7094
7205
  }
7206
+ /**
7207
+ * Load a script from the given URL if it (`window['attribute']`) has not already been loaded.
7208
+ *
7209
+ * @example
7210
+ * ```js
7211
+ * loadScriptIfUndefined('jQuery', 'https://example.com/lib/jquery.min.js')
7212
+ * .then(() => {
7213
+ * console.log('jQuery is loaded.');
7214
+ * })
7215
+ * .catch(err => {
7216
+ * console.log('Failed to load jQuery.', err);
7217
+ * });
7218
+ * ```
7219
+ *
7220
+ * @param {string} windowAttribute - The name of the window attribute to check (e.g. `jQuery`, `axios`, etc.).
7221
+ * @param {string} url - The URL of the script to load.
7222
+ * @returns {Promise} A Promise that resolves when the script has been loaded.
7223
+ * @category Load Resource
7224
+ */
7225
+ function loadScriptIfUndefined(windowAttribute, url) {
7226
+ if (window[windowAttribute]) {
7227
+ return Promise.resolve('defined');
7228
+ }
7229
+ return loadScript(url);
7230
+ }
7095
7231
 
7096
- export { addClass, addEvent, addStyle, calLongestCommonSubsequence, calLongestCommonSubstring, camelCase2Underscore, camelCaseToKebabCase, cancelBubble, clearHtml, convert10To26, convertCamelToKebab, convertCamelToUnder, cutCHSString, debounce, deepCopyObject, doFn, floatFixed, floatToPercent, formatDate, genCustomConsole, genHashCode, genStyleString, generateRndNum, generateUniqueNum, getBrowserInfo, getCookie, getCurrentVersion, getDefineListeners, getDomain, getFileSize, getFriendlyInterval, getHashQueryParam, getLocalStorage, getPerformance, getQueryParam, getSessionStorage, getUrlFileType, getUrlParam, hasClass, inRate, invokeEvent, isJSONString, isJsonString, isNonEmptyArray, isNumber, isSafePWAEnv, isSupportWebp, isValidData, isValidEmail, isValidPhoneNumber, isValidUrl, loadCSS, loadImage, loadScript, mNow, mTrim, newLine, removeClass, removeEvent, repeatUntilConditionMet, sanitizeInput, setCookie, setImgWidHeiBySrc, setLocalStorage, setSessionStorage, throttle, truncateZHString, updateQueryParam, windowLoaded, zAxiosIsValidRes };
7232
+ export { addClass, addEvent, addStyle, calLongestCommonSubsequence, calLongestCommonSubstring, camelCase2Underscore, camelCaseToKebabCase, cancelBubble, clearHtml, convert10To26, convertCamelToKebab, convertCamelToUnder, cutCHSString, debounce, deepCopy, deepCopyObject, doFn, floatFixed, floatToPercent, formatDate, genCustomConsole, genHashCode, genRndNumString, genStyleString, generateRndNum, generateUniqueNum, getBrowserInfo, getCookie, getCurrentVersion, getDefineListeners, getDomain, getFileSize, getFriendlyInterval, getHashQueryParam, getLocalStorage, getPerformance, getQueryParam, getSessionStorage, getUrlFileType, getUrlParam, hasClass, inRate, invokeEvent, isJSONString, isJsonString, isNonEmptyArray, isNumber, isSafePWAEnv, isSupportWebp, isValidData, isValidEmail, isValidPhoneNumber, isValidUrl, loadCSS, loadImage, loadScript, loadScriptIfUndefined, longestComSubsequence, longestComSubstring, mNow, mTrim, newLine, removeClass, removeEvent, repeatUntilConditionMet, sanitizeInput, setCookie, setImgWidHeiBySrc, setLocalStorage, setSessionStorage, throttle, truncateZHString, updateQueryParam, windowLoaded, zAxiosIsValidRes };