UNPKG

@glimmer/util

Version:
3 lines (2 loc) 2.46 kB
const t=Object.freeze([]);function n(){return t}const e=n(),r=n();function o(n){return n===t}function*l(t){for(let n=t.length-1;n>=0;n--)yield t[n]}function*c(t){let n=0;for(const e of t)yield[n++,e]}function*u(t,n){for(let e=0;e<t.length;e++)yield[e,t[e],n[e]]}function*i(t,n){for(let e=0;e<t.length;e++){const r=e<n.length?"retain":"pop";yield[r,e,t[e],n[e]]}for(let e=t.length;e<n.length;e++)yield["push",e,void 0,n[e]]}function s(t){return t.length>0}function f(t){return 0===t.length?void 0:t[t.length-1]}function h(){return Object.create(null)}function a(t){return null!=t}function g(t){return"function"==typeof t||"object"==typeof t&&null!==t}class p{stack;current=null;constructor(t=[]){this.stack=t}get size(){return this.stack.length}push(t){this.current=t,this.stack.push(t)}pop(){let t=this.stack.pop();return this.current=f(this.stack)??null,void 0===t?null:t}nth(t){let n=this.stack.length;return n<t?null:this.stack[n-t]}isEmpty(){return 0===this.stack.length}snapshot(){return[...this.stack]}toArray(){return this.stack}}let d,b,k,y;function j(t){let n=t.firstChild;for(;n;){let e=n.nextSibling;t.removeChild(n),n=e}}function v(t){let n={};n[t]=1;for(let e in n)if(e===t)return e;return t}const O="%+b:0%";function $(t){return t.nodeValue===O}let x=Object.assign;function S(t){return Object.values(t)}function m(t){return Object.entries(t)}function w(t){return Object.keys(t)}function z(t,...n){let e="";for(const[r,o]of c(t))e+=`${o}${void 0!==n[r]?String(n[r]):""}`;let r=e.split("\n");for(;s(r)&&/^\s*$/u.test(0===(o=r).length?void 0:o[0]);)r.shift();for(var o;s(r)&&/^\s*$/u.test(f(r));)r.pop();let l=1/0;for(let t of r){let n=/^\s*/u.exec(t)[0].length;l=Math.min(l,n)}let u=[];for(let t of r)u.push(t.slice(l));return u.join("\n")}const C=console,E=console;function A(t,n="unexpected unreachable branch"){throw E.log("unreachable",t),E.log(`${n} :: ${JSON.stringify(t)} (${t})`),new Error("code reached unreachable")}export{t as EMPTY_ARRAY,r as EMPTY_NUMBER_ARRAY,e as EMPTY_STRING_ARRAY,C as LOCAL_LOGGER,E as LOGGER,O as SERIALIZATION_FIRST_NODE_STRING,p as Stack,A as assertNever,x as assign,d as beginTestSteps,j as clearElement,h as dict,n as emptyArray,b as endTestSteps,m as entries,c as enumerate,v as intern,a as isDict,o as isEmptyArray,g as isIndexable,$ as isSerializationFirstNode,w as keys,y as logStep,l as reverse,z as strip,S as values,k as verifySteps,i as zipArrays,u as zipTuples}; //# sourceMappingURL=index.js.map