[d24f17c] | 1 | (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
---|
| 2 | 'use strict';
|
---|
| 3 |
|
---|
| 4 | var replace = String.prototype.replace;
|
---|
| 5 | var percentTwenties = /%20/g;
|
---|
| 6 |
|
---|
| 7 | var Format = {
|
---|
| 8 | RFC1738: 'RFC1738',
|
---|
| 9 | RFC3986: 'RFC3986'
|
---|
| 10 | };
|
---|
| 11 |
|
---|
| 12 | module.exports = {
|
---|
| 13 | 'default': Format.RFC3986,
|
---|
| 14 | formatters: {
|
---|
| 15 | RFC1738: function (value) {
|
---|
| 16 | return replace.call(value, percentTwenties, '+');
|
---|
| 17 | },
|
---|
| 18 | RFC3986: function (value) {
|
---|
| 19 | return String(value);
|
---|
| 20 | }
|
---|
| 21 | },
|
---|
| 22 | RFC1738: Format.RFC1738,
|
---|
| 23 | RFC3986: Format.RFC3986
|
---|
| 24 | };
|
---|
| 25 |
|
---|
| 26 | },{}],2:[function(require,module,exports){
|
---|
| 27 | 'use strict';
|
---|
| 28 |
|
---|
| 29 | var stringify = require('./stringify');
|
---|
| 30 | var parse = require('./parse');
|
---|
| 31 | var formats = require('./formats');
|
---|
| 32 |
|
---|
| 33 | module.exports = {
|
---|
| 34 | formats: formats,
|
---|
| 35 | parse: parse,
|
---|
| 36 | stringify: stringify
|
---|
| 37 | };
|
---|
| 38 |
|
---|
| 39 | },{"./formats":1,"./parse":3,"./stringify":4}],3:[function(require,module,exports){
|
---|
| 40 | 'use strict';
|
---|
| 41 |
|
---|
| 42 | var utils = require('./utils');
|
---|
| 43 |
|
---|
| 44 | var has = Object.prototype.hasOwnProperty;
|
---|
| 45 | var isArray = Array.isArray;
|
---|
| 46 |
|
---|
| 47 | var defaults = {
|
---|
| 48 | allowDots: false,
|
---|
| 49 | allowPrototypes: false,
|
---|
| 50 | allowSparse: false,
|
---|
| 51 | arrayLimit: 20,
|
---|
| 52 | charset: 'utf-8',
|
---|
| 53 | charsetSentinel: false,
|
---|
| 54 | comma: false,
|
---|
| 55 | decoder: utils.decode,
|
---|
| 56 | delimiter: '&',
|
---|
| 57 | depth: 5,
|
---|
| 58 | ignoreQueryPrefix: false,
|
---|
| 59 | interpretNumericEntities: false,
|
---|
| 60 | parameterLimit: 1000,
|
---|
| 61 | parseArrays: true,
|
---|
| 62 | plainObjects: false,
|
---|
| 63 | strictNullHandling: false
|
---|
| 64 | };
|
---|
| 65 |
|
---|
| 66 | var interpretNumericEntities = function (str) {
|
---|
| 67 | return str.replace(/&#(\d+);/g, function ($0, numberStr) {
|
---|
| 68 | return String.fromCharCode(parseInt(numberStr, 10));
|
---|
| 69 | });
|
---|
| 70 | };
|
---|
| 71 |
|
---|
| 72 | var parseArrayValue = function (val, options) {
|
---|
| 73 | if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {
|
---|
| 74 | return val.split(',');
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | return val;
|
---|
| 78 | };
|
---|
| 79 |
|
---|
| 80 | // This is what browsers will submit when the ✓ character occurs in an
|
---|
| 81 | // application/x-www-form-urlencoded body and the encoding of the page containing
|
---|
| 82 | // the form is iso-8859-1, or when the submitted form has an accept-charset
|
---|
| 83 | // attribute of iso-8859-1. Presumably also with other charsets that do not contain
|
---|
| 84 | // the ✓ character, such as us-ascii.
|
---|
| 85 | var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓')
|
---|
| 86 |
|
---|
| 87 | // These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.
|
---|
| 88 | var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')
|
---|
| 89 |
|
---|
| 90 | var parseValues = function parseQueryStringValues(str, options) {
|
---|
| 91 | var obj = {};
|
---|
| 92 | var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str;
|
---|
| 93 | var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;
|
---|
| 94 | var parts = cleanStr.split(options.delimiter, limit);
|
---|
| 95 | var skipIndex = -1; // Keep track of where the utf8 sentinel was found
|
---|
| 96 | var i;
|
---|
| 97 |
|
---|
| 98 | var charset = options.charset;
|
---|
| 99 | if (options.charsetSentinel) {
|
---|
| 100 | for (i = 0; i < parts.length; ++i) {
|
---|
| 101 | if (parts[i].indexOf('utf8=') === 0) {
|
---|
| 102 | if (parts[i] === charsetSentinel) {
|
---|
| 103 | charset = 'utf-8';
|
---|
| 104 | } else if (parts[i] === isoSentinel) {
|
---|
| 105 | charset = 'iso-8859-1';
|
---|
| 106 | }
|
---|
| 107 | skipIndex = i;
|
---|
| 108 | i = parts.length; // The eslint settings do not allow break;
|
---|
| 109 | }
|
---|
| 110 | }
|
---|
| 111 | }
|
---|
| 112 |
|
---|
| 113 | for (i = 0; i < parts.length; ++i) {
|
---|
| 114 | if (i === skipIndex) {
|
---|
| 115 | continue;
|
---|
| 116 | }
|
---|
| 117 | var part = parts[i];
|
---|
| 118 |
|
---|
| 119 | var bracketEqualsPos = part.indexOf(']=');
|
---|
| 120 | var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;
|
---|
| 121 |
|
---|
| 122 | var key, val;
|
---|
| 123 | if (pos === -1) {
|
---|
| 124 | key = options.decoder(part, defaults.decoder, charset, 'key');
|
---|
| 125 | val = options.strictNullHandling ? null : '';
|
---|
| 126 | } else {
|
---|
| 127 | key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');
|
---|
| 128 | val = utils.maybeMap(
|
---|
| 129 | parseArrayValue(part.slice(pos + 1), options),
|
---|
| 130 | function (encodedVal) {
|
---|
| 131 | return options.decoder(encodedVal, defaults.decoder, charset, 'value');
|
---|
| 132 | }
|
---|
| 133 | );
|
---|
| 134 | }
|
---|
| 135 |
|
---|
| 136 | if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {
|
---|
| 137 | val = interpretNumericEntities(val);
|
---|
| 138 | }
|
---|
| 139 |
|
---|
| 140 | if (part.indexOf('[]=') > -1) {
|
---|
| 141 | val = isArray(val) ? [val] : val;
|
---|
| 142 | }
|
---|
| 143 |
|
---|
| 144 | if (has.call(obj, key)) {
|
---|
| 145 | obj[key] = utils.combine(obj[key], val);
|
---|
| 146 | } else {
|
---|
| 147 | obj[key] = val;
|
---|
| 148 | }
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 | return obj;
|
---|
| 152 | };
|
---|
| 153 |
|
---|
| 154 | var parseObject = function (chain, val, options, valuesParsed) {
|
---|
| 155 | var leaf = valuesParsed ? val : parseArrayValue(val, options);
|
---|
| 156 |
|
---|
| 157 | for (var i = chain.length - 1; i >= 0; --i) {
|
---|
| 158 | var obj;
|
---|
| 159 | var root = chain[i];
|
---|
| 160 |
|
---|
| 161 | if (root === '[]' && options.parseArrays) {
|
---|
| 162 | obj = [].concat(leaf);
|
---|
| 163 | } else {
|
---|
| 164 | obj = options.plainObjects ? Object.create(null) : {};
|
---|
| 165 | var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;
|
---|
| 166 | var index = parseInt(cleanRoot, 10);
|
---|
| 167 | if (!options.parseArrays && cleanRoot === '') {
|
---|
| 168 | obj = { 0: leaf };
|
---|
| 169 | } else if (
|
---|
| 170 | !isNaN(index)
|
---|
| 171 | && root !== cleanRoot
|
---|
| 172 | && String(index) === cleanRoot
|
---|
| 173 | && index >= 0
|
---|
| 174 | && (options.parseArrays && index <= options.arrayLimit)
|
---|
| 175 | ) {
|
---|
| 176 | obj = [];
|
---|
| 177 | obj[index] = leaf;
|
---|
| 178 | } else if (cleanRoot !== '__proto__') {
|
---|
| 179 | obj[cleanRoot] = leaf;
|
---|
| 180 | }
|
---|
| 181 | }
|
---|
| 182 |
|
---|
| 183 | leaf = obj;
|
---|
| 184 | }
|
---|
| 185 |
|
---|
| 186 | return leaf;
|
---|
| 187 | };
|
---|
| 188 |
|
---|
| 189 | var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {
|
---|
| 190 | if (!givenKey) {
|
---|
| 191 | return;
|
---|
| 192 | }
|
---|
| 193 |
|
---|
| 194 | // Transform dot notation to bracket notation
|
---|
| 195 | var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey;
|
---|
| 196 |
|
---|
| 197 | // The regex chunks
|
---|
| 198 |
|
---|
| 199 | var brackets = /(\[[^[\]]*])/;
|
---|
| 200 | var child = /(\[[^[\]]*])/g;
|
---|
| 201 |
|
---|
| 202 | // Get the parent
|
---|
| 203 |
|
---|
| 204 | var segment = options.depth > 0 && brackets.exec(key);
|
---|
| 205 | var parent = segment ? key.slice(0, segment.index) : key;
|
---|
| 206 |
|
---|
| 207 | // Stash the parent if it exists
|
---|
| 208 |
|
---|
| 209 | var keys = [];
|
---|
| 210 | if (parent) {
|
---|
| 211 | // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties
|
---|
| 212 | if (!options.plainObjects && has.call(Object.prototype, parent)) {
|
---|
| 213 | if (!options.allowPrototypes) {
|
---|
| 214 | return;
|
---|
| 215 | }
|
---|
| 216 | }
|
---|
| 217 |
|
---|
| 218 | keys.push(parent);
|
---|
| 219 | }
|
---|
| 220 |
|
---|
| 221 | // Loop through children appending to the array until we hit depth
|
---|
| 222 |
|
---|
| 223 | var i = 0;
|
---|
| 224 | while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {
|
---|
| 225 | i += 1;
|
---|
| 226 | if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {
|
---|
| 227 | if (!options.allowPrototypes) {
|
---|
| 228 | return;
|
---|
| 229 | }
|
---|
| 230 | }
|
---|
| 231 | keys.push(segment[1]);
|
---|
| 232 | }
|
---|
| 233 |
|
---|
| 234 | // If there's a remainder, just add whatever is left
|
---|
| 235 |
|
---|
| 236 | if (segment) {
|
---|
| 237 | keys.push('[' + key.slice(segment.index) + ']');
|
---|
| 238 | }
|
---|
| 239 |
|
---|
| 240 | return parseObject(keys, val, options, valuesParsed);
|
---|
| 241 | };
|
---|
| 242 |
|
---|
| 243 | var normalizeParseOptions = function normalizeParseOptions(opts) {
|
---|
| 244 | if (!opts) {
|
---|
| 245 | return defaults;
|
---|
| 246 | }
|
---|
| 247 |
|
---|
| 248 | if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {
|
---|
| 249 | throw new TypeError('Decoder has to be a function.');
|
---|
| 250 | }
|
---|
| 251 |
|
---|
| 252 | if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
|
---|
| 253 | throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
|
---|
| 254 | }
|
---|
| 255 | var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;
|
---|
| 256 |
|
---|
| 257 | return {
|
---|
| 258 | allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
|
---|
| 259 | allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,
|
---|
| 260 | allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,
|
---|
| 261 | arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,
|
---|
| 262 | charset: charset,
|
---|
| 263 | charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
|
---|
| 264 | comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,
|
---|
| 265 | decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,
|
---|
| 266 | delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,
|
---|
| 267 | // eslint-disable-next-line no-implicit-coercion, no-extra-parens
|
---|
| 268 | depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,
|
---|
| 269 | ignoreQueryPrefix: opts.ignoreQueryPrefix === true,
|
---|
| 270 | interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,
|
---|
| 271 | parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,
|
---|
| 272 | parseArrays: opts.parseArrays !== false,
|
---|
| 273 | plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,
|
---|
| 274 | strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
|
---|
| 275 | };
|
---|
| 276 | };
|
---|
| 277 |
|
---|
| 278 | module.exports = function (str, opts) {
|
---|
| 279 | var options = normalizeParseOptions(opts);
|
---|
| 280 |
|
---|
| 281 | if (str === '' || str === null || typeof str === 'undefined') {
|
---|
| 282 | return options.plainObjects ? Object.create(null) : {};
|
---|
| 283 | }
|
---|
| 284 |
|
---|
| 285 | var tempObj = typeof str === 'string' ? parseValues(str, options) : str;
|
---|
| 286 | var obj = options.plainObjects ? Object.create(null) : {};
|
---|
| 287 |
|
---|
| 288 | // Iterate over the keys and setup the new object
|
---|
| 289 |
|
---|
| 290 | var keys = Object.keys(tempObj);
|
---|
| 291 | for (var i = 0; i < keys.length; ++i) {
|
---|
| 292 | var key = keys[i];
|
---|
| 293 | var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');
|
---|
| 294 | obj = utils.merge(obj, newObj, options);
|
---|
| 295 | }
|
---|
| 296 |
|
---|
| 297 | if (options.allowSparse === true) {
|
---|
| 298 | return obj;
|
---|
| 299 | }
|
---|
| 300 |
|
---|
| 301 | return utils.compact(obj);
|
---|
| 302 | };
|
---|
| 303 |
|
---|
| 304 | },{"./utils":5}],4:[function(require,module,exports){
|
---|
| 305 | 'use strict';
|
---|
| 306 |
|
---|
| 307 | var getSideChannel = require('side-channel');
|
---|
| 308 | var utils = require('./utils');
|
---|
| 309 | var formats = require('./formats');
|
---|
| 310 | var has = Object.prototype.hasOwnProperty;
|
---|
| 311 |
|
---|
| 312 | var arrayPrefixGenerators = {
|
---|
| 313 | brackets: function brackets(prefix) {
|
---|
| 314 | return prefix + '[]';
|
---|
| 315 | },
|
---|
| 316 | comma: 'comma',
|
---|
| 317 | indices: function indices(prefix, key) {
|
---|
| 318 | return prefix + '[' + key + ']';
|
---|
| 319 | },
|
---|
| 320 | repeat: function repeat(prefix) {
|
---|
| 321 | return prefix;
|
---|
| 322 | }
|
---|
| 323 | };
|
---|
| 324 |
|
---|
| 325 | var isArray = Array.isArray;
|
---|
| 326 | var split = String.prototype.split;
|
---|
| 327 | var push = Array.prototype.push;
|
---|
| 328 | var pushToArray = function (arr, valueOrArray) {
|
---|
| 329 | push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);
|
---|
| 330 | };
|
---|
| 331 |
|
---|
| 332 | var toISO = Date.prototype.toISOString;
|
---|
| 333 |
|
---|
| 334 | var defaultFormat = formats['default'];
|
---|
| 335 | var defaults = {
|
---|
| 336 | addQueryPrefix: false,
|
---|
| 337 | allowDots: false,
|
---|
| 338 | charset: 'utf-8',
|
---|
| 339 | charsetSentinel: false,
|
---|
| 340 | delimiter: '&',
|
---|
| 341 | encode: true,
|
---|
| 342 | encoder: utils.encode,
|
---|
| 343 | encodeValuesOnly: false,
|
---|
| 344 | format: defaultFormat,
|
---|
| 345 | formatter: formats.formatters[defaultFormat],
|
---|
| 346 | // deprecated
|
---|
| 347 | indices: false,
|
---|
| 348 | serializeDate: function serializeDate(date) {
|
---|
| 349 | return toISO.call(date);
|
---|
| 350 | },
|
---|
| 351 | skipNulls: false,
|
---|
| 352 | strictNullHandling: false
|
---|
| 353 | };
|
---|
| 354 |
|
---|
| 355 | var isNonNullishPrimitive = function isNonNullishPrimitive(v) {
|
---|
| 356 | return typeof v === 'string'
|
---|
| 357 | || typeof v === 'number'
|
---|
| 358 | || typeof v === 'boolean'
|
---|
| 359 | || typeof v === 'symbol'
|
---|
| 360 | || typeof v === 'bigint';
|
---|
| 361 | };
|
---|
| 362 |
|
---|
| 363 | var sentinel = {};
|
---|
| 364 |
|
---|
| 365 | var stringify = function stringify(
|
---|
| 366 | object,
|
---|
| 367 | prefix,
|
---|
| 368 | generateArrayPrefix,
|
---|
| 369 | commaRoundTrip,
|
---|
| 370 | strictNullHandling,
|
---|
| 371 | skipNulls,
|
---|
| 372 | encoder,
|
---|
| 373 | filter,
|
---|
| 374 | sort,
|
---|
| 375 | allowDots,
|
---|
| 376 | serializeDate,
|
---|
| 377 | format,
|
---|
| 378 | formatter,
|
---|
| 379 | encodeValuesOnly,
|
---|
| 380 | charset,
|
---|
| 381 | sideChannel
|
---|
| 382 | ) {
|
---|
| 383 | var obj = object;
|
---|
| 384 |
|
---|
| 385 | var tmpSc = sideChannel;
|
---|
| 386 | var step = 0;
|
---|
| 387 | var findFlag = false;
|
---|
| 388 | while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {
|
---|
| 389 | // Where object last appeared in the ref tree
|
---|
| 390 | var pos = tmpSc.get(object);
|
---|
| 391 | step += 1;
|
---|
| 392 | if (typeof pos !== 'undefined') {
|
---|
| 393 | if (pos === step) {
|
---|
| 394 | throw new RangeError('Cyclic object value');
|
---|
| 395 | } else {
|
---|
| 396 | findFlag = true; // Break while
|
---|
| 397 | }
|
---|
| 398 | }
|
---|
| 399 | if (typeof tmpSc.get(sentinel) === 'undefined') {
|
---|
| 400 | step = 0;
|
---|
| 401 | }
|
---|
| 402 | }
|
---|
| 403 |
|
---|
| 404 | if (typeof filter === 'function') {
|
---|
| 405 | obj = filter(prefix, obj);
|
---|
| 406 | } else if (obj instanceof Date) {
|
---|
| 407 | obj = serializeDate(obj);
|
---|
| 408 | } else if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
---|
| 409 | obj = utils.maybeMap(obj, function (value) {
|
---|
| 410 | if (value instanceof Date) {
|
---|
| 411 | return serializeDate(value);
|
---|
| 412 | }
|
---|
| 413 | return value;
|
---|
| 414 | });
|
---|
| 415 | }
|
---|
| 416 |
|
---|
| 417 | if (obj === null) {
|
---|
| 418 | if (strictNullHandling) {
|
---|
| 419 | return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;
|
---|
| 420 | }
|
---|
| 421 |
|
---|
| 422 | obj = '';
|
---|
| 423 | }
|
---|
| 424 |
|
---|
| 425 | if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {
|
---|
| 426 | if (encoder) {
|
---|
| 427 | var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);
|
---|
| 428 | if (generateArrayPrefix === 'comma' && encodeValuesOnly) {
|
---|
| 429 | var valuesArray = split.call(String(obj), ',');
|
---|
| 430 | var valuesJoined = '';
|
---|
| 431 | for (var i = 0; i < valuesArray.length; ++i) {
|
---|
| 432 | valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));
|
---|
| 433 | }
|
---|
| 434 | return [formatter(keyValue) + (commaRoundTrip && isArray(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];
|
---|
| 435 | }
|
---|
| 436 | return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];
|
---|
| 437 | }
|
---|
| 438 | return [formatter(prefix) + '=' + formatter(String(obj))];
|
---|
| 439 | }
|
---|
| 440 |
|
---|
| 441 | var values = [];
|
---|
| 442 |
|
---|
| 443 | if (typeof obj === 'undefined') {
|
---|
| 444 | return values;
|
---|
| 445 | }
|
---|
| 446 |
|
---|
| 447 | var objKeys;
|
---|
| 448 | if (generateArrayPrefix === 'comma' && isArray(obj)) {
|
---|
| 449 | // we need to join elements in
|
---|
| 450 | objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];
|
---|
| 451 | } else if (isArray(filter)) {
|
---|
| 452 | objKeys = filter;
|
---|
| 453 | } else {
|
---|
| 454 | var keys = Object.keys(obj);
|
---|
| 455 | objKeys = sort ? keys.sort(sort) : keys;
|
---|
| 456 | }
|
---|
| 457 |
|
---|
| 458 | var adjustedPrefix = commaRoundTrip && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix;
|
---|
| 459 |
|
---|
| 460 | for (var j = 0; j < objKeys.length; ++j) {
|
---|
| 461 | var key = objKeys[j];
|
---|
| 462 | var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];
|
---|
| 463 |
|
---|
| 464 | if (skipNulls && value === null) {
|
---|
| 465 | continue;
|
---|
| 466 | }
|
---|
| 467 |
|
---|
| 468 | var keyPrefix = isArray(obj)
|
---|
| 469 | ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix
|
---|
| 470 | : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');
|
---|
| 471 |
|
---|
| 472 | sideChannel.set(object, step);
|
---|
| 473 | var valueSideChannel = getSideChannel();
|
---|
| 474 | valueSideChannel.set(sentinel, sideChannel);
|
---|
| 475 | pushToArray(values, stringify(
|
---|
| 476 | value,
|
---|
| 477 | keyPrefix,
|
---|
| 478 | generateArrayPrefix,
|
---|
| 479 | commaRoundTrip,
|
---|
| 480 | strictNullHandling,
|
---|
| 481 | skipNulls,
|
---|
| 482 | encoder,
|
---|
| 483 | filter,
|
---|
| 484 | sort,
|
---|
| 485 | allowDots,
|
---|
| 486 | serializeDate,
|
---|
| 487 | format,
|
---|
| 488 | formatter,
|
---|
| 489 | encodeValuesOnly,
|
---|
| 490 | charset,
|
---|
| 491 | valueSideChannel
|
---|
| 492 | ));
|
---|
| 493 | }
|
---|
| 494 |
|
---|
| 495 | return values;
|
---|
| 496 | };
|
---|
| 497 |
|
---|
| 498 | var normalizeStringifyOptions = function normalizeStringifyOptions(opts) {
|
---|
| 499 | if (!opts) {
|
---|
| 500 | return defaults;
|
---|
| 501 | }
|
---|
| 502 |
|
---|
| 503 | if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {
|
---|
| 504 | throw new TypeError('Encoder has to be a function.');
|
---|
| 505 | }
|
---|
| 506 |
|
---|
| 507 | var charset = opts.charset || defaults.charset;
|
---|
| 508 | if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {
|
---|
| 509 | throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');
|
---|
| 510 | }
|
---|
| 511 |
|
---|
| 512 | var format = formats['default'];
|
---|
| 513 | if (typeof opts.format !== 'undefined') {
|
---|
| 514 | if (!has.call(formats.formatters, opts.format)) {
|
---|
| 515 | throw new TypeError('Unknown format option provided.');
|
---|
| 516 | }
|
---|
| 517 | format = opts.format;
|
---|
| 518 | }
|
---|
| 519 | var formatter = formats.formatters[format];
|
---|
| 520 |
|
---|
| 521 | var filter = defaults.filter;
|
---|
| 522 | if (typeof opts.filter === 'function' || isArray(opts.filter)) {
|
---|
| 523 | filter = opts.filter;
|
---|
| 524 | }
|
---|
| 525 |
|
---|
| 526 | return {
|
---|
| 527 | addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,
|
---|
| 528 | allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,
|
---|
| 529 | charset: charset,
|
---|
| 530 | charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,
|
---|
| 531 | delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,
|
---|
| 532 | encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,
|
---|
| 533 | encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,
|
---|
| 534 | encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,
|
---|
| 535 | filter: filter,
|
---|
| 536 | format: format,
|
---|
| 537 | formatter: formatter,
|
---|
| 538 | serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,
|
---|
| 539 | skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,
|
---|
| 540 | sort: typeof opts.sort === 'function' ? opts.sort : null,
|
---|
| 541 | strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling
|
---|
| 542 | };
|
---|
| 543 | };
|
---|
| 544 |
|
---|
| 545 | module.exports = function (object, opts) {
|
---|
| 546 | var obj = object;
|
---|
| 547 | var options = normalizeStringifyOptions(opts);
|
---|
| 548 |
|
---|
| 549 | var objKeys;
|
---|
| 550 | var filter;
|
---|
| 551 |
|
---|
| 552 | if (typeof options.filter === 'function') {
|
---|
| 553 | filter = options.filter;
|
---|
| 554 | obj = filter('', obj);
|
---|
| 555 | } else if (isArray(options.filter)) {
|
---|
| 556 | filter = options.filter;
|
---|
| 557 | objKeys = filter;
|
---|
| 558 | }
|
---|
| 559 |
|
---|
| 560 | var keys = [];
|
---|
| 561 |
|
---|
| 562 | if (typeof obj !== 'object' || obj === null) {
|
---|
| 563 | return '';
|
---|
| 564 | }
|
---|
| 565 |
|
---|
| 566 | var arrayFormat;
|
---|
| 567 | if (opts && opts.arrayFormat in arrayPrefixGenerators) {
|
---|
| 568 | arrayFormat = opts.arrayFormat;
|
---|
| 569 | } else if (opts && 'indices' in opts) {
|
---|
| 570 | arrayFormat = opts.indices ? 'indices' : 'repeat';
|
---|
| 571 | } else {
|
---|
| 572 | arrayFormat = 'indices';
|
---|
| 573 | }
|
---|
| 574 |
|
---|
| 575 | var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];
|
---|
| 576 | if (opts && 'commaRoundTrip' in opts && typeof opts.commaRoundTrip !== 'boolean') {
|
---|
| 577 | throw new TypeError('`commaRoundTrip` must be a boolean, or absent');
|
---|
| 578 | }
|
---|
| 579 | var commaRoundTrip = generateArrayPrefix === 'comma' && opts && opts.commaRoundTrip;
|
---|
| 580 |
|
---|
| 581 | if (!objKeys) {
|
---|
| 582 | objKeys = Object.keys(obj);
|
---|
| 583 | }
|
---|
| 584 |
|
---|
| 585 | if (options.sort) {
|
---|
| 586 | objKeys.sort(options.sort);
|
---|
| 587 | }
|
---|
| 588 |
|
---|
| 589 | var sideChannel = getSideChannel();
|
---|
| 590 | for (var i = 0; i < objKeys.length; ++i) {
|
---|
| 591 | var key = objKeys[i];
|
---|
| 592 |
|
---|
| 593 | if (options.skipNulls && obj[key] === null) {
|
---|
| 594 | continue;
|
---|
| 595 | }
|
---|
| 596 | pushToArray(keys, stringify(
|
---|
| 597 | obj[key],
|
---|
| 598 | key,
|
---|
| 599 | generateArrayPrefix,
|
---|
| 600 | commaRoundTrip,
|
---|
| 601 | options.strictNullHandling,
|
---|
| 602 | options.skipNulls,
|
---|
| 603 | options.encode ? options.encoder : null,
|
---|
| 604 | options.filter,
|
---|
| 605 | options.sort,
|
---|
| 606 | options.allowDots,
|
---|
| 607 | options.serializeDate,
|
---|
| 608 | options.format,
|
---|
| 609 | options.formatter,
|
---|
| 610 | options.encodeValuesOnly,
|
---|
| 611 | options.charset,
|
---|
| 612 | sideChannel
|
---|
| 613 | ));
|
---|
| 614 | }
|
---|
| 615 |
|
---|
| 616 | var joined = keys.join(options.delimiter);
|
---|
| 617 | var prefix = options.addQueryPrefix === true ? '?' : '';
|
---|
| 618 |
|
---|
| 619 | if (options.charsetSentinel) {
|
---|
| 620 | if (options.charset === 'iso-8859-1') {
|
---|
| 621 | // encodeURIComponent('✓'), the "numeric entity" representation of a checkmark
|
---|
| 622 | prefix += 'utf8=%26%2310003%3B&';
|
---|
| 623 | } else {
|
---|
| 624 | // encodeURIComponent('✓')
|
---|
| 625 | prefix += 'utf8=%E2%9C%93&';
|
---|
| 626 | }
|
---|
| 627 | }
|
---|
| 628 |
|
---|
| 629 | return joined.length > 0 ? prefix + joined : '';
|
---|
| 630 | };
|
---|
| 631 |
|
---|
| 632 | },{"./formats":1,"./utils":5,"side-channel":16}],5:[function(require,module,exports){
|
---|
| 633 | 'use strict';
|
---|
| 634 |
|
---|
| 635 | var formats = require('./formats');
|
---|
| 636 |
|
---|
| 637 | var has = Object.prototype.hasOwnProperty;
|
---|
| 638 | var isArray = Array.isArray;
|
---|
| 639 |
|
---|
| 640 | var hexTable = (function () {
|
---|
| 641 | var array = [];
|
---|
| 642 | for (var i = 0; i < 256; ++i) {
|
---|
| 643 | array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
|
---|
| 644 | }
|
---|
| 645 |
|
---|
| 646 | return array;
|
---|
| 647 | }());
|
---|
| 648 |
|
---|
| 649 | var compactQueue = function compactQueue(queue) {
|
---|
| 650 | while (queue.length > 1) {
|
---|
| 651 | var item = queue.pop();
|
---|
| 652 | var obj = item.obj[item.prop];
|
---|
| 653 |
|
---|
| 654 | if (isArray(obj)) {
|
---|
| 655 | var compacted = [];
|
---|
| 656 |
|
---|
| 657 | for (var j = 0; j < obj.length; ++j) {
|
---|
| 658 | if (typeof obj[j] !== 'undefined') {
|
---|
| 659 | compacted.push(obj[j]);
|
---|
| 660 | }
|
---|
| 661 | }
|
---|
| 662 |
|
---|
| 663 | item.obj[item.prop] = compacted;
|
---|
| 664 | }
|
---|
| 665 | }
|
---|
| 666 | };
|
---|
| 667 |
|
---|
| 668 | var arrayToObject = function arrayToObject(source, options) {
|
---|
| 669 | var obj = options && options.plainObjects ? Object.create(null) : {};
|
---|
| 670 | for (var i = 0; i < source.length; ++i) {
|
---|
| 671 | if (typeof source[i] !== 'undefined') {
|
---|
| 672 | obj[i] = source[i];
|
---|
| 673 | }
|
---|
| 674 | }
|
---|
| 675 |
|
---|
| 676 | return obj;
|
---|
| 677 | };
|
---|
| 678 |
|
---|
| 679 | var merge = function merge(target, source, options) {
|
---|
| 680 | /* eslint no-param-reassign: 0 */
|
---|
| 681 | if (!source) {
|
---|
| 682 | return target;
|
---|
| 683 | }
|
---|
| 684 |
|
---|
| 685 | if (typeof source !== 'object') {
|
---|
| 686 | if (isArray(target)) {
|
---|
| 687 | target.push(source);
|
---|
| 688 | } else if (target && typeof target === 'object') {
|
---|
| 689 | if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) {
|
---|
| 690 | target[source] = true;
|
---|
| 691 | }
|
---|
| 692 | } else {
|
---|
| 693 | return [target, source];
|
---|
| 694 | }
|
---|
| 695 |
|
---|
| 696 | return target;
|
---|
| 697 | }
|
---|
| 698 |
|
---|
| 699 | if (!target || typeof target !== 'object') {
|
---|
| 700 | return [target].concat(source);
|
---|
| 701 | }
|
---|
| 702 |
|
---|
| 703 | var mergeTarget = target;
|
---|
| 704 | if (isArray(target) && !isArray(source)) {
|
---|
| 705 | mergeTarget = arrayToObject(target, options);
|
---|
| 706 | }
|
---|
| 707 |
|
---|
| 708 | if (isArray(target) && isArray(source)) {
|
---|
| 709 | source.forEach(function (item, i) {
|
---|
| 710 | if (has.call(target, i)) {
|
---|
| 711 | var targetItem = target[i];
|
---|
| 712 | if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
---|
| 713 | target[i] = merge(targetItem, item, options);
|
---|
| 714 | } else {
|
---|
| 715 | target.push(item);
|
---|
| 716 | }
|
---|
| 717 | } else {
|
---|
| 718 | target[i] = item;
|
---|
| 719 | }
|
---|
| 720 | });
|
---|
| 721 | return target;
|
---|
| 722 | }
|
---|
| 723 |
|
---|
| 724 | return Object.keys(source).reduce(function (acc, key) {
|
---|
| 725 | var value = source[key];
|
---|
| 726 |
|
---|
| 727 | if (has.call(acc, key)) {
|
---|
| 728 | acc[key] = merge(acc[key], value, options);
|
---|
| 729 | } else {
|
---|
| 730 | acc[key] = value;
|
---|
| 731 | }
|
---|
| 732 | return acc;
|
---|
| 733 | }, mergeTarget);
|
---|
| 734 | };
|
---|
| 735 |
|
---|
| 736 | var assign = function assignSingleSource(target, source) {
|
---|
| 737 | return Object.keys(source).reduce(function (acc, key) {
|
---|
| 738 | acc[key] = source[key];
|
---|
| 739 | return acc;
|
---|
| 740 | }, target);
|
---|
| 741 | };
|
---|
| 742 |
|
---|
| 743 | var decode = function (str, decoder, charset) {
|
---|
| 744 | var strWithoutPlus = str.replace(/\+/g, ' ');
|
---|
| 745 | if (charset === 'iso-8859-1') {
|
---|
| 746 | // unescape never throws, no try...catch needed:
|
---|
| 747 | return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
---|
| 748 | }
|
---|
| 749 | // utf-8
|
---|
| 750 | try {
|
---|
| 751 | return decodeURIComponent(strWithoutPlus);
|
---|
| 752 | } catch (e) {
|
---|
| 753 | return strWithoutPlus;
|
---|
| 754 | }
|
---|
| 755 | };
|
---|
| 756 |
|
---|
| 757 | var encode = function encode(str, defaultEncoder, charset, kind, format) {
|
---|
| 758 | // This code was originally written by Brian White (mscdex) for the io.js core querystring library.
|
---|
| 759 | // It has been adapted here for stricter adherence to RFC 3986
|
---|
| 760 | if (str.length === 0) {
|
---|
| 761 | return str;
|
---|
| 762 | }
|
---|
| 763 |
|
---|
| 764 | var string = str;
|
---|
| 765 | if (typeof str === 'symbol') {
|
---|
| 766 | string = Symbol.prototype.toString.call(str);
|
---|
| 767 | } else if (typeof str !== 'string') {
|
---|
| 768 | string = String(str);
|
---|
| 769 | }
|
---|
| 770 |
|
---|
| 771 | if (charset === 'iso-8859-1') {
|
---|
| 772 | return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
|
---|
| 773 | return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
|
---|
| 774 | });
|
---|
| 775 | }
|
---|
| 776 |
|
---|
| 777 | var out = '';
|
---|
| 778 | for (var i = 0; i < string.length; ++i) {
|
---|
| 779 | var c = string.charCodeAt(i);
|
---|
| 780 |
|
---|
| 781 | if (
|
---|
| 782 | c === 0x2D // -
|
---|
| 783 | || c === 0x2E // .
|
---|
| 784 | || c === 0x5F // _
|
---|
| 785 | || c === 0x7E // ~
|
---|
| 786 | || (c >= 0x30 && c <= 0x39) // 0-9
|
---|
| 787 | || (c >= 0x41 && c <= 0x5A) // a-z
|
---|
| 788 | || (c >= 0x61 && c <= 0x7A) // A-Z
|
---|
| 789 | || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
---|
| 790 | ) {
|
---|
| 791 | out += string.charAt(i);
|
---|
| 792 | continue;
|
---|
| 793 | }
|
---|
| 794 |
|
---|
| 795 | if (c < 0x80) {
|
---|
| 796 | out = out + hexTable[c];
|
---|
| 797 | continue;
|
---|
| 798 | }
|
---|
| 799 |
|
---|
| 800 | if (c < 0x800) {
|
---|
| 801 | out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);
|
---|
| 802 | continue;
|
---|
| 803 | }
|
---|
| 804 |
|
---|
| 805 | if (c < 0xD800 || c >= 0xE000) {
|
---|
| 806 | out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);
|
---|
| 807 | continue;
|
---|
| 808 | }
|
---|
| 809 |
|
---|
| 810 | i += 1;
|
---|
| 811 | c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));
|
---|
| 812 | /* eslint operator-linebreak: [2, "before"] */
|
---|
| 813 | out += hexTable[0xF0 | (c >> 18)]
|
---|
| 814 | + hexTable[0x80 | ((c >> 12) & 0x3F)]
|
---|
| 815 | + hexTable[0x80 | ((c >> 6) & 0x3F)]
|
---|
| 816 | + hexTable[0x80 | (c & 0x3F)];
|
---|
| 817 | }
|
---|
| 818 |
|
---|
| 819 | return out;
|
---|
| 820 | };
|
---|
| 821 |
|
---|
| 822 | var compact = function compact(value) {
|
---|
| 823 | var queue = [{ obj: { o: value }, prop: 'o' }];
|
---|
| 824 | var refs = [];
|
---|
| 825 |
|
---|
| 826 | for (var i = 0; i < queue.length; ++i) {
|
---|
| 827 | var item = queue[i];
|
---|
| 828 | var obj = item.obj[item.prop];
|
---|
| 829 |
|
---|
| 830 | var keys = Object.keys(obj);
|
---|
| 831 | for (var j = 0; j < keys.length; ++j) {
|
---|
| 832 | var key = keys[j];
|
---|
| 833 | var val = obj[key];
|
---|
| 834 | if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
---|
| 835 | queue.push({ obj: obj, prop: key });
|
---|
| 836 | refs.push(val);
|
---|
| 837 | }
|
---|
| 838 | }
|
---|
| 839 | }
|
---|
| 840 |
|
---|
| 841 | compactQueue(queue);
|
---|
| 842 |
|
---|
| 843 | return value;
|
---|
| 844 | };
|
---|
| 845 |
|
---|
| 846 | var isRegExp = function isRegExp(obj) {
|
---|
| 847 | return Object.prototype.toString.call(obj) === '[object RegExp]';
|
---|
| 848 | };
|
---|
| 849 |
|
---|
| 850 | var isBuffer = function isBuffer(obj) {
|
---|
| 851 | if (!obj || typeof obj !== 'object') {
|
---|
| 852 | return false;
|
---|
| 853 | }
|
---|
| 854 |
|
---|
| 855 | return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
---|
| 856 | };
|
---|
| 857 |
|
---|
| 858 | var combine = function combine(a, b) {
|
---|
| 859 | return [].concat(a, b);
|
---|
| 860 | };
|
---|
| 861 |
|
---|
| 862 | var maybeMap = function maybeMap(val, fn) {
|
---|
| 863 | if (isArray(val)) {
|
---|
| 864 | var mapped = [];
|
---|
| 865 | for (var i = 0; i < val.length; i += 1) {
|
---|
| 866 | mapped.push(fn(val[i]));
|
---|
| 867 | }
|
---|
| 868 | return mapped;
|
---|
| 869 | }
|
---|
| 870 | return fn(val);
|
---|
| 871 | };
|
---|
| 872 |
|
---|
| 873 | module.exports = {
|
---|
| 874 | arrayToObject: arrayToObject,
|
---|
| 875 | assign: assign,
|
---|
| 876 | combine: combine,
|
---|
| 877 | compact: compact,
|
---|
| 878 | decode: decode,
|
---|
| 879 | encode: encode,
|
---|
| 880 | isBuffer: isBuffer,
|
---|
| 881 | isRegExp: isRegExp,
|
---|
| 882 | maybeMap: maybeMap,
|
---|
| 883 | merge: merge
|
---|
| 884 | };
|
---|
| 885 |
|
---|
| 886 | },{"./formats":1}],6:[function(require,module,exports){
|
---|
| 887 |
|
---|
| 888 | },{}],7:[function(require,module,exports){
|
---|
| 889 | 'use strict';
|
---|
| 890 |
|
---|
| 891 | var GetIntrinsic = require('get-intrinsic');
|
---|
| 892 |
|
---|
| 893 | var callBind = require('./');
|
---|
| 894 |
|
---|
| 895 | var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
|
---|
| 896 |
|
---|
| 897 | module.exports = function callBoundIntrinsic(name, allowMissing) {
|
---|
| 898 | var intrinsic = GetIntrinsic(name, !!allowMissing);
|
---|
| 899 | if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
---|
| 900 | return callBind(intrinsic);
|
---|
| 901 | }
|
---|
| 902 | return intrinsic;
|
---|
| 903 | };
|
---|
| 904 |
|
---|
| 905 | },{"./":8,"get-intrinsic":11}],8:[function(require,module,exports){
|
---|
| 906 | 'use strict';
|
---|
| 907 |
|
---|
| 908 | var bind = require('function-bind');
|
---|
| 909 | var GetIntrinsic = require('get-intrinsic');
|
---|
| 910 |
|
---|
| 911 | var $apply = GetIntrinsic('%Function.prototype.apply%');
|
---|
| 912 | var $call = GetIntrinsic('%Function.prototype.call%');
|
---|
| 913 | var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
---|
| 914 |
|
---|
| 915 | var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
---|
| 916 | var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
---|
| 917 | var $max = GetIntrinsic('%Math.max%');
|
---|
| 918 |
|
---|
| 919 | if ($defineProperty) {
|
---|
| 920 | try {
|
---|
| 921 | $defineProperty({}, 'a', { value: 1 });
|
---|
| 922 | } catch (e) {
|
---|
| 923 | // IE 8 has a broken defineProperty
|
---|
| 924 | $defineProperty = null;
|
---|
| 925 | }
|
---|
| 926 | }
|
---|
| 927 |
|
---|
| 928 | module.exports = function callBind(originalFunction) {
|
---|
| 929 | var func = $reflectApply(bind, $call, arguments);
|
---|
| 930 | if ($gOPD && $defineProperty) {
|
---|
| 931 | var desc = $gOPD(func, 'length');
|
---|
| 932 | if (desc.configurable) {
|
---|
| 933 | // original length, plus the receiver, minus any additional arguments (after the receiver)
|
---|
| 934 | $defineProperty(
|
---|
| 935 | func,
|
---|
| 936 | 'length',
|
---|
| 937 | { value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
|
---|
| 938 | );
|
---|
| 939 | }
|
---|
| 940 | }
|
---|
| 941 | return func;
|
---|
| 942 | };
|
---|
| 943 |
|
---|
| 944 | var applyBind = function applyBind() {
|
---|
| 945 | return $reflectApply(bind, $apply, arguments);
|
---|
| 946 | };
|
---|
| 947 |
|
---|
| 948 | if ($defineProperty) {
|
---|
| 949 | $defineProperty(module.exports, 'apply', { value: applyBind });
|
---|
| 950 | } else {
|
---|
| 951 | module.exports.apply = applyBind;
|
---|
| 952 | }
|
---|
| 953 |
|
---|
| 954 | },{"function-bind":10,"get-intrinsic":11}],9:[function(require,module,exports){
|
---|
| 955 | 'use strict';
|
---|
| 956 |
|
---|
| 957 | /* eslint no-invalid-this: 1 */
|
---|
| 958 |
|
---|
| 959 | var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
---|
| 960 | var slice = Array.prototype.slice;
|
---|
| 961 | var toStr = Object.prototype.toString;
|
---|
| 962 | var funcType = '[object Function]';
|
---|
| 963 |
|
---|
| 964 | module.exports = function bind(that) {
|
---|
| 965 | var target = this;
|
---|
| 966 | if (typeof target !== 'function' || toStr.call(target) !== funcType) {
|
---|
| 967 | throw new TypeError(ERROR_MESSAGE + target);
|
---|
| 968 | }
|
---|
| 969 | var args = slice.call(arguments, 1);
|
---|
| 970 |
|
---|
| 971 | var bound;
|
---|
| 972 | var binder = function () {
|
---|
| 973 | if (this instanceof bound) {
|
---|
| 974 | var result = target.apply(
|
---|
| 975 | this,
|
---|
| 976 | args.concat(slice.call(arguments))
|
---|
| 977 | );
|
---|
| 978 | if (Object(result) === result) {
|
---|
| 979 | return result;
|
---|
| 980 | }
|
---|
| 981 | return this;
|
---|
| 982 | } else {
|
---|
| 983 | return target.apply(
|
---|
| 984 | that,
|
---|
| 985 | args.concat(slice.call(arguments))
|
---|
| 986 | );
|
---|
| 987 | }
|
---|
| 988 | };
|
---|
| 989 |
|
---|
| 990 | var boundLength = Math.max(0, target.length - args.length);
|
---|
| 991 | var boundArgs = [];
|
---|
| 992 | for (var i = 0; i < boundLength; i++) {
|
---|
| 993 | boundArgs.push('$' + i);
|
---|
| 994 | }
|
---|
| 995 |
|
---|
| 996 | bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
|
---|
| 997 |
|
---|
| 998 | if (target.prototype) {
|
---|
| 999 | var Empty = function Empty() {};
|
---|
| 1000 | Empty.prototype = target.prototype;
|
---|
| 1001 | bound.prototype = new Empty();
|
---|
| 1002 | Empty.prototype = null;
|
---|
| 1003 | }
|
---|
| 1004 |
|
---|
| 1005 | return bound;
|
---|
| 1006 | };
|
---|
| 1007 |
|
---|
| 1008 | },{}],10:[function(require,module,exports){
|
---|
| 1009 | 'use strict';
|
---|
| 1010 |
|
---|
| 1011 | var implementation = require('./implementation');
|
---|
| 1012 |
|
---|
| 1013 | module.exports = Function.prototype.bind || implementation;
|
---|
| 1014 |
|
---|
| 1015 | },{"./implementation":9}],11:[function(require,module,exports){
|
---|
| 1016 | 'use strict';
|
---|
| 1017 |
|
---|
| 1018 | var undefined;
|
---|
| 1019 |
|
---|
| 1020 | var $SyntaxError = SyntaxError;
|
---|
| 1021 | var $Function = Function;
|
---|
| 1022 | var $TypeError = TypeError;
|
---|
| 1023 |
|
---|
| 1024 | // eslint-disable-next-line consistent-return
|
---|
| 1025 | var getEvalledConstructor = function (expressionSyntax) {
|
---|
| 1026 | try {
|
---|
| 1027 | return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
|
---|
| 1028 | } catch (e) {}
|
---|
| 1029 | };
|
---|
| 1030 |
|
---|
| 1031 | var $gOPD = Object.getOwnPropertyDescriptor;
|
---|
| 1032 | if ($gOPD) {
|
---|
| 1033 | try {
|
---|
| 1034 | $gOPD({}, '');
|
---|
| 1035 | } catch (e) {
|
---|
| 1036 | $gOPD = null; // this is IE 8, which has a broken gOPD
|
---|
| 1037 | }
|
---|
| 1038 | }
|
---|
| 1039 |
|
---|
| 1040 | var throwTypeError = function () {
|
---|
| 1041 | throw new $TypeError();
|
---|
| 1042 | };
|
---|
| 1043 | var ThrowTypeError = $gOPD
|
---|
| 1044 | ? (function () {
|
---|
| 1045 | try {
|
---|
| 1046 | // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
|
---|
| 1047 | arguments.callee; // IE 8 does not throw here
|
---|
| 1048 | return throwTypeError;
|
---|
| 1049 | } catch (calleeThrows) {
|
---|
| 1050 | try {
|
---|
| 1051 | // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
|
---|
| 1052 | return $gOPD(arguments, 'callee').get;
|
---|
| 1053 | } catch (gOPDthrows) {
|
---|
| 1054 | return throwTypeError;
|
---|
| 1055 | }
|
---|
| 1056 | }
|
---|
| 1057 | }())
|
---|
| 1058 | : throwTypeError;
|
---|
| 1059 |
|
---|
| 1060 | var hasSymbols = require('has-symbols')();
|
---|
| 1061 |
|
---|
| 1062 | var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
|
---|
| 1063 |
|
---|
| 1064 | var needsEval = {};
|
---|
| 1065 |
|
---|
| 1066 | var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
|
---|
| 1067 |
|
---|
| 1068 | var INTRINSICS = {
|
---|
| 1069 | '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
|
---|
| 1070 | '%Array%': Array,
|
---|
| 1071 | '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
|
---|
| 1072 | '%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
|
---|
| 1073 | '%AsyncFromSyncIteratorPrototype%': undefined,
|
---|
| 1074 | '%AsyncFunction%': needsEval,
|
---|
| 1075 | '%AsyncGenerator%': needsEval,
|
---|
| 1076 | '%AsyncGeneratorFunction%': needsEval,
|
---|
| 1077 | '%AsyncIteratorPrototype%': needsEval,
|
---|
| 1078 | '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
|
---|
| 1079 | '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
|
---|
| 1080 | '%Boolean%': Boolean,
|
---|
| 1081 | '%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
|
---|
| 1082 | '%Date%': Date,
|
---|
| 1083 | '%decodeURI%': decodeURI,
|
---|
| 1084 | '%decodeURIComponent%': decodeURIComponent,
|
---|
| 1085 | '%encodeURI%': encodeURI,
|
---|
| 1086 | '%encodeURIComponent%': encodeURIComponent,
|
---|
| 1087 | '%Error%': Error,
|
---|
| 1088 | '%eval%': eval, // eslint-disable-line no-eval
|
---|
| 1089 | '%EvalError%': EvalError,
|
---|
| 1090 | '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
|
---|
| 1091 | '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
|
---|
| 1092 | '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
|
---|
| 1093 | '%Function%': $Function,
|
---|
| 1094 | '%GeneratorFunction%': needsEval,
|
---|
| 1095 | '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
|
---|
| 1096 | '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
|
---|
| 1097 | '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
|
---|
| 1098 | '%isFinite%': isFinite,
|
---|
| 1099 | '%isNaN%': isNaN,
|
---|
| 1100 | '%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
|
---|
| 1101 | '%JSON%': typeof JSON === 'object' ? JSON : undefined,
|
---|
| 1102 | '%Map%': typeof Map === 'undefined' ? undefined : Map,
|
---|
| 1103 | '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
|
---|
| 1104 | '%Math%': Math,
|
---|
| 1105 | '%Number%': Number,
|
---|
| 1106 | '%Object%': Object,
|
---|
| 1107 | '%parseFloat%': parseFloat,
|
---|
| 1108 | '%parseInt%': parseInt,
|
---|
| 1109 | '%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
|
---|
| 1110 | '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
|
---|
| 1111 | '%RangeError%': RangeError,
|
---|
| 1112 | '%ReferenceError%': ReferenceError,
|
---|
| 1113 | '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
|
---|
| 1114 | '%RegExp%': RegExp,
|
---|
| 1115 | '%Set%': typeof Set === 'undefined' ? undefined : Set,
|
---|
| 1116 | '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
|
---|
| 1117 | '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
|
---|
| 1118 | '%String%': String,
|
---|
| 1119 | '%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
|
---|
| 1120 | '%Symbol%': hasSymbols ? Symbol : undefined,
|
---|
| 1121 | '%SyntaxError%': $SyntaxError,
|
---|
| 1122 | '%ThrowTypeError%': ThrowTypeError,
|
---|
| 1123 | '%TypedArray%': TypedArray,
|
---|
| 1124 | '%TypeError%': $TypeError,
|
---|
| 1125 | '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
|
---|
| 1126 | '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
|
---|
| 1127 | '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
|
---|
| 1128 | '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
|
---|
| 1129 | '%URIError%': URIError,
|
---|
| 1130 | '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
|
---|
| 1131 | '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
|
---|
| 1132 | '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
|
---|
| 1133 | };
|
---|
| 1134 |
|
---|
| 1135 | var doEval = function doEval(name) {
|
---|
| 1136 | var value;
|
---|
| 1137 | if (name === '%AsyncFunction%') {
|
---|
| 1138 | value = getEvalledConstructor('async function () {}');
|
---|
| 1139 | } else if (name === '%GeneratorFunction%') {
|
---|
| 1140 | value = getEvalledConstructor('function* () {}');
|
---|
| 1141 | } else if (name === '%AsyncGeneratorFunction%') {
|
---|
| 1142 | value = getEvalledConstructor('async function* () {}');
|
---|
| 1143 | } else if (name === '%AsyncGenerator%') {
|
---|
| 1144 | var fn = doEval('%AsyncGeneratorFunction%');
|
---|
| 1145 | if (fn) {
|
---|
| 1146 | value = fn.prototype;
|
---|
| 1147 | }
|
---|
| 1148 | } else if (name === '%AsyncIteratorPrototype%') {
|
---|
| 1149 | var gen = doEval('%AsyncGenerator%');
|
---|
| 1150 | if (gen) {
|
---|
| 1151 | value = getProto(gen.prototype);
|
---|
| 1152 | }
|
---|
| 1153 | }
|
---|
| 1154 |
|
---|
| 1155 | INTRINSICS[name] = value;
|
---|
| 1156 |
|
---|
| 1157 | return value;
|
---|
| 1158 | };
|
---|
| 1159 |
|
---|
| 1160 | var LEGACY_ALIASES = {
|
---|
| 1161 | '%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
|
---|
| 1162 | '%ArrayPrototype%': ['Array', 'prototype'],
|
---|
| 1163 | '%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
|
---|
| 1164 | '%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
|
---|
| 1165 | '%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
|
---|
| 1166 | '%ArrayProto_values%': ['Array', 'prototype', 'values'],
|
---|
| 1167 | '%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
|
---|
| 1168 | '%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
|
---|
| 1169 | '%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
|
---|
| 1170 | '%BooleanPrototype%': ['Boolean', 'prototype'],
|
---|
| 1171 | '%DataViewPrototype%': ['DataView', 'prototype'],
|
---|
| 1172 | '%DatePrototype%': ['Date', 'prototype'],
|
---|
| 1173 | '%ErrorPrototype%': ['Error', 'prototype'],
|
---|
| 1174 | '%EvalErrorPrototype%': ['EvalError', 'prototype'],
|
---|
| 1175 | '%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
|
---|
| 1176 | '%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
|
---|
| 1177 | '%FunctionPrototype%': ['Function', 'prototype'],
|
---|
| 1178 | '%Generator%': ['GeneratorFunction', 'prototype'],
|
---|
| 1179 | '%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
|
---|
| 1180 | '%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
|
---|
| 1181 | '%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
|
---|
| 1182 | '%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
|
---|
| 1183 | '%JSONParse%': ['JSON', 'parse'],
|
---|
| 1184 | '%JSONStringify%': ['JSON', 'stringify'],
|
---|
| 1185 | '%MapPrototype%': ['Map', 'prototype'],
|
---|
| 1186 | '%NumberPrototype%': ['Number', 'prototype'],
|
---|
| 1187 | '%ObjectPrototype%': ['Object', 'prototype'],
|
---|
| 1188 | '%ObjProto_toString%': ['Object', 'prototype', 'toString'],
|
---|
| 1189 | '%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
|
---|
| 1190 | '%PromisePrototype%': ['Promise', 'prototype'],
|
---|
| 1191 | '%PromiseProto_then%': ['Promise', 'prototype', 'then'],
|
---|
| 1192 | '%Promise_all%': ['Promise', 'all'],
|
---|
| 1193 | '%Promise_reject%': ['Promise', 'reject'],
|
---|
| 1194 | '%Promise_resolve%': ['Promise', 'resolve'],
|
---|
| 1195 | '%RangeErrorPrototype%': ['RangeError', 'prototype'],
|
---|
| 1196 | '%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
|
---|
| 1197 | '%RegExpPrototype%': ['RegExp', 'prototype'],
|
---|
| 1198 | '%SetPrototype%': ['Set', 'prototype'],
|
---|
| 1199 | '%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
|
---|
| 1200 | '%StringPrototype%': ['String', 'prototype'],
|
---|
| 1201 | '%SymbolPrototype%': ['Symbol', 'prototype'],
|
---|
| 1202 | '%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
|
---|
| 1203 | '%TypedArrayPrototype%': ['TypedArray', 'prototype'],
|
---|
| 1204 | '%TypeErrorPrototype%': ['TypeError', 'prototype'],
|
---|
| 1205 | '%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
|
---|
| 1206 | '%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
|
---|
| 1207 | '%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
|
---|
| 1208 | '%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
|
---|
| 1209 | '%URIErrorPrototype%': ['URIError', 'prototype'],
|
---|
| 1210 | '%WeakMapPrototype%': ['WeakMap', 'prototype'],
|
---|
| 1211 | '%WeakSetPrototype%': ['WeakSet', 'prototype']
|
---|
| 1212 | };
|
---|
| 1213 |
|
---|
| 1214 | var bind = require('function-bind');
|
---|
| 1215 | var hasOwn = require('has');
|
---|
| 1216 | var $concat = bind.call(Function.call, Array.prototype.concat);
|
---|
| 1217 | var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
|
---|
| 1218 | var $replace = bind.call(Function.call, String.prototype.replace);
|
---|
| 1219 | var $strSlice = bind.call(Function.call, String.prototype.slice);
|
---|
| 1220 |
|
---|
| 1221 | /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
|
---|
| 1222 | var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
|
---|
| 1223 | var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
|
---|
| 1224 | var stringToPath = function stringToPath(string) {
|
---|
| 1225 | var first = $strSlice(string, 0, 1);
|
---|
| 1226 | var last = $strSlice(string, -1);
|
---|
| 1227 | if (first === '%' && last !== '%') {
|
---|
| 1228 | throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
|
---|
| 1229 | } else if (last === '%' && first !== '%') {
|
---|
| 1230 | throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
|
---|
| 1231 | }
|
---|
| 1232 | var result = [];
|
---|
| 1233 | $replace(string, rePropName, function (match, number, quote, subString) {
|
---|
| 1234 | result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
|
---|
| 1235 | });
|
---|
| 1236 | return result;
|
---|
| 1237 | };
|
---|
| 1238 | /* end adaptation */
|
---|
| 1239 |
|
---|
| 1240 | var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
|
---|
| 1241 | var intrinsicName = name;
|
---|
| 1242 | var alias;
|
---|
| 1243 | if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
|
---|
| 1244 | alias = LEGACY_ALIASES[intrinsicName];
|
---|
| 1245 | intrinsicName = '%' + alias[0] + '%';
|
---|
| 1246 | }
|
---|
| 1247 |
|
---|
| 1248 | if (hasOwn(INTRINSICS, intrinsicName)) {
|
---|
| 1249 | var value = INTRINSICS[intrinsicName];
|
---|
| 1250 | if (value === needsEval) {
|
---|
| 1251 | value = doEval(intrinsicName);
|
---|
| 1252 | }
|
---|
| 1253 | if (typeof value === 'undefined' && !allowMissing) {
|
---|
| 1254 | throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
|
---|
| 1255 | }
|
---|
| 1256 |
|
---|
| 1257 | return {
|
---|
| 1258 | alias: alias,
|
---|
| 1259 | name: intrinsicName,
|
---|
| 1260 | value: value
|
---|
| 1261 | };
|
---|
| 1262 | }
|
---|
| 1263 |
|
---|
| 1264 | throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
|
---|
| 1265 | };
|
---|
| 1266 |
|
---|
| 1267 | module.exports = function GetIntrinsic(name, allowMissing) {
|
---|
| 1268 | if (typeof name !== 'string' || name.length === 0) {
|
---|
| 1269 | throw new $TypeError('intrinsic name must be a non-empty string');
|
---|
| 1270 | }
|
---|
| 1271 | if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
|
---|
| 1272 | throw new $TypeError('"allowMissing" argument must be a boolean');
|
---|
| 1273 | }
|
---|
| 1274 |
|
---|
| 1275 | var parts = stringToPath(name);
|
---|
| 1276 | var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
|
---|
| 1277 |
|
---|
| 1278 | var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
|
---|
| 1279 | var intrinsicRealName = intrinsic.name;
|
---|
| 1280 | var value = intrinsic.value;
|
---|
| 1281 | var skipFurtherCaching = false;
|
---|
| 1282 |
|
---|
| 1283 | var alias = intrinsic.alias;
|
---|
| 1284 | if (alias) {
|
---|
| 1285 | intrinsicBaseName = alias[0];
|
---|
| 1286 | $spliceApply(parts, $concat([0, 1], alias));
|
---|
| 1287 | }
|
---|
| 1288 |
|
---|
| 1289 | for (var i = 1, isOwn = true; i < parts.length; i += 1) {
|
---|
| 1290 | var part = parts[i];
|
---|
| 1291 | var first = $strSlice(part, 0, 1);
|
---|
| 1292 | var last = $strSlice(part, -1);
|
---|
| 1293 | if (
|
---|
| 1294 | (
|
---|
| 1295 | (first === '"' || first === "'" || first === '`')
|
---|
| 1296 | || (last === '"' || last === "'" || last === '`')
|
---|
| 1297 | )
|
---|
| 1298 | && first !== last
|
---|
| 1299 | ) {
|
---|
| 1300 | throw new $SyntaxError('property names with quotes must have matching quotes');
|
---|
| 1301 | }
|
---|
| 1302 | if (part === 'constructor' || !isOwn) {
|
---|
| 1303 | skipFurtherCaching = true;
|
---|
| 1304 | }
|
---|
| 1305 |
|
---|
| 1306 | intrinsicBaseName += '.' + part;
|
---|
| 1307 | intrinsicRealName = '%' + intrinsicBaseName + '%';
|
---|
| 1308 |
|
---|
| 1309 | if (hasOwn(INTRINSICS, intrinsicRealName)) {
|
---|
| 1310 | value = INTRINSICS[intrinsicRealName];
|
---|
| 1311 | } else if (value != null) {
|
---|
| 1312 | if (!(part in value)) {
|
---|
| 1313 | if (!allowMissing) {
|
---|
| 1314 | throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
|
---|
| 1315 | }
|
---|
| 1316 | return void undefined;
|
---|
| 1317 | }
|
---|
| 1318 | if ($gOPD && (i + 1) >= parts.length) {
|
---|
| 1319 | var desc = $gOPD(value, part);
|
---|
| 1320 | isOwn = !!desc;
|
---|
| 1321 |
|
---|
| 1322 | // By convention, when a data property is converted to an accessor
|
---|
| 1323 | // property to emulate a data property that does not suffer from
|
---|
| 1324 | // the override mistake, that accessor's getter is marked with
|
---|
| 1325 | // an `originalValue` property. Here, when we detect this, we
|
---|
| 1326 | // uphold the illusion by pretending to see that original data
|
---|
| 1327 | // property, i.e., returning the value rather than the getter
|
---|
| 1328 | // itself.
|
---|
| 1329 | if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
|
---|
| 1330 | value = desc.get;
|
---|
| 1331 | } else {
|
---|
| 1332 | value = value[part];
|
---|
| 1333 | }
|
---|
| 1334 | } else {
|
---|
| 1335 | isOwn = hasOwn(value, part);
|
---|
| 1336 | value = value[part];
|
---|
| 1337 | }
|
---|
| 1338 |
|
---|
| 1339 | if (isOwn && !skipFurtherCaching) {
|
---|
| 1340 | INTRINSICS[intrinsicRealName] = value;
|
---|
| 1341 | }
|
---|
| 1342 | }
|
---|
| 1343 | }
|
---|
| 1344 | return value;
|
---|
| 1345 | };
|
---|
| 1346 |
|
---|
| 1347 | },{"function-bind":10,"has":14,"has-symbols":12}],12:[function(require,module,exports){
|
---|
| 1348 | 'use strict';
|
---|
| 1349 |
|
---|
| 1350 | var origSymbol = typeof Symbol !== 'undefined' && Symbol;
|
---|
| 1351 | var hasSymbolSham = require('./shams');
|
---|
| 1352 |
|
---|
| 1353 | module.exports = function hasNativeSymbols() {
|
---|
| 1354 | if (typeof origSymbol !== 'function') { return false; }
|
---|
| 1355 | if (typeof Symbol !== 'function') { return false; }
|
---|
| 1356 | if (typeof origSymbol('foo') !== 'symbol') { return false; }
|
---|
| 1357 | if (typeof Symbol('bar') !== 'symbol') { return false; }
|
---|
| 1358 |
|
---|
| 1359 | return hasSymbolSham();
|
---|
| 1360 | };
|
---|
| 1361 |
|
---|
| 1362 | },{"./shams":13}],13:[function(require,module,exports){
|
---|
| 1363 | 'use strict';
|
---|
| 1364 |
|
---|
| 1365 | /* eslint complexity: [2, 18], max-statements: [2, 33] */
|
---|
| 1366 | module.exports = function hasSymbols() {
|
---|
| 1367 | if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
---|
| 1368 | if (typeof Symbol.iterator === 'symbol') { return true; }
|
---|
| 1369 |
|
---|
| 1370 | var obj = {};
|
---|
| 1371 | var sym = Symbol('test');
|
---|
| 1372 | var symObj = Object(sym);
|
---|
| 1373 | if (typeof sym === 'string') { return false; }
|
---|
| 1374 |
|
---|
| 1375 | if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
---|
| 1376 | if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
---|
| 1377 |
|
---|
| 1378 | // temp disabled per https://github.com/ljharb/object.assign/issues/17
|
---|
| 1379 | // if (sym instanceof Symbol) { return false; }
|
---|
| 1380 | // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
---|
| 1381 | // if (!(symObj instanceof Symbol)) { return false; }
|
---|
| 1382 |
|
---|
| 1383 | // if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
---|
| 1384 | // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
---|
| 1385 |
|
---|
| 1386 | var symVal = 42;
|
---|
| 1387 | obj[sym] = symVal;
|
---|
| 1388 | for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
|
---|
| 1389 | if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
---|
| 1390 |
|
---|
| 1391 | if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
---|
| 1392 |
|
---|
| 1393 | var syms = Object.getOwnPropertySymbols(obj);
|
---|
| 1394 | if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
---|
| 1395 |
|
---|
| 1396 | if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
---|
| 1397 |
|
---|
| 1398 | if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
---|
| 1399 | var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
---|
| 1400 | if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
---|
| 1401 | }
|
---|
| 1402 |
|
---|
| 1403 | return true;
|
---|
| 1404 | };
|
---|
| 1405 |
|
---|
| 1406 | },{}],14:[function(require,module,exports){
|
---|
| 1407 | 'use strict';
|
---|
| 1408 |
|
---|
| 1409 | var bind = require('function-bind');
|
---|
| 1410 |
|
---|
| 1411 | module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
|
---|
| 1412 |
|
---|
| 1413 | },{"function-bind":10}],15:[function(require,module,exports){
|
---|
| 1414 | var hasMap = typeof Map === 'function' && Map.prototype;
|
---|
| 1415 | var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
|
---|
| 1416 | var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
|
---|
| 1417 | var mapForEach = hasMap && Map.prototype.forEach;
|
---|
| 1418 | var hasSet = typeof Set === 'function' && Set.prototype;
|
---|
| 1419 | var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
|
---|
| 1420 | var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
|
---|
| 1421 | var setForEach = hasSet && Set.prototype.forEach;
|
---|
| 1422 | var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
|
---|
| 1423 | var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
|
---|
| 1424 | var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
|
---|
| 1425 | var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
|
---|
| 1426 | var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
|
---|
| 1427 | var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
|
---|
| 1428 | var booleanValueOf = Boolean.prototype.valueOf;
|
---|
| 1429 | var objectToString = Object.prototype.toString;
|
---|
| 1430 | var functionToString = Function.prototype.toString;
|
---|
| 1431 | var $match = String.prototype.match;
|
---|
| 1432 | var $slice = String.prototype.slice;
|
---|
| 1433 | var $replace = String.prototype.replace;
|
---|
| 1434 | var $toUpperCase = String.prototype.toUpperCase;
|
---|
| 1435 | var $toLowerCase = String.prototype.toLowerCase;
|
---|
| 1436 | var $test = RegExp.prototype.test;
|
---|
| 1437 | var $concat = Array.prototype.concat;
|
---|
| 1438 | var $join = Array.prototype.join;
|
---|
| 1439 | var $arrSlice = Array.prototype.slice;
|
---|
| 1440 | var $floor = Math.floor;
|
---|
| 1441 | var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
|
---|
| 1442 | var gOPS = Object.getOwnPropertySymbols;
|
---|
| 1443 | var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
|
---|
| 1444 | var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
|
---|
| 1445 | // ie, `has-tostringtag/shams
|
---|
| 1446 | var toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')
|
---|
| 1447 | ? Symbol.toStringTag
|
---|
| 1448 | : null;
|
---|
| 1449 | var isEnumerable = Object.prototype.propertyIsEnumerable;
|
---|
| 1450 |
|
---|
| 1451 | var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
|
---|
| 1452 | [].__proto__ === Array.prototype // eslint-disable-line no-proto
|
---|
| 1453 | ? function (O) {
|
---|
| 1454 | return O.__proto__; // eslint-disable-line no-proto
|
---|
| 1455 | }
|
---|
| 1456 | : null
|
---|
| 1457 | );
|
---|
| 1458 |
|
---|
| 1459 | function addNumericSeparator(num, str) {
|
---|
| 1460 | if (
|
---|
| 1461 | num === Infinity
|
---|
| 1462 | || num === -Infinity
|
---|
| 1463 | || num !== num
|
---|
| 1464 | || (num && num > -1000 && num < 1000)
|
---|
| 1465 | || $test.call(/e/, str)
|
---|
| 1466 | ) {
|
---|
| 1467 | return str;
|
---|
| 1468 | }
|
---|
| 1469 | var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
|
---|
| 1470 | if (typeof num === 'number') {
|
---|
| 1471 | var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
|
---|
| 1472 | if (int !== num) {
|
---|
| 1473 | var intStr = String(int);
|
---|
| 1474 | var dec = $slice.call(str, intStr.length + 1);
|
---|
| 1475 | return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
|
---|
| 1476 | }
|
---|
| 1477 | }
|
---|
| 1478 | return $replace.call(str, sepRegex, '$&_');
|
---|
| 1479 | }
|
---|
| 1480 |
|
---|
| 1481 | var utilInspect = require('./util.inspect');
|
---|
| 1482 | var inspectCustom = utilInspect.custom;
|
---|
| 1483 | var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
|
---|
| 1484 |
|
---|
| 1485 | module.exports = function inspect_(obj, options, depth, seen) {
|
---|
| 1486 | var opts = options || {};
|
---|
| 1487 |
|
---|
| 1488 | if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
|
---|
| 1489 | throw new TypeError('option "quoteStyle" must be "single" or "double"');
|
---|
| 1490 | }
|
---|
| 1491 | if (
|
---|
| 1492 | has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
|
---|
| 1493 | ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
|
---|
| 1494 | : opts.maxStringLength !== null
|
---|
| 1495 | )
|
---|
| 1496 | ) {
|
---|
| 1497 | throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
|
---|
| 1498 | }
|
---|
| 1499 | var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
|
---|
| 1500 | if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {
|
---|
| 1501 | throw new TypeError('option "customInspect", if provided, must be `true`, `false`, or `\'symbol\'`');
|
---|
| 1502 | }
|
---|
| 1503 |
|
---|
| 1504 | if (
|
---|
| 1505 | has(opts, 'indent')
|
---|
| 1506 | && opts.indent !== null
|
---|
| 1507 | && opts.indent !== '\t'
|
---|
| 1508 | && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
|
---|
| 1509 | ) {
|
---|
| 1510 | throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
|
---|
| 1511 | }
|
---|
| 1512 | if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
|
---|
| 1513 | throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
|
---|
| 1514 | }
|
---|
| 1515 | var numericSeparator = opts.numericSeparator;
|
---|
| 1516 |
|
---|
| 1517 | if (typeof obj === 'undefined') {
|
---|
| 1518 | return 'undefined';
|
---|
| 1519 | }
|
---|
| 1520 | if (obj === null) {
|
---|
| 1521 | return 'null';
|
---|
| 1522 | }
|
---|
| 1523 | if (typeof obj === 'boolean') {
|
---|
| 1524 | return obj ? 'true' : 'false';
|
---|
| 1525 | }
|
---|
| 1526 |
|
---|
| 1527 | if (typeof obj === 'string') {
|
---|
| 1528 | return inspectString(obj, opts);
|
---|
| 1529 | }
|
---|
| 1530 | if (typeof obj === 'number') {
|
---|
| 1531 | if (obj === 0) {
|
---|
| 1532 | return Infinity / obj > 0 ? '0' : '-0';
|
---|
| 1533 | }
|
---|
| 1534 | var str = String(obj);
|
---|
| 1535 | return numericSeparator ? addNumericSeparator(obj, str) : str;
|
---|
| 1536 | }
|
---|
| 1537 | if (typeof obj === 'bigint') {
|
---|
| 1538 | var bigIntStr = String(obj) + 'n';
|
---|
| 1539 | return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
|
---|
| 1540 | }
|
---|
| 1541 |
|
---|
| 1542 | var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
|
---|
| 1543 | if (typeof depth === 'undefined') { depth = 0; }
|
---|
| 1544 | if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
|
---|
| 1545 | return isArray(obj) ? '[Array]' : '[Object]';
|
---|
| 1546 | }
|
---|
| 1547 |
|
---|
| 1548 | var indent = getIndent(opts, depth);
|
---|
| 1549 |
|
---|
| 1550 | if (typeof seen === 'undefined') {
|
---|
| 1551 | seen = [];
|
---|
| 1552 | } else if (indexOf(seen, obj) >= 0) {
|
---|
| 1553 | return '[Circular]';
|
---|
| 1554 | }
|
---|
| 1555 |
|
---|
| 1556 | function inspect(value, from, noIndent) {
|
---|
| 1557 | if (from) {
|
---|
| 1558 | seen = $arrSlice.call(seen);
|
---|
| 1559 | seen.push(from);
|
---|
| 1560 | }
|
---|
| 1561 | if (noIndent) {
|
---|
| 1562 | var newOpts = {
|
---|
| 1563 | depth: opts.depth
|
---|
| 1564 | };
|
---|
| 1565 | if (has(opts, 'quoteStyle')) {
|
---|
| 1566 | newOpts.quoteStyle = opts.quoteStyle;
|
---|
| 1567 | }
|
---|
| 1568 | return inspect_(value, newOpts, depth + 1, seen);
|
---|
| 1569 | }
|
---|
| 1570 | return inspect_(value, opts, depth + 1, seen);
|
---|
| 1571 | }
|
---|
| 1572 |
|
---|
| 1573 | if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable
|
---|
| 1574 | var name = nameOf(obj);
|
---|
| 1575 | var keys = arrObjKeys(obj, inspect);
|
---|
| 1576 | return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
|
---|
| 1577 | }
|
---|
| 1578 | if (isSymbol(obj)) {
|
---|
| 1579 | var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
|
---|
| 1580 | return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
|
---|
| 1581 | }
|
---|
| 1582 | if (isElement(obj)) {
|
---|
| 1583 | var s = '<' + $toLowerCase.call(String(obj.nodeName));
|
---|
| 1584 | var attrs = obj.attributes || [];
|
---|
| 1585 | for (var i = 0; i < attrs.length; i++) {
|
---|
| 1586 | s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
|
---|
| 1587 | }
|
---|
| 1588 | s += '>';
|
---|
| 1589 | if (obj.childNodes && obj.childNodes.length) { s += '...'; }
|
---|
| 1590 | s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
|
---|
| 1591 | return s;
|
---|
| 1592 | }
|
---|
| 1593 | if (isArray(obj)) {
|
---|
| 1594 | if (obj.length === 0) { return '[]'; }
|
---|
| 1595 | var xs = arrObjKeys(obj, inspect);
|
---|
| 1596 | if (indent && !singleLineValues(xs)) {
|
---|
| 1597 | return '[' + indentedJoin(xs, indent) + ']';
|
---|
| 1598 | }
|
---|
| 1599 | return '[ ' + $join.call(xs, ', ') + ' ]';
|
---|
| 1600 | }
|
---|
| 1601 | if (isError(obj)) {
|
---|
| 1602 | var parts = arrObjKeys(obj, inspect);
|
---|
| 1603 | if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {
|
---|
| 1604 | return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
|
---|
| 1605 | }
|
---|
| 1606 | if (parts.length === 0) { return '[' + String(obj) + ']'; }
|
---|
| 1607 | return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
|
---|
| 1608 | }
|
---|
| 1609 | if (typeof obj === 'object' && customInspect) {
|
---|
| 1610 | if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {
|
---|
| 1611 | return utilInspect(obj, { depth: maxDepth - depth });
|
---|
| 1612 | } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {
|
---|
| 1613 | return obj.inspect();
|
---|
| 1614 | }
|
---|
| 1615 | }
|
---|
| 1616 | if (isMap(obj)) {
|
---|
| 1617 | var mapParts = [];
|
---|
| 1618 | mapForEach.call(obj, function (value, key) {
|
---|
| 1619 | mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
|
---|
| 1620 | });
|
---|
| 1621 | return collectionOf('Map', mapSize.call(obj), mapParts, indent);
|
---|
| 1622 | }
|
---|
| 1623 | if (isSet(obj)) {
|
---|
| 1624 | var setParts = [];
|
---|
| 1625 | setForEach.call(obj, function (value) {
|
---|
| 1626 | setParts.push(inspect(value, obj));
|
---|
| 1627 | });
|
---|
| 1628 | return collectionOf('Set', setSize.call(obj), setParts, indent);
|
---|
| 1629 | }
|
---|
| 1630 | if (isWeakMap(obj)) {
|
---|
| 1631 | return weakCollectionOf('WeakMap');
|
---|
| 1632 | }
|
---|
| 1633 | if (isWeakSet(obj)) {
|
---|
| 1634 | return weakCollectionOf('WeakSet');
|
---|
| 1635 | }
|
---|
| 1636 | if (isWeakRef(obj)) {
|
---|
| 1637 | return weakCollectionOf('WeakRef');
|
---|
| 1638 | }
|
---|
| 1639 | if (isNumber(obj)) {
|
---|
| 1640 | return markBoxed(inspect(Number(obj)));
|
---|
| 1641 | }
|
---|
| 1642 | if (isBigInt(obj)) {
|
---|
| 1643 | return markBoxed(inspect(bigIntValueOf.call(obj)));
|
---|
| 1644 | }
|
---|
| 1645 | if (isBoolean(obj)) {
|
---|
| 1646 | return markBoxed(booleanValueOf.call(obj));
|
---|
| 1647 | }
|
---|
| 1648 | if (isString(obj)) {
|
---|
| 1649 | return markBoxed(inspect(String(obj)));
|
---|
| 1650 | }
|
---|
| 1651 | if (!isDate(obj) && !isRegExp(obj)) {
|
---|
| 1652 | var ys = arrObjKeys(obj, inspect);
|
---|
| 1653 | var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
---|
| 1654 | var protoTag = obj instanceof Object ? '' : 'null prototype';
|
---|
| 1655 | var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
|
---|
| 1656 | var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
|
---|
| 1657 | var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
|
---|
| 1658 | if (ys.length === 0) { return tag + '{}'; }
|
---|
| 1659 | if (indent) {
|
---|
| 1660 | return tag + '{' + indentedJoin(ys, indent) + '}';
|
---|
| 1661 | }
|
---|
| 1662 | return tag + '{ ' + $join.call(ys, ', ') + ' }';
|
---|
| 1663 | }
|
---|
| 1664 | return String(obj);
|
---|
| 1665 | };
|
---|
| 1666 |
|
---|
| 1667 | function wrapQuotes(s, defaultStyle, opts) {
|
---|
| 1668 | var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
|
---|
| 1669 | return quoteChar + s + quoteChar;
|
---|
| 1670 | }
|
---|
| 1671 |
|
---|
| 1672 | function quote(s) {
|
---|
| 1673 | return $replace.call(String(s), /"/g, '"');
|
---|
| 1674 | }
|
---|
| 1675 |
|
---|
| 1676 | function isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
---|
| 1677 | function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
---|
| 1678 | function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
---|
| 1679 | function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
---|
| 1680 | function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
---|
| 1681 | function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
---|
| 1682 | function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
---|
| 1683 |
|
---|
| 1684 | // Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
|
---|
| 1685 | function isSymbol(obj) {
|
---|
| 1686 | if (hasShammedSymbols) {
|
---|
| 1687 | return obj && typeof obj === 'object' && obj instanceof Symbol;
|
---|
| 1688 | }
|
---|
| 1689 | if (typeof obj === 'symbol') {
|
---|
| 1690 | return true;
|
---|
| 1691 | }
|
---|
| 1692 | if (!obj || typeof obj !== 'object' || !symToString) {
|
---|
| 1693 | return false;
|
---|
| 1694 | }
|
---|
| 1695 | try {
|
---|
| 1696 | symToString.call(obj);
|
---|
| 1697 | return true;
|
---|
| 1698 | } catch (e) {}
|
---|
| 1699 | return false;
|
---|
| 1700 | }
|
---|
| 1701 |
|
---|
| 1702 | function isBigInt(obj) {
|
---|
| 1703 | if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
|
---|
| 1704 | return false;
|
---|
| 1705 | }
|
---|
| 1706 | try {
|
---|
| 1707 | bigIntValueOf.call(obj);
|
---|
| 1708 | return true;
|
---|
| 1709 | } catch (e) {}
|
---|
| 1710 | return false;
|
---|
| 1711 | }
|
---|
| 1712 |
|
---|
| 1713 | var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
|
---|
| 1714 | function has(obj, key) {
|
---|
| 1715 | return hasOwn.call(obj, key);
|
---|
| 1716 | }
|
---|
| 1717 |
|
---|
| 1718 | function toStr(obj) {
|
---|
| 1719 | return objectToString.call(obj);
|
---|
| 1720 | }
|
---|
| 1721 |
|
---|
| 1722 | function nameOf(f) {
|
---|
| 1723 | if (f.name) { return f.name; }
|
---|
| 1724 | var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
|
---|
| 1725 | if (m) { return m[1]; }
|
---|
| 1726 | return null;
|
---|
| 1727 | }
|
---|
| 1728 |
|
---|
| 1729 | function indexOf(xs, x) {
|
---|
| 1730 | if (xs.indexOf) { return xs.indexOf(x); }
|
---|
| 1731 | for (var i = 0, l = xs.length; i < l; i++) {
|
---|
| 1732 | if (xs[i] === x) { return i; }
|
---|
| 1733 | }
|
---|
| 1734 | return -1;
|
---|
| 1735 | }
|
---|
| 1736 |
|
---|
| 1737 | function isMap(x) {
|
---|
| 1738 | if (!mapSize || !x || typeof x !== 'object') {
|
---|
| 1739 | return false;
|
---|
| 1740 | }
|
---|
| 1741 | try {
|
---|
| 1742 | mapSize.call(x);
|
---|
| 1743 | try {
|
---|
| 1744 | setSize.call(x);
|
---|
| 1745 | } catch (s) {
|
---|
| 1746 | return true;
|
---|
| 1747 | }
|
---|
| 1748 | return x instanceof Map; // core-js workaround, pre-v2.5.0
|
---|
| 1749 | } catch (e) {}
|
---|
| 1750 | return false;
|
---|
| 1751 | }
|
---|
| 1752 |
|
---|
| 1753 | function isWeakMap(x) {
|
---|
| 1754 | if (!weakMapHas || !x || typeof x !== 'object') {
|
---|
| 1755 | return false;
|
---|
| 1756 | }
|
---|
| 1757 | try {
|
---|
| 1758 | weakMapHas.call(x, weakMapHas);
|
---|
| 1759 | try {
|
---|
| 1760 | weakSetHas.call(x, weakSetHas);
|
---|
| 1761 | } catch (s) {
|
---|
| 1762 | return true;
|
---|
| 1763 | }
|
---|
| 1764 | return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
|
---|
| 1765 | } catch (e) {}
|
---|
| 1766 | return false;
|
---|
| 1767 | }
|
---|
| 1768 |
|
---|
| 1769 | function isWeakRef(x) {
|
---|
| 1770 | if (!weakRefDeref || !x || typeof x !== 'object') {
|
---|
| 1771 | return false;
|
---|
| 1772 | }
|
---|
| 1773 | try {
|
---|
| 1774 | weakRefDeref.call(x);
|
---|
| 1775 | return true;
|
---|
| 1776 | } catch (e) {}
|
---|
| 1777 | return false;
|
---|
| 1778 | }
|
---|
| 1779 |
|
---|
| 1780 | function isSet(x) {
|
---|
| 1781 | if (!setSize || !x || typeof x !== 'object') {
|
---|
| 1782 | return false;
|
---|
| 1783 | }
|
---|
| 1784 | try {
|
---|
| 1785 | setSize.call(x);
|
---|
| 1786 | try {
|
---|
| 1787 | mapSize.call(x);
|
---|
| 1788 | } catch (m) {
|
---|
| 1789 | return true;
|
---|
| 1790 | }
|
---|
| 1791 | return x instanceof Set; // core-js workaround, pre-v2.5.0
|
---|
| 1792 | } catch (e) {}
|
---|
| 1793 | return false;
|
---|
| 1794 | }
|
---|
| 1795 |
|
---|
| 1796 | function isWeakSet(x) {
|
---|
| 1797 | if (!weakSetHas || !x || typeof x !== 'object') {
|
---|
| 1798 | return false;
|
---|
| 1799 | }
|
---|
| 1800 | try {
|
---|
| 1801 | weakSetHas.call(x, weakSetHas);
|
---|
| 1802 | try {
|
---|
| 1803 | weakMapHas.call(x, weakMapHas);
|
---|
| 1804 | } catch (s) {
|
---|
| 1805 | return true;
|
---|
| 1806 | }
|
---|
| 1807 | return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
|
---|
| 1808 | } catch (e) {}
|
---|
| 1809 | return false;
|
---|
| 1810 | }
|
---|
| 1811 |
|
---|
| 1812 | function isElement(x) {
|
---|
| 1813 | if (!x || typeof x !== 'object') { return false; }
|
---|
| 1814 | if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
|
---|
| 1815 | return true;
|
---|
| 1816 | }
|
---|
| 1817 | return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
|
---|
| 1818 | }
|
---|
| 1819 |
|
---|
| 1820 | function inspectString(str, opts) {
|
---|
| 1821 | if (str.length > opts.maxStringLength) {
|
---|
| 1822 | var remaining = str.length - opts.maxStringLength;
|
---|
| 1823 | var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
|
---|
| 1824 | return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
|
---|
| 1825 | }
|
---|
| 1826 | // eslint-disable-next-line no-control-regex
|
---|
| 1827 | var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
|
---|
| 1828 | return wrapQuotes(s, 'single', opts);
|
---|
| 1829 | }
|
---|
| 1830 |
|
---|
| 1831 | function lowbyte(c) {
|
---|
| 1832 | var n = c.charCodeAt(0);
|
---|
| 1833 | var x = {
|
---|
| 1834 | 8: 'b',
|
---|
| 1835 | 9: 't',
|
---|
| 1836 | 10: 'n',
|
---|
| 1837 | 12: 'f',
|
---|
| 1838 | 13: 'r'
|
---|
| 1839 | }[n];
|
---|
| 1840 | if (x) { return '\\' + x; }
|
---|
| 1841 | return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
|
---|
| 1842 | }
|
---|
| 1843 |
|
---|
| 1844 | function markBoxed(str) {
|
---|
| 1845 | return 'Object(' + str + ')';
|
---|
| 1846 | }
|
---|
| 1847 |
|
---|
| 1848 | function weakCollectionOf(type) {
|
---|
| 1849 | return type + ' { ? }';
|
---|
| 1850 | }
|
---|
| 1851 |
|
---|
| 1852 | function collectionOf(type, size, entries, indent) {
|
---|
| 1853 | var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
|
---|
| 1854 | return type + ' (' + size + ') {' + joinedEntries + '}';
|
---|
| 1855 | }
|
---|
| 1856 |
|
---|
| 1857 | function singleLineValues(xs) {
|
---|
| 1858 | for (var i = 0; i < xs.length; i++) {
|
---|
| 1859 | if (indexOf(xs[i], '\n') >= 0) {
|
---|
| 1860 | return false;
|
---|
| 1861 | }
|
---|
| 1862 | }
|
---|
| 1863 | return true;
|
---|
| 1864 | }
|
---|
| 1865 |
|
---|
| 1866 | function getIndent(opts, depth) {
|
---|
| 1867 | var baseIndent;
|
---|
| 1868 | if (opts.indent === '\t') {
|
---|
| 1869 | baseIndent = '\t';
|
---|
| 1870 | } else if (typeof opts.indent === 'number' && opts.indent > 0) {
|
---|
| 1871 | baseIndent = $join.call(Array(opts.indent + 1), ' ');
|
---|
| 1872 | } else {
|
---|
| 1873 | return null;
|
---|
| 1874 | }
|
---|
| 1875 | return {
|
---|
| 1876 | base: baseIndent,
|
---|
| 1877 | prev: $join.call(Array(depth + 1), baseIndent)
|
---|
| 1878 | };
|
---|
| 1879 | }
|
---|
| 1880 |
|
---|
| 1881 | function indentedJoin(xs, indent) {
|
---|
| 1882 | if (xs.length === 0) { return ''; }
|
---|
| 1883 | var lineJoiner = '\n' + indent.prev + indent.base;
|
---|
| 1884 | return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
|
---|
| 1885 | }
|
---|
| 1886 |
|
---|
| 1887 | function arrObjKeys(obj, inspect) {
|
---|
| 1888 | var isArr = isArray(obj);
|
---|
| 1889 | var xs = [];
|
---|
| 1890 | if (isArr) {
|
---|
| 1891 | xs.length = obj.length;
|
---|
| 1892 | for (var i = 0; i < obj.length; i++) {
|
---|
| 1893 | xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
|
---|
| 1894 | }
|
---|
| 1895 | }
|
---|
| 1896 | var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
|
---|
| 1897 | var symMap;
|
---|
| 1898 | if (hasShammedSymbols) {
|
---|
| 1899 | symMap = {};
|
---|
| 1900 | for (var k = 0; k < syms.length; k++) {
|
---|
| 1901 | symMap['$' + syms[k]] = syms[k];
|
---|
| 1902 | }
|
---|
| 1903 | }
|
---|
| 1904 |
|
---|
| 1905 | for (var key in obj) { // eslint-disable-line no-restricted-syntax
|
---|
| 1906 | if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
|
---|
| 1907 | if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
|
---|
| 1908 | if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
|
---|
| 1909 | // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
|
---|
| 1910 | continue; // eslint-disable-line no-restricted-syntax, no-continue
|
---|
| 1911 | } else if ($test.call(/[^\w$]/, key)) {
|
---|
| 1912 | xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
|
---|
| 1913 | } else {
|
---|
| 1914 | xs.push(key + ': ' + inspect(obj[key], obj));
|
---|
| 1915 | }
|
---|
| 1916 | }
|
---|
| 1917 | if (typeof gOPS === 'function') {
|
---|
| 1918 | for (var j = 0; j < syms.length; j++) {
|
---|
| 1919 | if (isEnumerable.call(obj, syms[j])) {
|
---|
| 1920 | xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
|
---|
| 1921 | }
|
---|
| 1922 | }
|
---|
| 1923 | }
|
---|
| 1924 | return xs;
|
---|
| 1925 | }
|
---|
| 1926 |
|
---|
| 1927 | },{"./util.inspect":6}],16:[function(require,module,exports){
|
---|
| 1928 | 'use strict';
|
---|
| 1929 |
|
---|
| 1930 | var GetIntrinsic = require('get-intrinsic');
|
---|
| 1931 | var callBound = require('call-bind/callBound');
|
---|
| 1932 | var inspect = require('object-inspect');
|
---|
| 1933 |
|
---|
| 1934 | var $TypeError = GetIntrinsic('%TypeError%');
|
---|
| 1935 | var $WeakMap = GetIntrinsic('%WeakMap%', true);
|
---|
| 1936 | var $Map = GetIntrinsic('%Map%', true);
|
---|
| 1937 |
|
---|
| 1938 | var $weakMapGet = callBound('WeakMap.prototype.get', true);
|
---|
| 1939 | var $weakMapSet = callBound('WeakMap.prototype.set', true);
|
---|
| 1940 | var $weakMapHas = callBound('WeakMap.prototype.has', true);
|
---|
| 1941 | var $mapGet = callBound('Map.prototype.get', true);
|
---|
| 1942 | var $mapSet = callBound('Map.prototype.set', true);
|
---|
| 1943 | var $mapHas = callBound('Map.prototype.has', true);
|
---|
| 1944 |
|
---|
| 1945 | /*
|
---|
| 1946 | * This function traverses the list returning the node corresponding to the
|
---|
| 1947 | * given key.
|
---|
| 1948 | *
|
---|
| 1949 | * That node is also moved to the head of the list, so that if it's accessed
|
---|
| 1950 | * again we don't need to traverse the whole list. By doing so, all the recently
|
---|
| 1951 | * used nodes can be accessed relatively quickly.
|
---|
| 1952 | */
|
---|
| 1953 | var listGetNode = function (list, key) { // eslint-disable-line consistent-return
|
---|
| 1954 | for (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {
|
---|
| 1955 | if (curr.key === key) {
|
---|
| 1956 | prev.next = curr.next;
|
---|
| 1957 | curr.next = list.next;
|
---|
| 1958 | list.next = curr; // eslint-disable-line no-param-reassign
|
---|
| 1959 | return curr;
|
---|
| 1960 | }
|
---|
| 1961 | }
|
---|
| 1962 | };
|
---|
| 1963 |
|
---|
| 1964 | var listGet = function (objects, key) {
|
---|
| 1965 | var node = listGetNode(objects, key);
|
---|
| 1966 | return node && node.value;
|
---|
| 1967 | };
|
---|
| 1968 | var listSet = function (objects, key, value) {
|
---|
| 1969 | var node = listGetNode(objects, key);
|
---|
| 1970 | if (node) {
|
---|
| 1971 | node.value = value;
|
---|
| 1972 | } else {
|
---|
| 1973 | // Prepend the new node to the beginning of the list
|
---|
| 1974 | objects.next = { // eslint-disable-line no-param-reassign
|
---|
| 1975 | key: key,
|
---|
| 1976 | next: objects.next,
|
---|
| 1977 | value: value
|
---|
| 1978 | };
|
---|
| 1979 | }
|
---|
| 1980 | };
|
---|
| 1981 | var listHas = function (objects, key) {
|
---|
| 1982 | return !!listGetNode(objects, key);
|
---|
| 1983 | };
|
---|
| 1984 |
|
---|
| 1985 | module.exports = function getSideChannel() {
|
---|
| 1986 | var $wm;
|
---|
| 1987 | var $m;
|
---|
| 1988 | var $o;
|
---|
| 1989 | var channel = {
|
---|
| 1990 | assert: function (key) {
|
---|
| 1991 | if (!channel.has(key)) {
|
---|
| 1992 | throw new $TypeError('Side channel does not contain ' + inspect(key));
|
---|
| 1993 | }
|
---|
| 1994 | },
|
---|
| 1995 | get: function (key) { // eslint-disable-line consistent-return
|
---|
| 1996 | if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
---|
| 1997 | if ($wm) {
|
---|
| 1998 | return $weakMapGet($wm, key);
|
---|
| 1999 | }
|
---|
| 2000 | } else if ($Map) {
|
---|
| 2001 | if ($m) {
|
---|
| 2002 | return $mapGet($m, key);
|
---|
| 2003 | }
|
---|
| 2004 | } else {
|
---|
| 2005 | if ($o) { // eslint-disable-line no-lonely-if
|
---|
| 2006 | return listGet($o, key);
|
---|
| 2007 | }
|
---|
| 2008 | }
|
---|
| 2009 | },
|
---|
| 2010 | has: function (key) {
|
---|
| 2011 | if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
---|
| 2012 | if ($wm) {
|
---|
| 2013 | return $weakMapHas($wm, key);
|
---|
| 2014 | }
|
---|
| 2015 | } else if ($Map) {
|
---|
| 2016 | if ($m) {
|
---|
| 2017 | return $mapHas($m, key);
|
---|
| 2018 | }
|
---|
| 2019 | } else {
|
---|
| 2020 | if ($o) { // eslint-disable-line no-lonely-if
|
---|
| 2021 | return listHas($o, key);
|
---|
| 2022 | }
|
---|
| 2023 | }
|
---|
| 2024 | return false;
|
---|
| 2025 | },
|
---|
| 2026 | set: function (key, value) {
|
---|
| 2027 | if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
|
---|
| 2028 | if (!$wm) {
|
---|
| 2029 | $wm = new $WeakMap();
|
---|
| 2030 | }
|
---|
| 2031 | $weakMapSet($wm, key, value);
|
---|
| 2032 | } else if ($Map) {
|
---|
| 2033 | if (!$m) {
|
---|
| 2034 | $m = new $Map();
|
---|
| 2035 | }
|
---|
| 2036 | $mapSet($m, key, value);
|
---|
| 2037 | } else {
|
---|
| 2038 | if (!$o) {
|
---|
| 2039 | /*
|
---|
| 2040 | * Initialize the linked list as an empty node, so that we don't have
|
---|
| 2041 | * to special-case handling of the first node: we can always refer to
|
---|
| 2042 | * it as (previous node).next, instead of something like (list).head
|
---|
| 2043 | */
|
---|
| 2044 | $o = { key: {}, next: null };
|
---|
| 2045 | }
|
---|
| 2046 | listSet($o, key, value);
|
---|
| 2047 | }
|
---|
| 2048 | }
|
---|
| 2049 | };
|
---|
| 2050 | return channel;
|
---|
| 2051 | };
|
---|
| 2052 |
|
---|
| 2053 | },{"call-bind/callBound":7,"get-intrinsic":11,"object-inspect":15}]},{},[2])(2)
|
---|
| 2054 | });
|
---|