MCPcopy
hub / github.com/vercel/hyper / stringifyLangArgs

Function stringifyLangArgs

bin/yarn-standalone.js:35348–35368  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

35346const EventEmitter = __webpack_require__(77).EventEmitter;
35347
35348function stringifyLangArgs(args) {
35349 return args.map(function (val) {
35350 if (val != null && val.inspect) {
35351 return val.inspect();
35352 } else {
35353 try {
35354 const str = JSON.stringify(val) || val + '';
35355 // should match all literal line breaks and
35356 // "u001b" that follow an odd number of backslashes and convert them to ESC
35357 // we do this because the JSON.stringify process has escaped these characters
35358 return str.replace(/((?:^|[^\\])(?:\\{2})*)\\u001[bB]/g, '$1\u001b').replace(/[\\]r[\\]n|([\\])?[\\]n/g, (match, precededBacklash) => {
35359 // precededBacklash not null when "\n" is preceded by a backlash ("\\n")
35360 // match will be "\\n" and we don't replace it with os.EOL
35361 return precededBacklash ? match : (_os || _load_os()).default.EOL;
35362 });
35363 } catch (e) {
35364 return util.inspect(val);
35365 }
35366 }
35367 });
35368}
35369
35370class BaseReporter {
35371 constructor(opts = {}) {

Callers 1

langMethod · 0.85

Calls 2

_load_osFunction · 0.85
inspectMethod · 0.45

Tested by

no test coverage detected