(argument, options)
| 95 | var escapeEverythingRegex = /([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^]/g; |
| 96 | var escapeNonAsciiRegex = /([\uD800-\uDBFF][\uDC00-\uDFFF])|([\uD800-\uDFFF])|(['"`])|[^ !#-&\(-\[\]-_a-~]/g; |
| 97 | var jsesc2 = (argument, options) => { |
| 98 | const increaseIndentation = () => { |
| 99 | oldIndent = indent; |
| 100 | ++options.indentLevel; |
| 101 | indent = options.indent.repeat(options.indentLevel); |
| 102 | }; |
| 103 | const defaults = { |
| 104 | "escapeEverything": false, |
| 105 | "minimal": false, |
| 106 | "isScriptContext": false, |
| 107 | "quotes": "single", |
| 108 | "wrap": false, |
| 109 | "es6": false, |
| 110 | "json": false, |
| 111 | "compact": true, |
| 112 | "lowercaseHex": false, |
| 113 | "numbers": "decimal", |
| 114 | "indent": " ", |
| 115 | "indentLevel": 0, |
| 116 | "__inline1__": false, |
| 117 | "__inline2__": false |
| 118 | }; |
| 119 | const json = options && options.json; |
| 120 | if (json) { |
| 121 | defaults.quotes = "double"; |
| 122 | defaults.wrap = true; |
| 123 | } |
| 124 | options = extend(defaults, options); |
| 125 | if (options.quotes != "single" && options.quotes != "double" && options.quotes != "backtick") { |
| 126 | options.quotes = "single"; |
| 127 | } |
| 128 | const quote = options.quotes == "double" ? '"' : options.quotes == "backtick" ? "`" : "'"; |
| 129 | const compact = options.compact; |
| 130 | const lowercaseHex = options.lowercaseHex; |
| 131 | let indent = options.indent.repeat(options.indentLevel); |
| 132 | let oldIndent = ""; |
| 133 | const inline1 = options.__inline1__; |
| 134 | const inline2 = options.__inline2__; |
| 135 | const newLine = compact ? "" : "\n"; |
| 136 | let result; |
| 137 | let isEmpty = true; |
| 138 | const useBinNumbers = options.numbers == "binary"; |
| 139 | const useOctNumbers = options.numbers == "octal"; |
| 140 | const useDecNumbers = options.numbers == "decimal"; |
| 141 | const useHexNumbers = options.numbers == "hexadecimal"; |
| 142 | if (json && argument && isFunction(argument.toJSON)) { |
| 143 | argument = argument.toJSON(); |
| 144 | } |
| 145 | if (!isString(argument)) { |
| 146 | if (isMap(argument)) { |
| 147 | if (argument.size == 0) { |
| 148 | return "new Map()"; |
| 149 | } |
| 150 | if (!compact) { |
| 151 | options.__inline1__ = true; |
| 152 | options.__inline2__ = false; |
| 153 | } |
| 154 | return "new Map(" + jsesc2(Array.from(argument), options) + ")"; |
nothing calls this directly
no test coverage detected