From 3d30f66bd721f562bce87810911e6bd1f35f27b2 Mon Sep 17 00:00:00 2001 From: Richie Bendall Date: Mon, 8 Apr 2024 20:00:35 +1200 Subject: [PATCH 1/2] Dot Prop Views --- index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/index.js b/index.js index acc3a53..22ad22a 100644 --- a/index.js +++ b/index.js @@ -177,6 +177,15 @@ function assertNotStringIndex(object, key) { } } +export default function dotProp(object) { + return new Proxy(object, { + get: (target, property, receiver) => getProperty(object, property), + set: (target, property, value, receiver) => setProperty(object, property, value), + deleteProperty: (target, property) => deleteProperty(object, property), + has: (target, property) => hasProperty(object, property), + }); +} + export function getProperty(object, path, value) { if (!isObject(object) || typeof path !== 'string') { return value === undefined ? object : value; From 5b6e519efdfe03cfae8cf34b37b46261d704f5b4 Mon Sep 17 00:00:00 2001 From: Richie Bendall Date: Sun, 3 Nov 2024 14:17:53 +1300 Subject: [PATCH 2/2] Update index.js --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 22ad22a..c8dccea 100644 --- a/index.js +++ b/index.js @@ -179,10 +179,10 @@ function assertNotStringIndex(object, key) { export default function dotProp(object) { return new Proxy(object, { - get: (target, property, receiver) => getProperty(object, property), - set: (target, property, value, receiver) => setProperty(object, property, value), - deleteProperty: (target, property) => deleteProperty(object, property), - has: (target, property) => hasProperty(object, property), + get: (_target, property, _receiver) => getProperty(object, property), + set: (_target, property, value, _receiver) => setProperty(object, property, value), + deleteProperty: (_target, property) => deleteProperty(object, property), + has: (_target, property) => hasProperty(object, property), }); }