UNPKG

jsx-slack

Version:

Build JSON object for Slack Block Kit surfaces from JSX

2 lines (1 loc) 980 B
import{color as j}from"./color.mjs";import{convert as k}from"../../unist-util-is/lib/index.mjs";const g=[],b=!0,p=!1,N="skip";function E(t,o,u,s){let y;typeof o=="function"&&typeof u!="function"?(s=u,u=o):y=o;const P=k(y),m=s?-1:1;h(t,void 0,[])();function h(n,A,l){const i=n&&typeof n=="object"?n:{};if(typeof i.type=="string"){const e=typeof i.tagName=="string"?i.tagName:typeof i.name=="string"?i.name:void 0;Object.defineProperty(d,"name",{value:"node ("+j(n.type+(e?"<"+e+">":""))+")"})}return d;function d(){let e=g,f,r,a;if((!o||P(n,A,l[l.length-1]||void 0))&&(e=O(u(n,l)),e[0]===p))return e;if("children"in n&&n.children){const c=n;if(c.children&&e[0]!==N)for(r=(s?c.children.length:-1)+m,a=l.concat(c);r>-1&&r<c.children.length;){const I=c.children[r];if(f=h(I,r,a)(),f[0]===p)return f;r=typeof f[1]=="number"?f[1]:r+m}}return e}}}function O(t){return Array.isArray(t)?t:typeof t=="number"?[b,t]:t==null?g:[t]}export{b as CONTINUE,p as EXIT,N as SKIP,E as visitParents};