qs 6.9.6 → 6.10.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/.eslintrc +1 -1
- package/CHANGELOG.md +10 -0
- package/README.md +8 -1
- package/dist/qs.js +1076 -5
- package/lib/parse.js +6 -0
- package/lib/stringify.js +14 -3
- package/package.json +12 -9
- package/test/parse.js +9 -0
- package/test/stringify.js +34 -1
package/dist/qs.js
CHANGED
|
@@ -47,6 +47,7 @@ var isArray = Array.isArray;
|
|
|
47
47
|
var defaults = {
|
|
48
48
|
allowDots: false,
|
|
49
49
|
allowPrototypes: false,
|
|
50
|
+
allowSparse: false,
|
|
50
51
|
arrayLimit: 20,
|
|
51
52
|
charset: 'utf-8',
|
|
52
53
|
charsetSentinel: false,
|
|
@@ -256,6 +257,7 @@ var normalizeParseOptions = function normalizeParseOptions(opts) {
|
|
|
256
257
|
return {
|
|
257
258
|
allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
|
|
258
259
|
allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
|
|
260
|
+
allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
|
|
259
261
|
arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
|
|
260
262
|
charset: charset,
|
|
261
263
|
charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
|
|
@@ -292,12 +294,17 @@ module.exports = function (str, opts) {
|
|
|
292
294
|
obj = utils.merge(obj, newObj, options);
|
|
293
295
|
}
|
|
294
296
|
|
|
297
|
+
if (options.allowSparse === true) {
|
|
298
|
+
return obj;
|
|
299
|
+
}
|
|
300
|
+
|
|
295
301
|
return utils.compact(obj);
|
|
296
302
|
};
|
|
297
303
|
|
|
298
304
|
},{"./utils":5}],4:[function(require,module,exports){
|
|
299
305
|
'use strict';
|
|
300
306
|
|
|
307
|
+
var getSideChannel = require('side-channel');
|
|
301
308
|
var utils = require('./utils');
|
|
302
309
|
var formats = require('./formats');
|
|
303
310
|
var has = Object.prototype.hasOwnProperty;
|
|
@@ -366,9 +373,15 @@ var stringify = function stringify(
|
|
|
366
373
|
format,
|
|
367
374
|
formatter,
|
|
368
375
|
encodeValuesOnly,
|
|
369
|
-
charset
|
|
376
|
+
charset,
|
|
377
|
+
sideChannel
|
|
370
378
|
) {
|
|
371
379
|
var obj = object;
|
|
380
|
+
|
|
381
|
+
if (sideChannel.has(object)) {
|
|
382
|
+
throw new RangeError('Cyclic object value');
|
|
383
|
+
}
|
|
384
|
+
|
|
372
385
|
if (typeof filter === 'function') {
|
|
373
386
|
obj = filter(prefix, obj);
|
|
374
387
|
} else if (obj instanceof Date) {
|
|
@@ -427,6 +440,7 @@ var stringify = function stringify(
|
|
|
427
440
|
? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix
|
|
428
441
|
: prefix + (allowDots ? '.' + key : '[' + key + ']');
|
|
429
442
|
|
|
443
|
+
sideChannel.set(object, true);
|
|
430
444
|
pushToArray(values, stringify(
|
|
431
445
|
value,
|
|
432
446
|
keyPrefix,
|
|
@@ -441,7 +455,8 @@ var stringify = function stringify(
|
|
|
441
455
|
format,
|
|
442
456
|
formatter,
|
|
443
457
|
encodeValuesOnly,
|
|
444
|
-
charset
|
|
458
|
+
charset,
|
|
459
|
+
sideChannel
|
|
445
460
|
));
|
|
446
461
|
}
|
|
447
462
|
|
|
@@ -535,6 +550,7 @@ module.exports = function (object, opts) {
|
|
|
535
550
|
objKeys.sort(options.sort);
|
|
536
551
|
}
|
|
537
552
|
|
|
553
|
+
var sideChannel = getSideChannel();
|
|
538
554
|
for (var i = 0; i < objKeys.length; ++i) {
|
|
539
555
|
var key = objKeys[i];
|
|
540
556
|
|
|
@@ -555,7 +571,8 @@ module.exports = function (object, opts) {
|
|
|
555
571
|
options.format,
|
|
556
572
|
options.formatter,
|
|
557
573
|
options.encodeValuesOnly,
|
|
558
|
-
options.charset
|
|
574
|
+
options.charset,
|
|
575
|
+
sideChannel
|
|
559
576
|
));
|
|
560
577
|
}
|
|
561
578
|
|
|
@@ -575,7 +592,7 @@ module.exports = function (object, opts) {
|
|
|
575
592
|
return joined.length > 0 ? prefix + joined : '';
|
|
576
593
|
};
|
|
577
594
|
|
|
578
|
-
},{"./formats":1,"./utils":5}],5:[function(require,module,exports){
|
|
595
|
+
},{"./formats":1,"./utils":5,"side-channel":16}],5:[function(require,module,exports){
|
|
579
596
|
'use strict';
|
|
580
597
|
|
|
581
598
|
var formats = require('./formats');
|
|
@@ -828,5 +845,1059 @@ module.exports = {
|
|
|
828
845
|
merge: merge
|
|
829
846
|
};
|
|
830
847
|
|
|
831
|
-
},{"./formats":1}]
|
|
848
|
+
},{"./formats":1}],6:[function(require,module,exports){
|
|
849
|
+
|
|
850
|
+
},{}],7:[function(require,module,exports){
|
|
851
|
+
'use strict';
|
|
852
|
+
|
|
853
|
+
var GetIntrinsic = require('get-intrinsic');
|
|
854
|
+
|
|
855
|
+
var callBind = require('./');
|
|
856
|
+
|
|
857
|
+
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
|
|
858
|
+
|
|
859
|
+
module.exports = function callBoundIntrinsic(name, allowMissing) {
|
|
860
|
+
var intrinsic = GetIntrinsic(name, !!allowMissing);
|
|
861
|
+
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
|
862
|
+
return callBind(intrinsic);
|
|
863
|
+
}
|
|
864
|
+
return intrinsic;
|
|
865
|
+
};
|
|
866
|
+
|
|
867
|
+
},{"./":8,"get-intrinsic":11}],8:[function(require,module,exports){
|
|
868
|
+
'use strict';
|
|
869
|
+
|
|
870
|
+
var bind = require('function-bind');
|
|
871
|
+
var GetIntrinsic = require('get-intrinsic');
|
|
872
|
+
|
|
873
|
+
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
|
874
|
+
var $call = GetIntrinsic('%Function.prototype.call%');
|
|
875
|
+
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
|
876
|
+
|
|
877
|
+
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
|
878
|
+
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
|
879
|
+
var $max = GetIntrinsic('%Math.max%');
|
|
880
|
+
|
|
881
|
+
if ($defineProperty) {
|
|
882
|
+
try {
|
|
883
|
+
$defineProperty({}, 'a', { value: 1 });
|
|
884
|
+
} catch (e) {
|
|
885
|
+
// IE 8 has a broken defineProperty
|
|
886
|
+
$defineProperty = null;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
module.exports = function callBind(originalFunction) {
|
|
891
|
+
var func = $reflectApply(bind, $call, arguments);
|
|
892
|
+
if ($gOPD && $defineProperty) {
|
|
893
|
+
var desc = $gOPD(func, 'length');
|
|
894
|
+
if (desc.configurable) {
|
|
895
|
+
// original length, plus the receiver, minus any additional arguments (after the receiver)
|
|
896
|
+
$defineProperty(
|
|
897
|
+
func,
|
|
898
|
+
'length',
|
|
899
|
+
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
|
|
900
|
+
);
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
return func;
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
var applyBind = function applyBind() {
|
|
907
|
+
return $reflectApply(bind, $apply, arguments);
|
|
908
|
+
};
|
|
909
|
+
|
|
910
|
+
if ($defineProperty) {
|
|
911
|
+
$defineProperty(module.exports, 'apply', { value: applyBind });
|
|
912
|
+
} else {
|
|
913
|
+
module.exports.apply = applyBind;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
},{"function-bind":10,"get-intrinsic":11}],9:[function(require,module,exports){
|
|
917
|
+
'use strict';
|
|
918
|
+
|
|
919
|
+
/* eslint no-invalid-this: 1 */
|
|
920
|
+
|
|
921
|
+
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
|
922
|
+
var slice = Array.prototype.slice;
|
|
923
|
+
var toStr = Object.prototype.toString;
|
|
924
|
+
var funcType = '[object Function]';
|
|
925
|
+
|
|
926
|
+
module.exports = function bind(that) {
|
|
927
|
+
var target = this;
|
|
928
|
+
if (typeof target !== 'function' || toStr.call(target) !== funcType) {
|
|
929
|
+
throw new TypeError(ERROR_MESSAGE + target);
|
|
930
|
+
}
|
|
931
|
+
var args = slice.call(arguments, 1);
|
|
932
|
+
|
|
933
|
+
var bound;
|
|
934
|
+
var binder = function () {
|
|
935
|
+
if (this instanceof bound) {
|
|
936
|
+
var result = target.apply(
|
|
937
|
+
this,
|
|
938
|
+
args.concat(slice.call(arguments))
|
|
939
|
+
);
|
|
940
|
+
if (Object(result) === result) {
|
|
941
|
+
return result;
|
|
942
|
+
}
|
|
943
|
+
return this;
|
|
944
|
+
} else {
|
|
945
|
+
return target.apply(
|
|
946
|
+
that,
|
|
947
|
+
args.concat(slice.call(arguments))
|
|
948
|
+
);
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
|
|
952
|
+
var boundLength = Math.max(0, target.length - args.length);
|
|
953
|
+
var boundArgs = [];
|
|
954
|
+
for (var i = 0; i < boundLength; i++) {
|
|
955
|
+
boundArgs.push('$' + i);
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
|
|
959
|
+
|
|
960
|
+
if (target.prototype) {
|
|
961
|
+
var Empty = function Empty() {};
|
|
962
|
+
Empty.prototype = target.prototype;
|
|
963
|
+
bound.prototype = new Empty();
|
|
964
|
+
Empty.prototype = null;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
return bound;
|
|
968
|
+
};
|
|
969
|
+
|
|
970
|
+
},{}],10:[function(require,module,exports){
|
|
971
|
+
'use strict';
|
|
972
|
+
|
|
973
|
+
var implementation = require('./implementation');
|
|
974
|
+
|
|
975
|
+
module.exports = Function.prototype.bind || implementation;
|
|
976
|
+
|
|
977
|
+
},{"./implementation":9}],11:[function(require,module,exports){
|
|
978
|
+
'use strict';
|
|
979
|
+
|
|
980
|
+
var undefined;
|
|
981
|
+
|
|
982
|
+
var $SyntaxError = SyntaxError;
|
|
983
|
+
var $Function = Function;
|
|
984
|
+
var $TypeError = TypeError;
|
|
985
|
+
|
|
986
|
+
// eslint-disable-next-line consistent-return
|
|
987
|
+
var getEvalledConstructor = function (expressionSyntax) {
|
|
988
|
+
try {
|
|
989
|
+
return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
|
|
990
|
+
} catch (e) {}
|
|
991
|
+
};
|
|
992
|
+
|
|
993
|
+
var $gOPD = Object.getOwnPropertyDescriptor;
|
|
994
|
+
if ($gOPD) {
|
|
995
|
+
try {
|
|
996
|
+
$gOPD({}, '');
|
|
997
|
+
} catch (e) {
|
|
998
|
+
$gOPD = null; // this is IE 8, which has a broken gOPD
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
var throwTypeError = function () {
|
|
1003
|
+
throw new $TypeError();
|
|
1004
|
+
};
|
|
1005
|
+
var ThrowTypeError = $gOPD
|
|
1006
|
+
? (function () {
|
|
1007
|
+
try {
|
|
1008
|
+
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
|
|
1009
|
+
arguments.callee; // IE 8 does not throw here
|
|
1010
|
+
return throwTypeError;
|
|
1011
|
+
} catch (calleeThrows) {
|
|
1012
|
+
try {
|
|
1013
|
+
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
|
1014
|
+
return $gOPD(arguments, 'callee').get;
|
|
1015
|
+
} catch (gOPDthrows) {
|
|
1016
|
+
return throwTypeError;
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
}())
|
|
1020
|
+
: throwTypeError;
|
|
1021
|
+
|
|
1022
|
+
var hasSymbols = require('has-symbols')();
|
|
1023
|
+
|
|
1024
|
+
var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
|
|
1025
|
+
|
|
1026
|
+
var needsEval = {};
|
|
1027
|
+
|
|
1028
|
+
var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
|
|
1029
|
+
|
|
1030
|
+
var INTRINSICS = {
|
|
1031
|
+
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
|
|
1032
|
+
'%Array%': Array,
|
|
1033
|
+
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
|
|
1034
|
+
'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
|
|
1035
|
+
'%AsyncFromSyncIteratorPrototype%': undefined,
|
|
1036
|
+
'%AsyncFunction%': needsEval,
|
|
1037
|
+
'%AsyncGenerator%': needsEval,
|
|
1038
|
+
'%AsyncGeneratorFunction%': needsEval,
|
|
1039
|
+
'%AsyncIteratorPrototype%': needsEval,
|
|
1040
|
+
'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
|
|
1041
|
+
'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
|
|
1042
|
+
'%Boolean%': Boolean,
|
|
1043
|
+
'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
|
|
1044
|
+
'%Date%': Date,
|
|
1045
|
+
'%decodeURI%': decodeURI,
|
|
1046
|
+
'%decodeURIComponent%': decodeURIComponent,
|
|
1047
|
+
'%encodeURI%': encodeURI,
|
|
1048
|
+
'%encodeURIComponent%': encodeURIComponent,
|
|
1049
|
+
'%Error%': Error,
|
|
1050
|
+
'%eval%': eval, // eslint-disable-line no-eval
|
|
1051
|
+
'%EvalError%': EvalError,
|
|
1052
|
+
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
|
|
1053
|
+
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
|
|
1054
|
+
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
|
|
1055
|
+
'%Function%': $Function,
|
|
1056
|
+
'%GeneratorFunction%': needsEval,
|
|
1057
|
+
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
|
|
1058
|
+
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
|
|
1059
|
+
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
|
|
1060
|
+
'%isFinite%': isFinite,
|
|
1061
|
+
'%isNaN%': isNaN,
|
|
1062
|
+
'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
|
1063
|
+
'%JSON%': typeof JSON === 'object' ? JSON : undefined,
|
|
1064
|
+
'%Map%': typeof Map === 'undefined' ? undefined : Map,
|
|
1065
|
+
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
|
|
1066
|
+
'%Math%': Math,
|
|
1067
|
+
'%Number%': Number,
|
|
1068
|
+
'%Object%': Object,
|
|
1069
|
+
'%parseFloat%': parseFloat,
|
|
1070
|
+
'%parseInt%': parseInt,
|
|
1071
|
+
'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
|
|
1072
|
+
'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
|
|
1073
|
+
'%RangeError%': RangeError,
|
|
1074
|
+
'%ReferenceError%': ReferenceError,
|
|
1075
|
+
'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
|
|
1076
|
+
'%RegExp%': RegExp,
|
|
1077
|
+
'%Set%': typeof Set === 'undefined' ? undefined : Set,
|
|
1078
|
+
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
|
|
1079
|
+
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
|
|
1080
|
+
'%String%': String,
|
|
1081
|
+
'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
|
|
1082
|
+
'%Symbol%': hasSymbols ? Symbol : undefined,
|
|
1083
|
+
'%SyntaxError%': $SyntaxError,
|
|
1084
|
+
'%ThrowTypeError%': ThrowTypeError,
|
|
1085
|
+
'%TypedArray%': TypedArray,
|
|
1086
|
+
'%TypeError%': $TypeError,
|
|
1087
|
+
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
|
|
1088
|
+
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
|
|
1089
|
+
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
|
|
1090
|
+
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
|
|
1091
|
+
'%URIError%': URIError,
|
|
1092
|
+
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
|
|
1093
|
+
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
|
|
1094
|
+
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
|
|
1095
|
+
};
|
|
1096
|
+
|
|
1097
|
+
var doEval = function doEval(name) {
|
|
1098
|
+
var value;
|
|
1099
|
+
if (name === '%AsyncFunction%') {
|
|
1100
|
+
value = getEvalledConstructor('async function () {}');
|
|
1101
|
+
} else if (name === '%GeneratorFunction%') {
|
|
1102
|
+
value = getEvalledConstructor('function* () {}');
|
|
1103
|
+
} else if (name === '%AsyncGeneratorFunction%') {
|
|
1104
|
+
value = getEvalledConstructor('async function* () {}');
|
|
1105
|
+
} else if (name === '%AsyncGenerator%') {
|
|
1106
|
+
var fn = doEval('%AsyncGeneratorFunction%');
|
|
1107
|
+
if (fn) {
|
|
1108
|
+
value = fn.prototype;
|
|
1109
|
+
}
|
|
1110
|
+
} else if (name === '%AsyncIteratorPrototype%') {
|
|
1111
|
+
var gen = doEval('%AsyncGenerator%');
|
|
1112
|
+
if (gen) {
|
|
1113
|
+
value = getProto(gen.prototype);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
INTRINSICS[name] = value;
|
|
1118
|
+
|
|
1119
|
+
return value;
|
|
1120
|
+
};
|
|
1121
|
+
|
|
1122
|
+
var LEGACY_ALIASES = {
|
|
1123
|
+
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
|
1124
|
+
'%ArrayPrototype%': ['Array', 'prototype'],
|
|
1125
|
+
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
|
1126
|
+
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
|
|
1127
|
+
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
|
|
1128
|
+
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
|
|
1129
|
+
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
|
|
1130
|
+
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
|
|
1131
|
+
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
|
|
1132
|
+
'%BooleanPrototype%': ['Boolean', 'prototype'],
|
|
1133
|
+
'%DataViewPrototype%': ['DataView', 'prototype'],
|
|
1134
|
+
'%DatePrototype%': ['Date', 'prototype'],
|
|
1135
|
+
'%ErrorPrototype%': ['Error', 'prototype'],
|
|
1136
|
+
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
|
|
1137
|
+
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
|
|
1138
|
+
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
|
|
1139
|
+
'%FunctionPrototype%': ['Function', 'prototype'],
|
|
1140
|
+
'%Generator%': ['GeneratorFunction', 'prototype'],
|
|
1141
|
+
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
|
|
1142
|
+
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
|
|
1143
|
+
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
|
|
1144
|
+
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
|
|
1145
|
+
'%JSONParse%': ['JSON', 'parse'],
|
|
1146
|
+
'%JSONStringify%': ['JSON', 'stringify'],
|
|
1147
|
+
'%MapPrototype%': ['Map', 'prototype'],
|
|
1148
|
+
'%NumberPrototype%': ['Number', 'prototype'],
|
|
1149
|
+
'%ObjectPrototype%': ['Object', 'prototype'],
|
|
1150
|
+
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
|
|
1151
|
+
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
|
|
1152
|
+
'%PromisePrototype%': ['Promise', 'prototype'],
|
|
1153
|
+
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
|
|
1154
|
+
'%Promise_all%': ['Promise', 'all'],
|
|
1155
|
+
'%Promise_reject%': ['Promise', 'reject'],
|
|
1156
|
+
'%Promise_resolve%': ['Promise', 'resolve'],
|
|
1157
|
+
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
|
|
1158
|
+
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
|
|
1159
|
+
'%RegExpPrototype%': ['RegExp', 'prototype'],
|
|
1160
|
+
'%SetPrototype%': ['Set', 'prototype'],
|
|
1161
|
+
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
|
|
1162
|
+
'%StringPrototype%': ['String', 'prototype'],
|
|
1163
|
+
'%SymbolPrototype%': ['Symbol', 'prototype'],
|
|
1164
|
+
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
|
|
1165
|
+
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
|
|
1166
|
+
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
|
|
1167
|
+
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
|
|
1168
|
+
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
|
|
1169
|
+
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
|
|
1170
|
+
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
|
|
1171
|
+
'%URIErrorPrototype%': ['URIError', 'prototype'],
|
|
1172
|
+
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
|
|
1173
|
+
'%WeakSetPrototype%': ['WeakSet', 'prototype']
|
|
1174
|
+
};
|
|
1175
|
+
|
|
1176
|
+
var bind = require('function-bind');
|
|
1177
|
+
var hasOwn = require('has');
|
|
1178
|
+
var $concat = bind.call(Function.call, Array.prototype.concat);
|
|
1179
|
+
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
|
|
1180
|
+
var $replace = bind.call(Function.call, String.prototype.replace);
|
|
1181
|
+
var $strSlice = bind.call(Function.call, String.prototype.slice);
|
|
1182
|
+
|
|
1183
|
+
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
|
|
1184
|
+
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
|
1185
|
+
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
|
|
1186
|
+
var stringToPath = function stringToPath(string) {
|
|
1187
|
+
var first = $strSlice(string, 0, 1);
|
|
1188
|
+
var last = $strSlice(string, -1);
|
|
1189
|
+
if (first === '%' && last !== '%') {
|
|
1190
|
+
throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
|
|
1191
|
+
} else if (last === '%' && first !== '%') {
|
|
1192
|
+
throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
|
|
1193
|
+
}
|
|
1194
|
+
var result = [];
|
|
1195
|
+
$replace(string, rePropName, function (match, number, quote, subString) {
|
|
1196
|
+
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
|
|
1197
|
+
});
|
|
1198
|
+
return result;
|
|
1199
|
+
};
|
|
1200
|
+
/* end adaptation */
|
|
1201
|
+
|
|
1202
|
+
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
|
1203
|
+
var intrinsicName = name;
|
|
1204
|
+
var alias;
|
|
1205
|
+
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
|
1206
|
+
alias = LEGACY_ALIASES[intrinsicName];
|
|
1207
|
+
intrinsicName = '%' + alias[0] + '%';
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
if (hasOwn(INTRINSICS, intrinsicName)) {
|
|
1211
|
+
var value = INTRINSICS[intrinsicName];
|
|
1212
|
+
if (value === needsEval) {
|
|
1213
|
+
value = doEval(intrinsicName);
|
|
1214
|
+
}
|
|
1215
|
+
if (typeof value === 'undefined' && !allowMissing) {
|
|
1216
|
+
throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
return {
|
|
1220
|
+
alias: alias,
|
|
1221
|
+
name: intrinsicName,
|
|
1222
|
+
value: value
|
|
1223
|
+
};
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
|
|
1227
|
+
};
|
|
1228
|
+
|
|
1229
|
+
module.exports = function GetIntrinsic(name, allowMissing) {
|
|
1230
|
+
if (typeof name !== 'string' || name.length === 0) {
|
|
1231
|
+
throw new $TypeError('intrinsic name must be a non-empty string');
|
|
1232
|
+
}
|
|
1233
|
+
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
|
1234
|
+
throw new $TypeError('"allowMissing" argument must be a boolean');
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
var parts = stringToPath(name);
|
|
1238
|
+
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
|
1239
|
+
|
|
1240
|
+
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
|
|
1241
|
+
var intrinsicRealName = intrinsic.name;
|
|
1242
|
+
var value = intrinsic.value;
|
|
1243
|
+
var skipFurtherCaching = false;
|
|
1244
|
+
|
|
1245
|
+
var alias = intrinsic.alias;
|
|
1246
|
+
if (alias) {
|
|
1247
|
+
intrinsicBaseName = alias[0];
|
|
1248
|
+
$spliceApply(parts, $concat([0, 1], alias));
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
|
1252
|
+
var part = parts[i];
|
|
1253
|
+
var first = $strSlice(part, 0, 1);
|
|
1254
|
+
var last = $strSlice(part, -1);
|
|
1255
|
+
if (
|
|
1256
|
+
(
|
|
1257
|
+
(first === '"' || first === "'" || first === '`')
|
|
1258
|
+
|| (last === '"' || last === "'" || last === '`')
|
|
1259
|
+
)
|
|
1260
|
+
&& first !== last
|
|
1261
|
+
) {
|
|
1262
|
+
throw new $SyntaxError('property names with quotes must have matching quotes');
|
|
1263
|
+
}
|
|
1264
|
+
if (part === 'constructor' || !isOwn) {
|
|
1265
|
+
skipFurtherCaching = true;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
intrinsicBaseName += '.' + part;
|
|
1269
|
+
intrinsicRealName = '%' + intrinsicBaseName + '%';
|
|
1270
|
+
|
|
1271
|
+
if (hasOwn(INTRINSICS, intrinsicRealName)) {
|
|
1272
|
+
value = INTRINSICS[intrinsicRealName];
|
|
1273
|
+
} else if (value != null) {
|
|
1274
|
+
if (!(part in value)) {
|
|
1275
|
+
if (!allowMissing) {
|
|
1276
|
+
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
1277
|
+
}
|
|
1278
|
+
return void undefined;
|
|
1279
|
+
}
|
|
1280
|
+
if ($gOPD && (i + 1) >= parts.length) {
|
|
1281
|
+
var desc = $gOPD(value, part);
|
|
1282
|
+
isOwn = !!desc;
|
|
1283
|
+
|
|
1284
|
+
// By convention, when a data property is converted to an accessor
|
|
1285
|
+
// property to emulate a data property that does not suffer from
|
|
1286
|
+
// the override mistake, that accessor's getter is marked with
|
|
1287
|
+
// an `originalValue` property. Here, when we detect this, we
|
|
1288
|
+
// uphold the illusion by pretending to see that original data
|
|
1289
|
+
// property, i.e., returning the value rather than the getter
|
|
1290
|
+
// itself.
|
|
1291
|
+
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
|
|
1292
|
+
value = desc.get;
|
|
1293
|
+
} else {
|
|
1294
|
+
value = value[part];
|
|
1295
|
+
}
|
|
1296
|
+
} else {
|
|
1297
|
+
isOwn = hasOwn(value, part);
|
|
1298
|
+
value = value[part];
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
if (isOwn && !skipFurtherCaching) {
|
|
1302
|
+
INTRINSICS[intrinsicRealName] = value;
|
|
1303
|
+
}
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
return value;
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
},{"function-bind":10,"has":14,"has-symbols":12}],12:[function(require,module,exports){
|
|
1310
|
+
'use strict';
|
|
1311
|
+
|
|
1312
|
+
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
|
1313
|
+
var hasSymbolSham = require('./shams');
|
|
1314
|
+
|
|
1315
|
+
module.exports = function hasNativeSymbols() {
|
|
1316
|
+
if (typeof origSymbol !== 'function') { return false; }
|
|
1317
|
+
if (typeof Symbol !== 'function') { return false; }
|
|
1318
|
+
if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
|
1319
|
+
if (typeof Symbol('bar') !== 'symbol') { return false; }
|
|
1320
|
+
|
|
1321
|
+
return hasSymbolSham();
|
|
1322
|
+
};
|
|
1323
|
+
|
|
1324
|
+
},{"./shams":13}],13:[function(require,module,exports){
|
|
1325
|
+
'use strict';
|
|
1326
|
+
|
|
1327
|
+
/* eslint complexity: [2, 18], max-statements: [2, 33] */
|
|
1328
|
+
module.exports = function hasSymbols() {
|
|
1329
|
+
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
|
1330
|
+
if (typeof Symbol.iterator === 'symbol') { return true; }
|
|
1331
|
+
|
|
1332
|
+
var obj = {};
|
|
1333
|
+
var sym = Symbol('test');
|
|
1334
|
+
var symObj = Object(sym);
|
|
1335
|
+
if (typeof sym === 'string') { return false; }
|
|
1336
|
+
|
|
1337
|
+
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
|
1338
|
+
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
|
1339
|
+
|
|
1340
|
+
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
1341
|
+
// if (sym instanceof Symbol) { return false; }
|
|
1342
|
+
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
1343
|
+
// if (!(symObj instanceof Symbol)) { return false; }
|
|
1344
|
+
|
|
1345
|
+
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
1346
|
+
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
1347
|
+
|
|
1348
|
+
var symVal = 42;
|
|
1349
|
+
obj[sym] = symVal;
|
|
1350
|
+
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
|
1351
|
+
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
|
1352
|
+
|
|
1353
|
+
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
|
1354
|
+
|
|
1355
|
+
var syms = Object.getOwnPropertySymbols(obj);
|
|
1356
|
+
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
|
1357
|
+
|
|
1358
|
+
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
|
1359
|
+
|
|
1360
|
+
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
|
1361
|
+
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
|
1362
|
+
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
return true;
|
|
1366
|
+
};
|
|
1367
|
+
|
|
1368
|
+
},{}],14:[function(require,module,exports){
|
|
1369
|
+
'use strict';
|
|
1370
|
+
|
|
1371
|
+
var bind = require('function-bind');
|
|
1372
|
+
|
|
1373
|
+
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
|
1374
|
+
|
|
1375
|
+
},{"function-bind":10}],15:[function(require,module,exports){
|
|
1376
|
+
var hasMap = typeof Map === 'function' && Map.prototype;
|
|
1377
|
+
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
|
1378
|
+
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
|
1379
|
+
var mapForEach = hasMap && Map.prototype.forEach;
|
|
1380
|
+
var hasSet = typeof Set === 'function' && Set.prototype;
|
|
1381
|
+
var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
|
|
1382
|
+
var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
|
|
1383
|
+
var setForEach = hasSet && Set.prototype.forEach;
|
|
1384
|
+
var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
|
|
1385
|
+
var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
|
|
1386
|
+
var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
|
|
1387
|
+
var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
|
|
1388
|
+
var booleanValueOf = Boolean.prototype.valueOf;
|
|
1389
|
+
var objectToString = Object.prototype.toString;
|
|
1390
|
+
var functionToString = Function.prototype.toString;
|
|
1391
|
+
var match = String.prototype.match;
|
|
1392
|
+
var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
|
|
1393
|
+
var gOPS = Object.getOwnPropertySymbols;
|
|
1394
|
+
var symToString = typeof Symbol === 'function' ? Symbol.prototype.toString : null;
|
|
1395
|
+
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
|
1396
|
+
|
|
1397
|
+
var inspectCustom = require('./util.inspect').custom;
|
|
1398
|
+
var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
|
|
1399
|
+
|
|
1400
|
+
module.exports = function inspect_(obj, options, depth, seen) {
|
|
1401
|
+
var opts = options || {};
|
|
1402
|
+
|
|
1403
|
+
if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
|
|
1404
|
+
throw new TypeError('option "quoteStyle" must be "single" or "double"');
|
|
1405
|
+
}
|
|
1406
|
+
if (
|
|
1407
|
+
has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
|
|
1408
|
+
? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
|
|
1409
|
+
: opts.maxStringLength !== null
|
|
1410
|
+
)
|
|
1411
|
+
) {
|
|
1412
|
+
throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
|
|
1413
|
+
}
|
|
1414
|
+
var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
|
|
1415
|
+
if (typeof customInspect !== 'boolean') {
|
|
1416
|
+
throw new TypeError('option "customInspect", if provided, must be `true` or `false`');
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
if (
|
|
1420
|
+
has(opts, 'indent')
|
|
1421
|
+
&& opts.indent !== null
|
|
1422
|
+
&& opts.indent !== '\t'
|
|
1423
|
+
&& !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
|
|
1424
|
+
) {
|
|
1425
|
+
throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
if (typeof obj === 'undefined') {
|
|
1429
|
+
return 'undefined';
|
|
1430
|
+
}
|
|
1431
|
+
if (obj === null) {
|
|
1432
|
+
return 'null';
|
|
1433
|
+
}
|
|
1434
|
+
if (typeof obj === 'boolean') {
|
|
1435
|
+
return obj ? 'true' : 'false';
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1438
|
+
if (typeof obj === 'string') {
|
|
1439
|
+
return inspectString(obj, opts);
|
|
1440
|
+
}
|
|
1441
|
+
if (typeof obj === 'number') {
|
|
1442
|
+
if (obj === 0) {
|
|
1443
|
+
return Infinity / obj > 0 ? '0' : '-0';
|
|
1444
|
+
}
|
|
1445
|
+
return String(obj);
|
|
1446
|
+
}
|
|
1447
|
+
if (typeof obj === 'bigint') {
|
|
1448
|
+
return String(obj) + 'n';
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
|
|
1452
|
+
if (typeof depth === 'undefined') { depth = 0; }
|
|
1453
|
+
if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
|
|
1454
|
+
return isArray(obj) ? '[Array]' : '[Object]';
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
var indent = getIndent(opts, depth);
|
|
1458
|
+
|
|
1459
|
+
if (typeof seen === 'undefined') {
|
|
1460
|
+
seen = [];
|
|
1461
|
+
} else if (indexOf(seen, obj) >= 0) {
|
|
1462
|
+
return '[Circular]';
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
function inspect(value, from, noIndent) {
|
|
1466
|
+
if (from) {
|
|
1467
|
+
seen = seen.slice();
|
|
1468
|
+
seen.push(from);
|
|
1469
|
+
}
|
|
1470
|
+
if (noIndent) {
|
|
1471
|
+
var newOpts = {
|
|
1472
|
+
depth: opts.depth
|
|
1473
|
+
};
|
|
1474
|
+
if (has(opts, 'quoteStyle')) {
|
|
1475
|
+
newOpts.quoteStyle = opts.quoteStyle;
|
|
1476
|
+
}
|
|
1477
|
+
return inspect_(value, newOpts, depth + 1, seen);
|
|
1478
|
+
}
|
|
1479
|
+
return inspect_(value, opts, depth + 1, seen);
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
if (typeof obj === 'function') {
|
|
1483
|
+
var name = nameOf(obj);
|
|
1484
|
+
var keys = arrObjKeys(obj, inspect);
|
|
1485
|
+
return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + keys.join(', ') + ' }' : '');
|
|
1486
|
+
}
|
|
1487
|
+
if (isSymbol(obj)) {
|
|
1488
|
+
var symString = symToString.call(obj);
|
|
1489
|
+
return typeof obj === 'object' ? markBoxed(symString) : symString;
|
|
1490
|
+
}
|
|
1491
|
+
if (isElement(obj)) {
|
|
1492
|
+
var s = '<' + String(obj.nodeName).toLowerCase();
|
|
1493
|
+
var attrs = obj.attributes || [];
|
|
1494
|
+
for (var i = 0; i < attrs.length; i++) {
|
|
1495
|
+
s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
|
|
1496
|
+
}
|
|
1497
|
+
s += '>';
|
|
1498
|
+
if (obj.childNodes && obj.childNodes.length) { s += '...'; }
|
|
1499
|
+
s += '</' + String(obj.nodeName).toLowerCase() + '>';
|
|
1500
|
+
return s;
|
|
1501
|
+
}
|
|
1502
|
+
if (isArray(obj)) {
|
|
1503
|
+
if (obj.length === 0) { return '[]'; }
|
|
1504
|
+
var xs = arrObjKeys(obj, inspect);
|
|
1505
|
+
if (indent && !singleLineValues(xs)) {
|
|
1506
|
+
return '[' + indentedJoin(xs, indent) + ']';
|
|
1507
|
+
}
|
|
1508
|
+
return '[ ' + xs.join(', ') + ' ]';
|
|
1509
|
+
}
|
|
1510
|
+
if (isError(obj)) {
|
|
1511
|
+
var parts = arrObjKeys(obj, inspect);
|
|
1512
|
+
if (parts.length === 0) { return '[' + String(obj) + ']'; }
|
|
1513
|
+
return '{ [' + String(obj) + '] ' + parts.join(', ') + ' }';
|
|
1514
|
+
}
|
|
1515
|
+
if (typeof obj === 'object' && customInspect) {
|
|
1516
|
+
if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
|
|
1517
|
+
return obj[inspectSymbol]();
|
|
1518
|
+
} else if (typeof obj.inspect === 'function') {
|
|
1519
|
+
return obj.inspect();
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
if (isMap(obj)) {
|
|
1523
|
+
var mapParts = [];
|
|
1524
|
+
mapForEach.call(obj, function (value, key) {
|
|
1525
|
+
mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
|
|
1526
|
+
});
|
|
1527
|
+
return collectionOf('Map', mapSize.call(obj), mapParts, indent);
|
|
1528
|
+
}
|
|
1529
|
+
if (isSet(obj)) {
|
|
1530
|
+
var setParts = [];
|
|
1531
|
+
setForEach.call(obj, function (value) {
|
|
1532
|
+
setParts.push(inspect(value, obj));
|
|
1533
|
+
});
|
|
1534
|
+
return collectionOf('Set', setSize.call(obj), setParts, indent);
|
|
1535
|
+
}
|
|
1536
|
+
if (isWeakMap(obj)) {
|
|
1537
|
+
return weakCollectionOf('WeakMap');
|
|
1538
|
+
}
|
|
1539
|
+
if (isWeakSet(obj)) {
|
|
1540
|
+
return weakCollectionOf('WeakSet');
|
|
1541
|
+
}
|
|
1542
|
+
if (isNumber(obj)) {
|
|
1543
|
+
return markBoxed(inspect(Number(obj)));
|
|
1544
|
+
}
|
|
1545
|
+
if (isBigInt(obj)) {
|
|
1546
|
+
return markBoxed(inspect(bigIntValueOf.call(obj)));
|
|
1547
|
+
}
|
|
1548
|
+
if (isBoolean(obj)) {
|
|
1549
|
+
return markBoxed(booleanValueOf.call(obj));
|
|
1550
|
+
}
|
|
1551
|
+
if (isString(obj)) {
|
|
1552
|
+
return markBoxed(inspect(String(obj)));
|
|
1553
|
+
}
|
|
1554
|
+
if (!isDate(obj) && !isRegExp(obj)) {
|
|
1555
|
+
var ys = arrObjKeys(obj, inspect);
|
|
1556
|
+
if (ys.length === 0) { return '{}'; }
|
|
1557
|
+
if (indent) {
|
|
1558
|
+
return '{' + indentedJoin(ys, indent) + '}';
|
|
1559
|
+
}
|
|
1560
|
+
return '{ ' + ys.join(', ') + ' }';
|
|
1561
|
+
}
|
|
1562
|
+
return String(obj);
|
|
1563
|
+
};
|
|
1564
|
+
|
|
1565
|
+
function wrapQuotes(s, defaultStyle, opts) {
|
|
1566
|
+
var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
|
|
1567
|
+
return quoteChar + s + quoteChar;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
function quote(s) {
|
|
1571
|
+
return String(s).replace(/"/g, '"');
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
function isArray(obj) { return toStr(obj) === '[object Array]'; }
|
|
1575
|
+
function isDate(obj) { return toStr(obj) === '[object Date]'; }
|
|
1576
|
+
function isRegExp(obj) { return toStr(obj) === '[object RegExp]'; }
|
|
1577
|
+
function isError(obj) { return toStr(obj) === '[object Error]'; }
|
|
1578
|
+
function isSymbol(obj) { return toStr(obj) === '[object Symbol]'; }
|
|
1579
|
+
function isString(obj) { return toStr(obj) === '[object String]'; }
|
|
1580
|
+
function isNumber(obj) { return toStr(obj) === '[object Number]'; }
|
|
1581
|
+
function isBigInt(obj) { return toStr(obj) === '[object BigInt]'; }
|
|
1582
|
+
function isBoolean(obj) { return toStr(obj) === '[object Boolean]'; }
|
|
1583
|
+
|
|
1584
|
+
var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
|
|
1585
|
+
function has(obj, key) {
|
|
1586
|
+
return hasOwn.call(obj, key);
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
function toStr(obj) {
|
|
1590
|
+
return objectToString.call(obj);
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
function nameOf(f) {
|
|
1594
|
+
if (f.name) { return f.name; }
|
|
1595
|
+
var m = match.call(functionToString.call(f), /^function\s*([\w$]+)/);
|
|
1596
|
+
if (m) { return m[1]; }
|
|
1597
|
+
return null;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
function indexOf(xs, x) {
|
|
1601
|
+
if (xs.indexOf) { return xs.indexOf(x); }
|
|
1602
|
+
for (var i = 0, l = xs.length; i < l; i++) {
|
|
1603
|
+
if (xs[i] === x) { return i; }
|
|
1604
|
+
}
|
|
1605
|
+
return -1;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
function isMap(x) {
|
|
1609
|
+
if (!mapSize || !x || typeof x !== 'object') {
|
|
1610
|
+
return false;
|
|
1611
|
+
}
|
|
1612
|
+
try {
|
|
1613
|
+
mapSize.call(x);
|
|
1614
|
+
try {
|
|
1615
|
+
setSize.call(x);
|
|
1616
|
+
} catch (s) {
|
|
1617
|
+
return true;
|
|
1618
|
+
}
|
|
1619
|
+
return x instanceof Map; // core-js workaround, pre-v2.5.0
|
|
1620
|
+
} catch (e) {}
|
|
1621
|
+
return false;
|
|
1622
|
+
}
|
|
1623
|
+
|
|
1624
|
+
function isWeakMap(x) {
|
|
1625
|
+
if (!weakMapHas || !x || typeof x !== 'object') {
|
|
1626
|
+
return false;
|
|
1627
|
+
}
|
|
1628
|
+
try {
|
|
1629
|
+
weakMapHas.call(x, weakMapHas);
|
|
1630
|
+
try {
|
|
1631
|
+
weakSetHas.call(x, weakSetHas);
|
|
1632
|
+
} catch (s) {
|
|
1633
|
+
return true;
|
|
1634
|
+
}
|
|
1635
|
+
return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
|
|
1636
|
+
} catch (e) {}
|
|
1637
|
+
return false;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
function isSet(x) {
|
|
1641
|
+
if (!setSize || !x || typeof x !== 'object') {
|
|
1642
|
+
return false;
|
|
1643
|
+
}
|
|
1644
|
+
try {
|
|
1645
|
+
setSize.call(x);
|
|
1646
|
+
try {
|
|
1647
|
+
mapSize.call(x);
|
|
1648
|
+
} catch (m) {
|
|
1649
|
+
return true;
|
|
1650
|
+
}
|
|
1651
|
+
return x instanceof Set; // core-js workaround, pre-v2.5.0
|
|
1652
|
+
} catch (e) {}
|
|
1653
|
+
return false;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
function isWeakSet(x) {
|
|
1657
|
+
if (!weakSetHas || !x || typeof x !== 'object') {
|
|
1658
|
+
return false;
|
|
1659
|
+
}
|
|
1660
|
+
try {
|
|
1661
|
+
weakSetHas.call(x, weakSetHas);
|
|
1662
|
+
try {
|
|
1663
|
+
weakMapHas.call(x, weakMapHas);
|
|
1664
|
+
} catch (s) {
|
|
1665
|
+
return true;
|
|
1666
|
+
}
|
|
1667
|
+
return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
|
|
1668
|
+
} catch (e) {}
|
|
1669
|
+
return false;
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
function isElement(x) {
|
|
1673
|
+
if (!x || typeof x !== 'object') { return false; }
|
|
1674
|
+
if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
|
|
1675
|
+
return true;
|
|
1676
|
+
}
|
|
1677
|
+
return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
|
|
1678
|
+
}
|
|
1679
|
+
|
|
1680
|
+
function inspectString(str, opts) {
|
|
1681
|
+
if (str.length > opts.maxStringLength) {
|
|
1682
|
+
var remaining = str.length - opts.maxStringLength;
|
|
1683
|
+
var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
|
|
1684
|
+
return inspectString(str.slice(0, opts.maxStringLength), opts) + trailer;
|
|
1685
|
+
}
|
|
1686
|
+
// eslint-disable-next-line no-control-regex
|
|
1687
|
+
var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte);
|
|
1688
|
+
return wrapQuotes(s, 'single', opts);
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
function lowbyte(c) {
|
|
1692
|
+
var n = c.charCodeAt(0);
|
|
1693
|
+
var x = {
|
|
1694
|
+
8: 'b',
|
|
1695
|
+
9: 't',
|
|
1696
|
+
10: 'n',
|
|
1697
|
+
12: 'f',
|
|
1698
|
+
13: 'r'
|
|
1699
|
+
}[n];
|
|
1700
|
+
if (x) { return '\\' + x; }
|
|
1701
|
+
return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16).toUpperCase();
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
function markBoxed(str) {
|
|
1705
|
+
return 'Object(' + str + ')';
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
function weakCollectionOf(type) {
|
|
1709
|
+
return type + ' { ? }';
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
function collectionOf(type, size, entries, indent) {
|
|
1713
|
+
var joinedEntries = indent ? indentedJoin(entries, indent) : entries.join(', ');
|
|
1714
|
+
return type + ' (' + size + ') {' + joinedEntries + '}';
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
function singleLineValues(xs) {
|
|
1718
|
+
for (var i = 0; i < xs.length; i++) {
|
|
1719
|
+
if (indexOf(xs[i], '\n') >= 0) {
|
|
1720
|
+
return false;
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
return true;
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
function getIndent(opts, depth) {
|
|
1727
|
+
var baseIndent;
|
|
1728
|
+
if (opts.indent === '\t') {
|
|
1729
|
+
baseIndent = '\t';
|
|
1730
|
+
} else if (typeof opts.indent === 'number' && opts.indent > 0) {
|
|
1731
|
+
baseIndent = Array(opts.indent + 1).join(' ');
|
|
1732
|
+
} else {
|
|
1733
|
+
return null;
|
|
1734
|
+
}
|
|
1735
|
+
return {
|
|
1736
|
+
base: baseIndent,
|
|
1737
|
+
prev: Array(depth + 1).join(baseIndent)
|
|
1738
|
+
};
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
function indentedJoin(xs, indent) {
|
|
1742
|
+
if (xs.length === 0) { return ''; }
|
|
1743
|
+
var lineJoiner = '\n' + indent.prev + indent.base;
|
|
1744
|
+
return lineJoiner + xs.join(',' + lineJoiner) + '\n' + indent.prev;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
function arrObjKeys(obj, inspect) {
|
|
1748
|
+
var isArr = isArray(obj);
|
|
1749
|
+
var xs = [];
|
|
1750
|
+
if (isArr) {
|
|
1751
|
+
xs.length = obj.length;
|
|
1752
|
+
for (var i = 0; i < obj.length; i++) {
|
|
1753
|
+
xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
for (var key in obj) { // eslint-disable-line no-restricted-syntax
|
|
1757
|
+
if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
|
|
1758
|
+
if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
|
|
1759
|
+
if ((/[^\w$]/).test(key)) {
|
|
1760
|
+
xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
|
|
1761
|
+
} else {
|
|
1762
|
+
xs.push(key + ': ' + inspect(obj[key], obj));
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
if (typeof gOPS === 'function') {
|
|
1766
|
+
var syms = gOPS(obj);
|
|
1767
|
+
for (var j = 0; j < syms.length; j++) {
|
|
1768
|
+
if (isEnumerable.call(obj, syms[j])) {
|
|
1769
|
+
xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
|
|
1770
|
+
}
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
return xs;
|
|
1774
|
+
}
|
|
1775
|
+
|
|
1776
|
+
},{"./util.inspect":6}],16:[function(require,module,exports){
|
|
1777
|
+
'use strict';
|
|
1778
|
+
|
|
1779
|
+
var GetIntrinsic = require('get-intrinsic');
|
|
1780
|
+
var callBound = require('call-bind/callBound');
|
|
1781
|
+
var inspect = require('object-inspect');
|
|
1782
|
+
|
|
1783
|
+
var $TypeError = GetIntrinsic('%TypeError%');
|
|
1784
|
+
var $WeakMap = GetIntrinsic('%WeakMap%', true);
|
|
1785
|
+
var $Map = GetIntrinsic('%Map%', true);
|
|
1786
|
+
|
|
1787
|
+
var $weakMapGet = callBound('WeakMap.prototype.get', true);
|
|
1788
|
+
var $weakMapSet = callBound('WeakMap.prototype.set', true);
|
|
1789
|
+
var $weakMapHas = callBound('WeakMap.prototype.has', true);
|
|
1790
|
+
var $mapGet = callBound('Map.prototype.get', true);
|
|
1791
|
+
var $mapSet = callBound('Map.prototype.set', true);
|
|
1792
|
+
var $mapHas = callBound('Map.prototype.has', true);
|
|
1793
|
+
|
|
1794
|
+
/*
|
|
1795
|
+
* This function traverses the list returning the node corresponding to the
|
|
1796
|
+
* given key.
|
|
1797
|
+
*
|
|
1798
|
+
* That node is also moved to the head of the list, so that if it's accessed
|
|
1799
|
+
* again we don't need to traverse the whole list. By doing so, all the recently
|
|
1800
|
+
* used nodes can be accessed relatively quickly.
|
|
1801
|
+
*/
|
|
1802
|
+
var listGetNode = function (list, key) { // eslint-disable-line consistent-return
|
|
1803
|
+
for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
|
|
1804
|
+
if (curr.key === key) {
|
|
1805
|
+
prev.next = curr.next;
|
|
1806
|
+
curr.next = list.next;
|
|
1807
|
+
list.next = curr; // eslint-disable-line no-param-reassign
|
|
1808
|
+
return curr;
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
};
|
|
1812
|
+
|
|
1813
|
+
var listGet = function (objects, key) {
|
|
1814
|
+
var node = listGetNode(objects, key);
|
|
1815
|
+
return node && node.value;
|
|
1816
|
+
};
|
|
1817
|
+
var listSet = function (objects, key, value) {
|
|
1818
|
+
var node = listGetNode(objects, key);
|
|
1819
|
+
if (node) {
|
|
1820
|
+
node.value = value;
|
|
1821
|
+
} else {
|
|
1822
|
+
// Prepend the new node to the beginning of the list
|
|
1823
|
+
objects.next = { // eslint-disable-line no-param-reassign
|
|
1824
|
+
key: key,
|
|
1825
|
+
next: objects.next,
|
|
1826
|
+
value: value
|
|
1827
|
+
};
|
|
1828
|
+
}
|
|
1829
|
+
};
|
|
1830
|
+
var listHas = function (objects, key) {
|
|
1831
|
+
return !!listGetNode(objects, key);
|
|
1832
|
+
};
|
|
1833
|
+
|
|
1834
|
+
module.exports = function getSideChannel() {
|
|
1835
|
+
var $wm;
|
|
1836
|
+
var $m;
|
|
1837
|
+
var $o;
|
|
1838
|
+
var channel = {
|
|
1839
|
+
assert: function (key) {
|
|
1840
|
+
if (!channel.has(key)) {
|
|
1841
|
+
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
1842
|
+
}
|
|
1843
|
+
},
|
|
1844
|
+
get: function (key) { // eslint-disable-line consistent-return
|
|
1845
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
1846
|
+
if ($wm) {
|
|
1847
|
+
return $weakMapGet($wm, key);
|
|
1848
|
+
}
|
|
1849
|
+
} else if ($Map) {
|
|
1850
|
+
if ($m) {
|
|
1851
|
+
return $mapGet($m, key);
|
|
1852
|
+
}
|
|
1853
|
+
} else {
|
|
1854
|
+
if ($o) { // eslint-disable-line no-lonely-if
|
|
1855
|
+
return listGet($o, key);
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
},
|
|
1859
|
+
has: function (key) {
|
|
1860
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
1861
|
+
if ($wm) {
|
|
1862
|
+
return $weakMapHas($wm, key);
|
|
1863
|
+
}
|
|
1864
|
+
} else if ($Map) {
|
|
1865
|
+
if ($m) {
|
|
1866
|
+
return $mapHas($m, key);
|
|
1867
|
+
}
|
|
1868
|
+
} else {
|
|
1869
|
+
if ($o) { // eslint-disable-line no-lonely-if
|
|
1870
|
+
return listHas($o, key);
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
return false;
|
|
1874
|
+
},
|
|
1875
|
+
set: function (key, value) {
|
|
1876
|
+
if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
|
1877
|
+
if (!$wm) {
|
|
1878
|
+
$wm = new $WeakMap();
|
|
1879
|
+
}
|
|
1880
|
+
$weakMapSet($wm, key, value);
|
|
1881
|
+
} else if ($Map) {
|
|
1882
|
+
if (!$m) {
|
|
1883
|
+
$m = new $Map();
|
|
1884
|
+
}
|
|
1885
|
+
$mapSet($m, key, value);
|
|
1886
|
+
} else {
|
|
1887
|
+
if (!$o) {
|
|
1888
|
+
/*
|
|
1889
|
+
* Initialize the linked list as an empty node, so that we don't have
|
|
1890
|
+
* to special-case handling of the first node: we can always refer to
|
|
1891
|
+
* it as (previous node).next, instead of something like (list).head
|
|
1892
|
+
*/
|
|
1893
|
+
$o = { key: {}, next: null };
|
|
1894
|
+
}
|
|
1895
|
+
listSet($o, key, value);
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
};
|
|
1899
|
+
return channel;
|
|
1900
|
+
};
|
|
1901
|
+
|
|
1902
|
+
},{"call-bind/callBound":7,"get-intrinsic":11,"object-inspect":15}]},{},[2])(2)
|
|
832
1903
|
});
|