Changeset 0c6b92a for imaps-frontend/node_modules/object-inspect/index.js
Legend:
- Unmodified
- Added
- Removed
-
imaps-frontend/node_modules/object-inspect/index.js
rd565449 r0c6b92a 70 70 var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null; 71 71 72 var quotes = { 73 __proto__: null, 74 'double': '"', 75 single: "'" 76 }; 77 var quoteREs = { 78 __proto__: null, 79 'double': /(["\\])/g, 80 single: /(['\\])/g 81 }; 82 72 83 module.exports = function inspect_(obj, options, depth, seen) { 73 84 var opts = options || {}; 74 85 75 if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {86 if (has(opts, 'quoteStyle') && !has(quotes, opts.quoteStyle)) { 76 87 throw new TypeError('option "quoteStyle" must be "single" or "double"'); 77 88 } … … 268 279 269 280 function wrapQuotes(s, defaultStyle, opts) { 270 var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'"; 281 var style = opts.quoteStyle || defaultStyle; 282 var quoteChar = quotes[style]; 271 283 return quoteChar + s + quoteChar; 272 284 } … … 426 438 return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer; 427 439 } 440 var quoteRE = quoteREs[opts.quoteStyle || 'single']; 441 quoteRE.lastIndex = 0; 428 442 // eslint-disable-next-line no-control-regex 429 var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);443 var s = $replace.call($replace.call(str, quoteRE, '\\$1'), /[\x00-\x1f]/g, lowbyte); 430 444 return wrapQuotes(s, 'single', opts); 431 445 }
Note:
See TracChangeset
for help on using the changeset viewer.