import { Ut } from "./Ut"; export class AppendOptions { constructor(target, data, opts) { opts = opts || {}; if (opts.clear) { this.replaceChildren(); } if (Ut.isStr(data)) { let options = ''; data.replace(/"((?:\\.|[^"\\])*)"\s*:\s*"((?:\\.|[^"\\])*)"/g, (_, k, v) => (options += ``, '') ); target.innerHTML = options; return; } Ut.each(data, (val, id) => target.append(new Option(val, id)) ); } }