Ignore:
Timestamp:
12/12/24 17:06:06 (5 weeks ago)
Author:
stefan toskovski <stefantoska84@…>
Branches:
main
Parents:
d565449
Message:

Pred finalna verzija

File:
1 edited

Legend:

Unmodified
Added
Removed
  • imaps-frontend/node_modules/object-inspect/index.js

    rd565449 r0c6b92a  
    7070var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
    7171
     72var quotes = {
     73    __proto__: null,
     74    'double': '"',
     75    single: "'"
     76};
     77var quoteREs = {
     78    __proto__: null,
     79    'double': /(["\\])/g,
     80    single: /(['\\])/g
     81};
     82
    7283module.exports = function inspect_(obj, options, depth, seen) {
    7384    var opts = options || {};
    7485
    75     if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
     86    if (has(opts, 'quoteStyle') && !has(quotes, opts.quoteStyle)) {
    7687        throw new TypeError('option "quoteStyle" must be "single" or "double"');
    7788    }
     
    268279
    269280function wrapQuotes(s, defaultStyle, opts) {
    270     var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
     281    var style = opts.quoteStyle || defaultStyle;
     282    var quoteChar = quotes[style];
    271283    return quoteChar + s + quoteChar;
    272284}
     
    426438        return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
    427439    }
     440    var quoteRE = quoteREs[opts.quoteStyle || 'single'];
     441    quoteRE.lastIndex = 0;
    428442    // 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);
    430444    return wrapQuotes(s, 'single', opts);
    431445}
Note: See TracChangeset for help on using the changeset viewer.