UNPKG

@forbespro/lead-agent

Version:
34 lines (33 loc) 849 B
import { DefinedInfo as s } from "./index141.js"; import { Info as p } from "./index142.js"; import { normalize as f } from "./index143.js"; const l = /[A-Z]/g, c = /-[a-z]/g, d = /^data[-\w.:]+$/i; function y(r, t) { const o = f(t); let i = t, a = p; if (o in r.normal) return r.property[r.normal[o]]; if (o.length > 4 && o.slice(0, 4) === "data" && d.test(t)) { if (t.charAt(4) === "-") { const e = t.slice(5).replace(c, h); i = "data" + e.charAt(0).toUpperCase() + e.slice(1); } else { const e = t.slice(4); if (!c.test(e)) { let n = e.replace(l, m); n.charAt(0) !== "-" && (n = "-" + n), t = "data" + n; } } a = s; } return new a(i, t); } function m(r) { return "-" + r.toLowerCase(); } function h(r) { return r.charAt(1).toUpperCase(); } export { y as find };