Files
peasy/dist/peasy.min.js
2023-01-31 14:40:16 +01:00

2 lines
901 B
JavaScript

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).html=n()}(this,(function(){"use strict";const e=/[\n\t]| {2,}/g,n=document.createElement("div"),t="ABCDEFGHIJKLMNOPQRSTUVWXYZ";function o(n){return n.map((n=>n.replace(e,"")))}function r(e){const n={nodes:[]};return n.values=e.map((e=>{if(e instanceof Node){const o=function(){let e="";for(let n=0;n<10;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return e}();return n.nodes.push({id:o,node:e}),`<div id="${o}"></div>`}return e})),n}return function(e,...t){const i=r(t),d=String.raw({raw:o(e.raw)},...i.values);return n.innerHTML=d,i.nodes.forEach((({id:e,node:t})=>{const o=n.querySelector(`#${e}`);o.after(t),o.remove()})),1===n.childElementCount?n.firstChild:n.childElementCount>1?n.children:null}}));