@tmagic/utils 1.5.12 → 1.5.13
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/tmagic-utils.js +6 -6
- package/dist/tmagic-utils.umd.cjs +46 -276
- package/package.json +2 -2
- package/types/index.d.ts +2 -1
package/dist/tmagic-utils.js
CHANGED
|
@@ -125,7 +125,7 @@ const sleep = (ms) => new Promise((resolve) => {
|
|
|
125
125
|
});
|
|
126
126
|
const toLine = (name = "") => name.replace(/\B([A-Z])/g, "-$1").toLowerCase();
|
|
127
127
|
const toHump = (name = "") => name.replace(/-(\w)/g, (_all, letter) => letter.toUpperCase());
|
|
128
|
-
const emptyFn = () =>
|
|
128
|
+
const emptyFn = () => void 0;
|
|
129
129
|
const getNodePath = (id, data = []) => {
|
|
130
130
|
const path = [];
|
|
131
131
|
const get = function(id2, data2) {
|
|
@@ -351,13 +351,13 @@ const compiledCond = (op, fieldValue, inputValue, range = []) => {
|
|
|
351
351
|
const getDefaultValueFromFields = (fields) => {
|
|
352
352
|
const data = {};
|
|
353
353
|
const defaultValue = {
|
|
354
|
-
string:
|
|
354
|
+
string: void 0,
|
|
355
355
|
object: {},
|
|
356
356
|
array: [],
|
|
357
|
-
boolean:
|
|
358
|
-
number:
|
|
357
|
+
boolean: void 0,
|
|
358
|
+
number: void 0,
|
|
359
359
|
null: null,
|
|
360
|
-
any:
|
|
360
|
+
any: void 0
|
|
361
361
|
};
|
|
362
362
|
fields.forEach((field) => {
|
|
363
363
|
if (typeof field.defaultValue !== "undefined") {
|
|
@@ -388,7 +388,7 @@ const getDefaultValueFromFields = (fields) => {
|
|
|
388
388
|
data[field.name] = defaultValue[field.type];
|
|
389
389
|
return;
|
|
390
390
|
}
|
|
391
|
-
data[field.name] =
|
|
391
|
+
data[field.name] = void 0;
|
|
392
392
|
});
|
|
393
393
|
return data;
|
|
394
394
|
};
|
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
var Symbol$1 = root.Symbol;
|
|
18
18
|
|
|
19
19
|
/** Used for built-in method references. */
|
|
20
|
-
var objectProto$
|
|
20
|
+
var objectProto$b = Object.prototype;
|
|
21
21
|
|
|
22
22
|
/** Used to check objects for own properties. */
|
|
23
|
-
var hasOwnProperty$
|
|
23
|
+
var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
* Used to resolve the
|
|
27
27
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
28
28
|
* of values.
|
|
29
29
|
*/
|
|
30
|
-
var nativeObjectToString$1 = objectProto$
|
|
30
|
+
var nativeObjectToString$1 = objectProto$b.toString;
|
|
31
31
|
|
|
32
32
|
/** Built-in value references. */
|
|
33
33
|
var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
* @returns {string} Returns the raw `toStringTag`.
|
|
41
41
|
*/
|
|
42
42
|
function getRawTag(value) {
|
|
43
|
-
var isOwn = hasOwnProperty$
|
|
43
|
+
var isOwn = hasOwnProperty$8.call(value, symToStringTag$1),
|
|
44
44
|
tag = value[symToStringTag$1];
|
|
45
45
|
|
|
46
46
|
try {
|
|
@@ -60,14 +60,14 @@
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/** Used for built-in method references. */
|
|
63
|
-
var objectProto$
|
|
63
|
+
var objectProto$a = Object.prototype;
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* Used to resolve the
|
|
67
67
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
68
68
|
* of values.
|
|
69
69
|
*/
|
|
70
|
-
var nativeObjectToString = objectProto$
|
|
70
|
+
var nativeObjectToString = objectProto$a.toString;
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* Converts `value` to a string using `Object.prototype.toString`.
|
|
@@ -348,17 +348,17 @@
|
|
|
348
348
|
|
|
349
349
|
/** Used for built-in method references. */
|
|
350
350
|
var funcProto = Function.prototype,
|
|
351
|
-
objectProto$
|
|
351
|
+
objectProto$9 = Object.prototype;
|
|
352
352
|
|
|
353
353
|
/** Used to resolve the decompiled source of functions. */
|
|
354
354
|
var funcToString = funcProto.toString;
|
|
355
355
|
|
|
356
356
|
/** Used to check objects for own properties. */
|
|
357
|
-
var hasOwnProperty$
|
|
357
|
+
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
358
358
|
|
|
359
359
|
/** Used to detect if a method is native. */
|
|
360
360
|
var reIsNative = RegExp('^' +
|
|
361
|
-
funcToString.call(hasOwnProperty$
|
|
361
|
+
funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
|
|
362
362
|
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
363
363
|
);
|
|
364
364
|
|
|
@@ -433,25 +433,6 @@
|
|
|
433
433
|
};
|
|
434
434
|
}());
|
|
435
435
|
|
|
436
|
-
/**
|
|
437
|
-
* Copies the values of `source` to `array`.
|
|
438
|
-
*
|
|
439
|
-
* @private
|
|
440
|
-
* @param {Array} source The array to copy values from.
|
|
441
|
-
* @param {Array} [array=[]] The array to copy values to.
|
|
442
|
-
* @returns {Array} Returns `array`.
|
|
443
|
-
*/
|
|
444
|
-
function copyArray(source, array) {
|
|
445
|
-
var index = -1,
|
|
446
|
-
length = source.length;
|
|
447
|
-
|
|
448
|
-
array || (array = Array(length));
|
|
449
|
-
while (++index < length) {
|
|
450
|
-
array[index] = source[index];
|
|
451
|
-
}
|
|
452
|
-
return array;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
436
|
var defineProperty = (function() {
|
|
456
437
|
try {
|
|
457
438
|
var func = getNative(Object, 'defineProperty');
|
|
@@ -564,10 +545,10 @@
|
|
|
564
545
|
}
|
|
565
546
|
|
|
566
547
|
/** Used for built-in method references. */
|
|
567
|
-
var objectProto$
|
|
548
|
+
var objectProto$8 = Object.prototype;
|
|
568
549
|
|
|
569
550
|
/** Used to check objects for own properties. */
|
|
570
|
-
var hasOwnProperty$
|
|
551
|
+
var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
|
|
571
552
|
|
|
572
553
|
/**
|
|
573
554
|
* Assigns `value` to `key` of `object` if the existing value is not equivalent
|
|
@@ -581,46 +562,12 @@
|
|
|
581
562
|
*/
|
|
582
563
|
function assignValue(object, key, value) {
|
|
583
564
|
var objValue = object[key];
|
|
584
|
-
if (!(hasOwnProperty$
|
|
565
|
+
if (!(hasOwnProperty$6.call(object, key) && eq(objValue, value)) ||
|
|
585
566
|
(value === undefined && !(key in object))) {
|
|
586
567
|
baseAssignValue(object, key, value);
|
|
587
568
|
}
|
|
588
569
|
}
|
|
589
570
|
|
|
590
|
-
/**
|
|
591
|
-
* Copies properties of `source` to `object`.
|
|
592
|
-
*
|
|
593
|
-
* @private
|
|
594
|
-
* @param {Object} source The object to copy properties from.
|
|
595
|
-
* @param {Array} props The property identifiers to copy.
|
|
596
|
-
* @param {Object} [object={}] The object to copy properties to.
|
|
597
|
-
* @param {Function} [customizer] The function to customize copied values.
|
|
598
|
-
* @returns {Object} Returns `object`.
|
|
599
|
-
*/
|
|
600
|
-
function copyObject(source, props, object, customizer) {
|
|
601
|
-
var isNew = !object;
|
|
602
|
-
object || (object = {});
|
|
603
|
-
|
|
604
|
-
var index = -1,
|
|
605
|
-
length = props.length;
|
|
606
|
-
|
|
607
|
-
while (++index < length) {
|
|
608
|
-
var key = props[index];
|
|
609
|
-
|
|
610
|
-
var newValue = undefined;
|
|
611
|
-
|
|
612
|
-
if (newValue === undefined) {
|
|
613
|
-
newValue = source[key];
|
|
614
|
-
}
|
|
615
|
-
if (isNew) {
|
|
616
|
-
baseAssignValue(object, key, newValue);
|
|
617
|
-
} else {
|
|
618
|
-
assignValue(object, key, newValue);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
return object;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
571
|
/** Used as references for various `Number` constants. */
|
|
625
572
|
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
626
573
|
|
|
@@ -685,7 +632,7 @@
|
|
|
685
632
|
}
|
|
686
633
|
|
|
687
634
|
/** Used for built-in method references. */
|
|
688
|
-
var objectProto$
|
|
635
|
+
var objectProto$7 = Object.prototype;
|
|
689
636
|
|
|
690
637
|
/**
|
|
691
638
|
* Checks if `value` is likely a prototype object.
|
|
@@ -696,7 +643,7 @@
|
|
|
696
643
|
*/
|
|
697
644
|
function isPrototype(value) {
|
|
698
645
|
var Ctor = value && value.constructor,
|
|
699
|
-
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$
|
|
646
|
+
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$7;
|
|
700
647
|
|
|
701
648
|
return value === proto;
|
|
702
649
|
}
|
|
@@ -735,13 +682,13 @@
|
|
|
735
682
|
}
|
|
736
683
|
|
|
737
684
|
/** Used for built-in method references. */
|
|
738
|
-
var objectProto$
|
|
685
|
+
var objectProto$6 = Object.prototype;
|
|
739
686
|
|
|
740
687
|
/** Used to check objects for own properties. */
|
|
741
|
-
var hasOwnProperty$
|
|
688
|
+
var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
|
|
742
689
|
|
|
743
690
|
/** Built-in value references. */
|
|
744
|
-
var propertyIsEnumerable$1 = objectProto$
|
|
691
|
+
var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
|
|
745
692
|
|
|
746
693
|
/**
|
|
747
694
|
* Checks if `value` is likely an `arguments` object.
|
|
@@ -762,7 +709,7 @@
|
|
|
762
709
|
* // => false
|
|
763
710
|
*/
|
|
764
711
|
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
|
765
|
-
return isObjectLike(value) && hasOwnProperty$
|
|
712
|
+
return isObjectLike(value) && hasOwnProperty$5.call(value, 'callee') &&
|
|
766
713
|
!propertyIsEnumerable$1.call(value, 'callee');
|
|
767
714
|
};
|
|
768
715
|
|
|
@@ -935,10 +882,10 @@
|
|
|
935
882
|
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
936
883
|
|
|
937
884
|
/** Used for built-in method references. */
|
|
938
|
-
var objectProto$
|
|
885
|
+
var objectProto$5 = Object.prototype;
|
|
939
886
|
|
|
940
887
|
/** Used to check objects for own properties. */
|
|
941
|
-
var hasOwnProperty$
|
|
888
|
+
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
942
889
|
|
|
943
890
|
/**
|
|
944
891
|
* Creates an array of the enumerable property names of the array-like `value`.
|
|
@@ -958,7 +905,7 @@
|
|
|
958
905
|
length = result.length;
|
|
959
906
|
|
|
960
907
|
for (var key in value) {
|
|
961
|
-
if ((
|
|
908
|
+
if ((hasOwnProperty$4.call(value, key)) &&
|
|
962
909
|
!(skipIndexes && (
|
|
963
910
|
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
964
911
|
key == 'length' ||
|
|
@@ -993,10 +940,10 @@
|
|
|
993
940
|
var nativeKeys = overArg(Object.keys, Object);
|
|
994
941
|
|
|
995
942
|
/** Used for built-in method references. */
|
|
996
|
-
var objectProto$
|
|
943
|
+
var objectProto$4 = Object.prototype;
|
|
997
944
|
|
|
998
945
|
/** Used to check objects for own properties. */
|
|
999
|
-
var hasOwnProperty$
|
|
946
|
+
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
1000
947
|
|
|
1001
948
|
/**
|
|
1002
949
|
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
@@ -1011,7 +958,7 @@
|
|
|
1011
958
|
}
|
|
1012
959
|
var result = [];
|
|
1013
960
|
for (var key in Object(object)) {
|
|
1014
|
-
if (hasOwnProperty$
|
|
961
|
+
if (hasOwnProperty$3.call(object, key) && key != 'constructor') {
|
|
1015
962
|
result.push(key);
|
|
1016
963
|
}
|
|
1017
964
|
}
|
|
@@ -1050,80 +997,6 @@
|
|
|
1050
997
|
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
1051
998
|
}
|
|
1052
999
|
|
|
1053
|
-
/**
|
|
1054
|
-
* This function is like
|
|
1055
|
-
* [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
1056
|
-
* except that it includes inherited enumerable properties.
|
|
1057
|
-
*
|
|
1058
|
-
* @private
|
|
1059
|
-
* @param {Object} object The object to query.
|
|
1060
|
-
* @returns {Array} Returns the array of property names.
|
|
1061
|
-
*/
|
|
1062
|
-
function nativeKeysIn(object) {
|
|
1063
|
-
var result = [];
|
|
1064
|
-
if (object != null) {
|
|
1065
|
-
for (var key in Object(object)) {
|
|
1066
|
-
result.push(key);
|
|
1067
|
-
}
|
|
1068
|
-
}
|
|
1069
|
-
return result;
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
/** Used for built-in method references. */
|
|
1073
|
-
var objectProto$4 = Object.prototype;
|
|
1074
|
-
|
|
1075
|
-
/** Used to check objects for own properties. */
|
|
1076
|
-
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
1077
|
-
|
|
1078
|
-
/**
|
|
1079
|
-
* The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.
|
|
1080
|
-
*
|
|
1081
|
-
* @private
|
|
1082
|
-
* @param {Object} object The object to query.
|
|
1083
|
-
* @returns {Array} Returns the array of property names.
|
|
1084
|
-
*/
|
|
1085
|
-
function baseKeysIn(object) {
|
|
1086
|
-
if (!isObject$1(object)) {
|
|
1087
|
-
return nativeKeysIn(object);
|
|
1088
|
-
}
|
|
1089
|
-
var isProto = isPrototype(object),
|
|
1090
|
-
result = [];
|
|
1091
|
-
|
|
1092
|
-
for (var key in object) {
|
|
1093
|
-
if (!(key == 'constructor' && (isProto || !hasOwnProperty$3.call(object, key)))) {
|
|
1094
|
-
result.push(key);
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
return result;
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
/**
|
|
1101
|
-
* Creates an array of the own and inherited enumerable property names of `object`.
|
|
1102
|
-
*
|
|
1103
|
-
* **Note:** Non-object values are coerced to objects.
|
|
1104
|
-
*
|
|
1105
|
-
* @static
|
|
1106
|
-
* @memberOf _
|
|
1107
|
-
* @since 3.0.0
|
|
1108
|
-
* @category Object
|
|
1109
|
-
* @param {Object} object The object to query.
|
|
1110
|
-
* @returns {Array} Returns the array of property names.
|
|
1111
|
-
* @example
|
|
1112
|
-
*
|
|
1113
|
-
* function Foo() {
|
|
1114
|
-
* this.a = 1;
|
|
1115
|
-
* this.b = 2;
|
|
1116
|
-
* }
|
|
1117
|
-
*
|
|
1118
|
-
* Foo.prototype.c = 3;
|
|
1119
|
-
*
|
|
1120
|
-
* _.keysIn(new Foo);
|
|
1121
|
-
* // => ['a', 'b', 'c'] (iteration order is not guaranteed)
|
|
1122
|
-
*/
|
|
1123
|
-
function keysIn(object) {
|
|
1124
|
-
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
1000
|
/** Used to match property names within property paths. */
|
|
1128
1001
|
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
1129
1002
|
reIsPlainProp = /^\w*$/;
|
|
@@ -1841,32 +1714,6 @@
|
|
|
1841
1714
|
Stack.prototype.has = stackHas;
|
|
1842
1715
|
Stack.prototype.set = stackSet;
|
|
1843
1716
|
|
|
1844
|
-
/**
|
|
1845
|
-
* The base implementation of `_.assign` without support for multiple sources
|
|
1846
|
-
* or `customizer` functions.
|
|
1847
|
-
*
|
|
1848
|
-
* @private
|
|
1849
|
-
* @param {Object} object The destination object.
|
|
1850
|
-
* @param {Object} source The source object.
|
|
1851
|
-
* @returns {Object} Returns `object`.
|
|
1852
|
-
*/
|
|
1853
|
-
function baseAssign(object, source) {
|
|
1854
|
-
return object && copyObject(source, keys(source), object);
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
/**
|
|
1858
|
-
* The base implementation of `_.assignIn` without support for multiple sources
|
|
1859
|
-
* or `customizer` functions.
|
|
1860
|
-
*
|
|
1861
|
-
* @private
|
|
1862
|
-
* @param {Object} object The destination object.
|
|
1863
|
-
* @param {Object} source The source object.
|
|
1864
|
-
* @returns {Object} Returns `object`.
|
|
1865
|
-
*/
|
|
1866
|
-
function baseAssignIn(object, source) {
|
|
1867
|
-
return object && copyObject(source, keysIn(source), object);
|
|
1868
|
-
}
|
|
1869
|
-
|
|
1870
1717
|
/** Detect free variable `exports`. */
|
|
1871
1718
|
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
1872
1719
|
|
|
@@ -1877,8 +1724,8 @@
|
|
|
1877
1724
|
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1878
1725
|
|
|
1879
1726
|
/** Built-in value references. */
|
|
1880
|
-
var Buffer = moduleExports ? root.Buffer : undefined
|
|
1881
|
-
|
|
1727
|
+
var Buffer = moduleExports ? root.Buffer : undefined;
|
|
1728
|
+
Buffer ? Buffer.allocUnsafe : undefined;
|
|
1882
1729
|
|
|
1883
1730
|
/**
|
|
1884
1731
|
* Creates a clone of `buffer`.
|
|
@@ -1889,14 +1736,9 @@
|
|
|
1889
1736
|
* @returns {Buffer} Returns the cloned buffer.
|
|
1890
1737
|
*/
|
|
1891
1738
|
function cloneBuffer(buffer, isDeep) {
|
|
1892
|
-
|
|
1739
|
+
{
|
|
1893
1740
|
return buffer.slice();
|
|
1894
1741
|
}
|
|
1895
|
-
var length = buffer.length,
|
|
1896
|
-
result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
|
1897
|
-
|
|
1898
|
-
buffer.copy(result);
|
|
1899
|
-
return result;
|
|
1900
1742
|
}
|
|
1901
1743
|
|
|
1902
1744
|
/**
|
|
@@ -1952,7 +1794,7 @@
|
|
|
1952
1794
|
var propertyIsEnumerable = objectProto$1.propertyIsEnumerable;
|
|
1953
1795
|
|
|
1954
1796
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1955
|
-
var nativeGetSymbols
|
|
1797
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
1956
1798
|
|
|
1957
1799
|
/**
|
|
1958
1800
|
* Creates an array of the own enumerable symbols of `object`.
|
|
@@ -1961,59 +1803,16 @@
|
|
|
1961
1803
|
* @param {Object} object The object to query.
|
|
1962
1804
|
* @returns {Array} Returns the array of symbols.
|
|
1963
1805
|
*/
|
|
1964
|
-
var getSymbols = !nativeGetSymbols
|
|
1806
|
+
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
1965
1807
|
if (object == null) {
|
|
1966
1808
|
return [];
|
|
1967
1809
|
}
|
|
1968
1810
|
object = Object(object);
|
|
1969
|
-
return arrayFilter(nativeGetSymbols
|
|
1811
|
+
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
1970
1812
|
return propertyIsEnumerable.call(object, symbol);
|
|
1971
1813
|
});
|
|
1972
1814
|
};
|
|
1973
1815
|
|
|
1974
|
-
/**
|
|
1975
|
-
* Copies own symbols of `source` to `object`.
|
|
1976
|
-
*
|
|
1977
|
-
* @private
|
|
1978
|
-
* @param {Object} source The object to copy symbols from.
|
|
1979
|
-
* @param {Object} [object={}] The object to copy symbols to.
|
|
1980
|
-
* @returns {Object} Returns `object`.
|
|
1981
|
-
*/
|
|
1982
|
-
function copySymbols(source, object) {
|
|
1983
|
-
return copyObject(source, getSymbols(source), object);
|
|
1984
|
-
}
|
|
1985
|
-
|
|
1986
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1987
|
-
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
1988
|
-
|
|
1989
|
-
/**
|
|
1990
|
-
* Creates an array of the own and inherited enumerable symbols of `object`.
|
|
1991
|
-
*
|
|
1992
|
-
* @private
|
|
1993
|
-
* @param {Object} object The object to query.
|
|
1994
|
-
* @returns {Array} Returns the array of symbols.
|
|
1995
|
-
*/
|
|
1996
|
-
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
|
|
1997
|
-
var result = [];
|
|
1998
|
-
while (object) {
|
|
1999
|
-
arrayPush(result, getSymbols(object));
|
|
2000
|
-
object = getPrototype(object);
|
|
2001
|
-
}
|
|
2002
|
-
return result;
|
|
2003
|
-
};
|
|
2004
|
-
|
|
2005
|
-
/**
|
|
2006
|
-
* Copies own and inherited symbols of `source` to `object`.
|
|
2007
|
-
*
|
|
2008
|
-
* @private
|
|
2009
|
-
* @param {Object} source The object to copy symbols from.
|
|
2010
|
-
* @param {Object} [object={}] The object to copy symbols to.
|
|
2011
|
-
* @returns {Object} Returns `object`.
|
|
2012
|
-
*/
|
|
2013
|
-
function copySymbolsIn(source, object) {
|
|
2014
|
-
return copyObject(source, getSymbolsIn(source), object);
|
|
2015
|
-
}
|
|
2016
|
-
|
|
2017
1816
|
/**
|
|
2018
1817
|
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
2019
1818
|
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
@@ -2041,18 +1840,6 @@
|
|
|
2041
1840
|
return baseGetAllKeys(object, keys, getSymbols);
|
|
2042
1841
|
}
|
|
2043
1842
|
|
|
2044
|
-
/**
|
|
2045
|
-
* Creates an array of own and inherited enumerable property names and
|
|
2046
|
-
* symbols of `object`.
|
|
2047
|
-
*
|
|
2048
|
-
* @private
|
|
2049
|
-
* @param {Object} object The object to query.
|
|
2050
|
-
* @returns {Array} Returns the array of property names and symbols.
|
|
2051
|
-
*/
|
|
2052
|
-
function getAllKeysIn(object) {
|
|
2053
|
-
return baseGetAllKeys(object, keysIn, getSymbolsIn);
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
1843
|
/* Built-in method references that are verified to be native. */
|
|
2057
1844
|
var DataView = getNative(root, 'DataView');
|
|
2058
1845
|
|
|
@@ -2161,7 +1948,7 @@
|
|
|
2161
1948
|
* @returns {Object} Returns the cloned data view.
|
|
2162
1949
|
*/
|
|
2163
1950
|
function cloneDataView(dataView, isDeep) {
|
|
2164
|
-
var buffer =
|
|
1951
|
+
var buffer = cloneArrayBuffer(dataView.buffer) ;
|
|
2165
1952
|
return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
|
|
2166
1953
|
}
|
|
2167
1954
|
|
|
@@ -2205,7 +1992,7 @@
|
|
|
2205
1992
|
* @returns {Object} Returns the cloned typed array.
|
|
2206
1993
|
*/
|
|
2207
1994
|
function cloneTypedArray(typedArray, isDeep) {
|
|
2208
|
-
var buffer =
|
|
1995
|
+
var buffer = cloneArrayBuffer(typedArray.buffer) ;
|
|
2209
1996
|
return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
|
2210
1997
|
}
|
|
2211
1998
|
|
|
@@ -2254,12 +2041,12 @@
|
|
|
2254
2041
|
return new Ctor(+object);
|
|
2255
2042
|
|
|
2256
2043
|
case dataViewTag$1:
|
|
2257
|
-
return cloneDataView(object
|
|
2044
|
+
return cloneDataView(object);
|
|
2258
2045
|
|
|
2259
2046
|
case float32Tag$1: case float64Tag$1:
|
|
2260
2047
|
case int8Tag$1: case int16Tag$1: case int32Tag$1:
|
|
2261
2048
|
case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
|
|
2262
|
-
return cloneTypedArray(object
|
|
2049
|
+
return cloneTypedArray(object);
|
|
2263
2050
|
|
|
2264
2051
|
case mapTag$2:
|
|
2265
2052
|
return new Ctor;
|
|
@@ -2364,11 +2151,6 @@
|
|
|
2364
2151
|
*/
|
|
2365
2152
|
var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
|
|
2366
2153
|
|
|
2367
|
-
/** Used to compose bitmasks for cloning. */
|
|
2368
|
-
var CLONE_DEEP_FLAG$1 = 1,
|
|
2369
|
-
CLONE_FLAT_FLAG = 2,
|
|
2370
|
-
CLONE_SYMBOLS_FLAG$1 = 4;
|
|
2371
|
-
|
|
2372
2154
|
/** `Object#toString` result references. */
|
|
2373
2155
|
var argsTag = '[object Arguments]',
|
|
2374
2156
|
arrayTag = '[object Array]',
|
|
@@ -2431,10 +2213,7 @@
|
|
|
2431
2213
|
* @returns {*} Returns the cloned value.
|
|
2432
2214
|
*/
|
|
2433
2215
|
function baseClone(value, bitmask, customizer, key, object, stack) {
|
|
2434
|
-
var result
|
|
2435
|
-
isDeep = bitmask & CLONE_DEEP_FLAG$1,
|
|
2436
|
-
isFlat = bitmask & CLONE_FLAT_FLAG,
|
|
2437
|
-
isFull = bitmask & CLONE_SYMBOLS_FLAG$1;
|
|
2216
|
+
var result;
|
|
2438
2217
|
if (result !== undefined) {
|
|
2439
2218
|
return result;
|
|
2440
2219
|
}
|
|
@@ -2444,28 +2223,20 @@
|
|
|
2444
2223
|
var isArr = isArray(value);
|
|
2445
2224
|
if (isArr) {
|
|
2446
2225
|
result = initCloneArray(value);
|
|
2447
|
-
if (!isDeep) {
|
|
2448
|
-
return copyArray(value, result);
|
|
2449
|
-
}
|
|
2450
2226
|
} else {
|
|
2451
2227
|
var tag = getTag(value),
|
|
2452
2228
|
isFunc = tag == funcTag || tag == genTag;
|
|
2453
2229
|
|
|
2454
2230
|
if (isBuffer(value)) {
|
|
2455
|
-
return cloneBuffer(value
|
|
2231
|
+
return cloneBuffer(value);
|
|
2456
2232
|
}
|
|
2457
2233
|
if (tag == objectTag || tag == argsTag || (isFunc && !object)) {
|
|
2458
|
-
result = (
|
|
2459
|
-
if (!isDeep) {
|
|
2460
|
-
return isFlat
|
|
2461
|
-
? copySymbolsIn(value, baseAssignIn(result, value))
|
|
2462
|
-
: copySymbols(value, baseAssign(result, value));
|
|
2463
|
-
}
|
|
2234
|
+
result = (isFunc) ? {} : initCloneObject(value);
|
|
2464
2235
|
} else {
|
|
2465
2236
|
if (!cloneableTags[tag]) {
|
|
2466
2237
|
return object ? value : {};
|
|
2467
2238
|
}
|
|
2468
|
-
result = initCloneByTag(value, tag
|
|
2239
|
+
result = initCloneByTag(value, tag);
|
|
2469
2240
|
}
|
|
2470
2241
|
}
|
|
2471
2242
|
// Check for circular references and return its corresponding clone.
|
|
@@ -2486,9 +2257,8 @@
|
|
|
2486
2257
|
});
|
|
2487
2258
|
}
|
|
2488
2259
|
|
|
2489
|
-
var keysFunc =
|
|
2490
|
-
|
|
2491
|
-
: (isFlat ? keysIn : keys);
|
|
2260
|
+
var keysFunc = (getAllKeys)
|
|
2261
|
+
;
|
|
2492
2262
|
|
|
2493
2263
|
var props = isArr ? undefined : keysFunc(value);
|
|
2494
2264
|
arrayEach(props || value, function(subValue, key) {
|
|
@@ -2728,7 +2498,7 @@
|
|
|
2728
2498
|
});
|
|
2729
2499
|
const toLine = (name = "") => name.replace(/\B([A-Z])/g, "-$1").toLowerCase();
|
|
2730
2500
|
const toHump = (name = "") => name.replace(/-(\w)/g, (_all, letter) => letter.toUpperCase());
|
|
2731
|
-
const emptyFn = () =>
|
|
2501
|
+
const emptyFn = () => void 0;
|
|
2732
2502
|
const getNodePath = (id, data = []) => {
|
|
2733
2503
|
const path = [];
|
|
2734
2504
|
const get = function(id2, data2) {
|
|
@@ -2954,13 +2724,13 @@
|
|
|
2954
2724
|
const getDefaultValueFromFields = (fields) => {
|
|
2955
2725
|
const data = {};
|
|
2956
2726
|
const defaultValue = {
|
|
2957
|
-
string:
|
|
2727
|
+
string: void 0,
|
|
2958
2728
|
object: {},
|
|
2959
2729
|
array: [],
|
|
2960
|
-
boolean:
|
|
2961
|
-
number:
|
|
2730
|
+
boolean: void 0,
|
|
2731
|
+
number: void 0,
|
|
2962
2732
|
null: null,
|
|
2963
|
-
any:
|
|
2733
|
+
any: void 0
|
|
2964
2734
|
};
|
|
2965
2735
|
fields.forEach((field) => {
|
|
2966
2736
|
if (typeof field.defaultValue !== "undefined") {
|
|
@@ -2991,7 +2761,7 @@
|
|
|
2991
2761
|
data[field.name] = defaultValue[field.type];
|
|
2992
2762
|
return;
|
|
2993
2763
|
}
|
|
2994
|
-
data[field.name] =
|
|
2764
|
+
data[field.name] = void 0;
|
|
2995
2765
|
});
|
|
2996
2766
|
return data;
|
|
2997
2767
|
};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.5.
|
|
2
|
+
"version": "1.5.13",
|
|
3
3
|
"name": "@tmagic/utils",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/tmagic-utils.umd.cjs",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"typescript": "*",
|
|
37
|
-
"@tmagic/schema": "1.5.
|
|
37
|
+
"@tmagic/schema": "1.5.13"
|
|
38
38
|
},
|
|
39
39
|
"peerDependenciesMeta": {
|
|
40
40
|
"typescript": {
|
package/types/index.d.ts
CHANGED
|
@@ -97,4 +97,5 @@ interface NodeItem {
|
|
|
97
97
|
declare const traverseNode: <T extends NodeItem = NodeItem>(node: T, cb: (node: T, parents: T[]) => void, parents?: T[], evalCbAfter?: boolean) => void;
|
|
98
98
|
declare const isValueIncludeDataSource: (value: any) => boolean;
|
|
99
99
|
|
|
100
|
-
export { DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, DSL_NODE_KEY_COPY_PREFIX, IS_DSL_NODE_KEY,
|
|
100
|
+
export { DATA_SOURCE_FIELDS_CHANGE_EVENT_PREFIX, DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX, DSL_NODE_KEY_COPY_PREFIX, IS_DSL_NODE_KEY, addClassName, addParamToUrl, asyncLoadCss, asyncLoadJs, calcValueByFontsize, calculatePercentage, compiledCond, compiledNode, convertToNumber, createDiv, dataSourceTemplateRegExp, emptyFn, filterXSS, getDefaultValueFromFields, getDepKeys, getDepNodeIds, getDocument, getElById, getGlobalThis, getHost, getIdFromEl, getKeys, getKeysArray, getNodeInfo, getNodePath, getNodes, getUrlParam, getValueByKeyPath, guid, injectStyle, isDslNode, isNumber, isObject, isPage, isPageFragment, isPercentage, isPop, isSameDomain, isValueIncludeDataSource, removeClassName, removeClassNameByClassName, replaceChildNode, setDslDomRelateConfig, setIdToEl, setValueByKeyPath, sleep, toHump, toLine, traverseNode };
|
|
101
|
+
export type { NodeItem };
|