UNPKG

ziggurat.js

Version:

a tiny modular js library for templates and other shorthands

2 lines (1 loc) 598 B
var zg;if(typeof HTML=="undefined"||HTML===null)throw new Error("can't find HTML. did you forget to import imperative-html?");zg={},zg.query=function(e){var t=document.querySelectorAll(e);return t.length===1?t[0]:t},zg.queryone=function(e){return document.querySelector(e)},zg.queryall=function(e){return document.querySelectorAll(e)},zg.deepfind=function(e,t){var n,s,o,i,a;t=t.trim(),o=function(){var e,n,o=t.split("."),i=[];for(e=0,n=o.length;e<n;e++)s=o[e],s!==""&&i.push(s);return i}();for(n=0,a=o.length;n<a;n++)if(i=o[n],e=e[i],e==null)throw new Error(`'${t}' not in data '${e}'`);return e}