UNPKG

@webreflection/uwire

Version:

A way to create persistent fragments

1 lines 1.33 kB
var uwire=function(t){"use strict";function r(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,r){if(!t)return;if("string"==typeof t)return e(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,r)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}return t.diffable=function(t,r){return 111===t.nodeType?1/r<0?r?(n=(e=t).firstChild,i=e.lastChild,(o=document.createRange()).setStartAfter(n),o.setEndAfter(i),o.deleteContents(),n):t.lastChild:r?t.valueOf():t.firstChild:t;var e,n,i,o},t.persistent=function(t){var e=t.firstChild,n=t.lastChild;if(e===n)return n||t;var i=t.childNodes,o=r(i);return{ELEMENT_NODE:1,nodeType:111,firstChild:e,lastChild:n,valueOf:function(){return i.length!==o.length&&t.append.apply(t,r(o)),t}}},Object.defineProperty(t,"__esModule",{value:!0}),t}({});