2025-11-05 17:04:23 -03:00

14 lines
290 B
JavaScript

'use strict';
function clone(el) {
if (typeof el !== "object") return el;
const copy = new el.constructor(el.name, el.attrs);
for (let i = 0; i < el.children.length; i++) {
const child = el.children[i];
copy.cnode(clone(child));
}
return copy;
}
module.exports = clone;