MCPcopy
hub / github.com/alibaba/nacos / stringify

Method stringify

console/src/main/resources/static/legacy/js/1.js:13–13  ·  view source on GitHub ↗
({range:e,source:t},{anchors:r,doc:n,implicitKey:s,inStringifyKey:o})

Source from the content-addressed store, hash-verified

11`+p),y=a.comment):a&&"object"==typeof a&&(a=u.schema.createNode(a,!0)),e.implicitKey=!1,!l&&!this.comment&&a instanceof x&&(e.indentAtStart=m.length+1),d=!1,!s&&2<=n&&!e.inFlow&&!l&&a instanceof S&&a.type!==b.e.FLOW_SEQ&&!a.tag&&!u.anchors.getName(a)&&(e.indent=e.indent.substr(2));o=h(a,e,()=>y=null,()=>d=!0);let v=" ";return g||this.comment?v=g+`
12`+e.indent:!l&&a instanceof E?("["!==o[0]&&"{"!==o[0]||o.includes("\n"))&&(v=`
13`+e.indent):"\n"===o[0]&&(v=""),d&&!y&&r&&r(),w(m+v+o,e.indent,y)}}Object(b.g)(g,"Type",{PAIR:"PAIR",MERGE_PAIR:"MERGE_PAIR"});const a=(t,r)=>{var e;if(t instanceof u)return(e=r.get(t.source)).count*e.aliasCount;if(t instanceof E){let e=0;for(const s of t.items){var n=a(s,r);n>e&&(e=n)}return e}return t instanceof g?(e=a(t.key,r),t=a(t.value,r),Math.max(e,t)):1};class u extends O{static stringify({range:e,source:t},{anchors:r,doc:n,implicitKey:s,inStringifyKey:o}){let i=Object.keys(r).find(e=>r[e]===t);if(i=!i&&o?n.anchors.getName(t)||n.anchors.newName():i)return"*"+i+(s?" ":"");o=n.anchors.getName(t)?"Alias node must be after source node":"Source node not found for alias node";throw new Error(o+` [${e}]`)}constructor(e){super(),this.source=e,this.type=b.e.ALIAS}set tag(e){throw new Error("Alias nodes cannot have tags")}toJSON(e,t){if(!t)return o(this.source,e,t);var r,{anchors:e,maxAliasCount:t}=t,n=e.get(this.source);if(!n||void 0===n.res)throw r="This should not happen: Alias anchor was not resolved?",this.cstNode?new b.m(this.cstNode,r):new ReferenceError(r);if(0<=t&&(n.count+=1,0===n.aliasCount&&(n.aliasCount=a(this.source,e)),n.count*n.aliasCount>t))throw r="Excessive alias count indicates a resource exhaustion attack",this.cstNode?new b.m(this.cstNode,r):new ReferenceError(r);return n.res}toString(e){return u.stringify(this,e)}}function c(e,t){var r=t instanceof x?t.value:t;for(const n of e)if(n instanceof g){if(n.key===t||n.key===r)return n;if(n.key&&n.key.value===r)return n}}Object(b.g)(u,"default",!0);class f extends E{add(t,e){t?t instanceof g||(t=new g(t.key||t,t.value)):t=new g(t);var r=c(this.items,t.key);const n=this.schema&&this.schema.sortMapEntries;if(r){if(!e)throw new Error(`Key ${t.key} already set`);r.value=t.value}else!n||-1===(e=this.items.findIndex(e=>n(t,e)<0))?this.items.push(t):this.items.splice(e,0,t)}delete(e){e=c(this.items,e);return!!e&&0<this.items.splice(this.items.indexOf(e),1).length}get(e,t){e=c(this.items,e),e=e&&e.value;return!t&&e instanceof x?e.value:e}has(e){return!!c(this.items,e)}set(e,t){this.add(new g(e,t),!0)}toJSON(e,t,r){var n=r?new r:t&&t.mapAsMap?new Map:{};t&&t.onCreate&&t.onCreate(n);for(const s of this.items)s.addToJSMap(t,n);return n}toString(e,t,r){if(!e)return JSON.stringify(this);for(const n of this.items)if(!(n instanceof g))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return super.toString(e,{blockItem:e=>e.str,flowChars:{start:"{",end:"}"},isMap:!0,itemIndent:e.indent||""},t,r)}}const p="<<";class h extends g{constructor(t){if(t instanceof g){let e=t.value;e instanceof S||((e=new S).items.push(t.value),e.range=t.value.range),super(t.key,e),this.range=t.range}else super(new x(p),new S);this.type=g.Type.MERGE_PAIR}addToJSMap(e,t){for(var{source:r}of this.value.items){if(!(r instanceof f))throw new Error("Merge sources must be maps");var n,s;for([n,s]of r.toJSON(null,e,Map))t instanceof Map?t.has(n)||t.set(n,s):t instanceof Set?t.add(n):Object.prototype.hasOwnProperty.call(t,n)||Object.defineProperty(t,n,{value:s,writable:!0,enumerable:!0,configurable:!0})}return t}toString(e,t){var r=this.value;if(1<r.items.length)return super.toString(e,t);this.value=r.items[0];e=super.toString(e,t);return this.value=r,e}}const d={defaultType:b.e.BLOCK_LITERAL,lineWidth:76},m={trueStr:"true",falseStr:"false"},$={asBigInt:!1},F={nullStr:"null"},y={defaultType:b.e.PLAIN,doubleQuoted:{jsonEncoding:!1,minMultiLineLength:40},fold:{lineWidth:80,minContentWidth:20}};function v(e,t,r){for(var{format:n,test:s,resolve:o}of t)if(s){s=e.match(s);if(s){let e=o.apply(null,s);return e instanceof x||(e=new x(e)),n&&(e.format=n),e}}return r&&(e=r(e)),new x(e)}const A="flow",k="block",N="quoted",L=(e,t)=>{let r=e[t+1];for(;" "===r||"\t"===r;){for(;(r=e[t+=1])&&"\n"!==r;);r=e[t+1]}return t};function I(t,r,n,{indentAtStart:e,lineWidth:s=80,minContentWidth:o=20,onFold:i,onOverflow:a}){if(!s||s<0)return t;var c=Math.max(1+o,1+s-r.length);if(t.length<=c)return t;var l=[],u={};let f=s-r.length,p=("number"==typeof e&&(e>s-Math.max(2,o)?l.push(0):f=s-e),void 0),h=void 0,d=!1,m=-1,g=-1,y=-1;n===k&&-1!==(m=L(t,m))&&(f=m+c);for(let e;e=t[m+=1];){if(n===N&&"\\"===e){switch(t[(g=m)+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}y=m}if("\n"===e)n===k&&(m=L(t,m)),f=m+c,p=void 0;else if(" "===e&&h&&" "!==h&&"\n"!==h&&"\t"!==h&&(v=t[m+1])&&" "!==v&&"\n"!==v&&"\t"!==v&&(p=m),m>=f)if(p)l.push(p),f=p+c,p=void 0;else if(n===N){for(;" "===h||"\t"===h;)h=e,e=t[m+=1],d=!0;var v=m>y+1?m-2:g-1;if(u[v])return t;l.push(v),u[v]=!0,f=v+c,p=void 0}else d=!0;h=e}if(d&&a&&a(),0===l.length)return t;i&&i();let b=t.slice(0,l[0]);for(let e=0;e<l.length;++e){var w=l[e];const f=l[e+1]||t.length;0===w?b=`
14`+r+t.slice(0,f):(n===N&&u[w]&&(b+=t[w]+"\\"),b+=`
15`+r+t.slice(w+1,f))}return b}const C=({indentAtStart:e})=>e?Object.assign({indentAtStart:e},y.fold):y.fold,T=e=>/^(%|---|\.\.\.)/m.test(e);function j(e,t){var r=t["implicitKey"],{jsonEncoding:n,minMultiLineLength:s}=y.doubleQuoted,o=JSON.stringify(e);if(n)return o;var i=t.indent||(T(e)?" ":"");let a="",c=0;for(let e=0,t=o[e];t;t=o[++e])if(" "===t&&"\\"===o[e+1]&&"n"===o[e+2]&&(a+=o.slice(c,e)+"\\ ",e+=1,c=e,t="\\"),"\\"===t)switch(o[e+1]){case"u":a+=o.slice(c,e);var l=o.substr(e+2,4);switch(l){case"0000":a+="\\0";break;case"0007":a+="\\a";break;case"000b":a+="\\v";break;case"001b":a+="\\e";break;case"0085":a+="\\N";break;case"00a0":a+="\\_";break;case"2028":a+="\\L";break;case"2029":a+="\\P";break;default:"00"===l.substr(0,2)?a+="\\x"+l.substr(2):a+=o.substr(e,6)}e+=5,c=e+1;break;case"n":if(r||'"'===o[e+2]||o.length<s)e+=1;else{for(a+=o.slice(c,e)+"\n\n";"\\"===o[e+2]&&"n"===o[e+3]&&'"'!==o[e+4];)a+="\n",e+=2;a+=i," "===o[e+2]&&(a+="\\"),e+=1,c=e+1}break;default:e+=1}return a=c?a+o.slice(c):o,r?a:I(a,i,N,C(t))}function M(e,t){if(t.implicitKey){if(/\n/.test(e))return j(e,t)}else if(/[ \t]\n|\n[ \t]/.test(e))return j(e,t);var r=t.indent||(T(e)?" ":""),e="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
16`+r)+"'";return t.implicitKey?e:I(e,r,A,C(t))}function R({comment:e,type:t,value:r},n,s,o){if(/\n[\t ]+$/.test(r)||/^\s*$/.test(r))return j(r,n);n=n.indent||(n.forceBlockIndent||T(r)?" ":"");const i=n?"2":"1";t=t!==b.e.BLOCK_FOLDED&&(t===b.e.BLOCK_LITERAL||!function(r,e,t){if(e&&!(e<0)){var n=e-t,s=r.length;if(!(s<=n)){for(let e=0,t=0;e<s;++e)if("\n"===r[e]){if(e-t>n)return 1;if(s-(t=e+1)<=n)return}return 1}}}(r,y.fold.lineWidth,n.length));let a=t?"|":">";if(!r)return a+"\n";let c="",l="";if(r=r.replace(/[\n\t ]*$/,e=>{var t=e.indexOf("\n");return-1===t?a+="-":r!==e&&t===e.length-1||(a+="+",o&&o()),l=e.replace(/\n$/,""),""}).replace(/^[\n ]*/,e=>{-1!==e.indexOf(" ")&&(a+=i);var t=e.match(/ +$/);return t?(c=e.slice(0,-t[0].length),t[0]):(c=e,"")}),l=l&&l.replace(/\n+(?!\n|$)/g,"$&"+n),c=c&&c.replace(/\n+/g,"$&"+n),e&&(a+=" #"+e.replace(/ ?[\r\n]+/g," "),s)&&s(),!r)return""+a+i+`

Callers 15

PFunction · 0.45
main.jsFile · 0.45
nFunction · 0.45
oFunction · 0.45
hFunction · 0.45
tFunction · 0.45
IFunction · 0.45
peFunction · 0.45
uFunction · 0.45
aFunction · 0.45
xFunction · 0.45
rFunction · 0.45

Calls 4

findMethod · 0.65
getNameMethod · 0.65
keysMethod · 0.45
newNameMethod · 0.45

Tested by 3

runThisSpecFunction · 0.36
runThisSpecFunction · 0.36
runThisSpecFunction · 0.36