Rename domLens to domProxy / domArray

This commit is contained in:
Talia 2024-02-06 22:02:29 +01:00
parent 39012902e0
commit 0a80d860df
Signed by: darkwiiplayer
GPG key ID: 7808674088232B3E

View file

@ -1,5 +1,5 @@
export const lens = (methods, extra) => { export const domArray = (methods, extra) => {
if (extra) return lens(extra)(methods) if (extra) return domArray(extra)(methods)
const traps = { const traps = {
get(target, prop) { get(target, prop) {
@ -55,9 +55,7 @@ export const lens = (methods, extra) => {
} }
return element => { return element => {
if (!(element instanceof Element)) throw(new Error("Creating domLens on non-element")) if (!(element instanceof Element)) throw(new Error("Creating domArray on non-element"))
return new Proxy(element, traps) return new Proxy(element, traps)
} }
} }
export default lens