MCPcopy
hub / github.com/Kong/insomnia / stringifyLangArgs

Function stringifyLangArgs

packages/insomnia/bin/yarn-standalone.js:34914–34934  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

34912const EventEmitter = __webpack_require__(69).EventEmitter;
34913
34914function stringifyLangArgs(args) {
34915 return args.map(function (val) {
34916 if (val != null && val.inspect) {
34917 return val.inspect();
34918 } else {
34919 try {
34920 const str = JSON.stringify(val) || val + '';
34921 // should match all literal line breaks and
34922 // "u001b" that follow an odd number of backslashes and convert them to ESC
34923 // we do this because the JSON.stringify process has escaped these characters
34924 return str.replace(/((?:^|[^\\])(?:\\{2})*)\\u001[bB]/g, '$1\u001b').replace(/[\\]r[\\]n|([\\])?[\\]n/g, (match, precededBacklash) => {
34925 // precededBacklash not null when "\n" is preceded by a backlash ("\\n")
34926 // match will be "\\n" and we don't replace it with os.EOL
34927 return precededBacklash ? match : (_os || _load_os()).default.EOL;
34928 });
34929 } catch (e) {
34930 return util.inspect(val);
34931 }
34932 }
34933 });
34934}
34935
34936class BaseReporter {
34937 constructor(opts = {}) {

Callers 1

langMethod · 0.85

Calls 2

_load_osFunction · 0.85
inspectMethod · 0.45

Tested by

no test coverage detected