Skip to content

Commit

Permalink
Dot Prop Views
Browse files Browse the repository at this point in the history
  • Loading branch information
Richienb committed Apr 8, 2024
1 parent 3dd188c commit 3d30f66
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.js
Expand Up @@ -177,6 +177,15 @@ function assertNotStringIndex(object, key) {
}
}

export default function dotProp(object) {
return new Proxy(object, {
get: (target, property, receiver) => getProperty(object, property),

Check failure on line 182 in index.js

View workflow job for this annotation

GitHub Actions / Node.js 20

'receiver' is defined but never used. Allowed unused args must match /^_/u.

Check failure on line 182 in index.js

View workflow job for this annotation

GitHub Actions / Node.js 18

'receiver' is defined but never used. Allowed unused args must match /^_/u.

Check failure on line 182 in index.js

View workflow job for this annotation

GitHub Actions / Node.js 16

'receiver' is defined but never used. Allowed unused args must match /^_/u.
set: (target, property, value, receiver) => setProperty(object, property, value),

Check failure on line 183 in index.js

View workflow job for this annotation

GitHub Actions / Node.js 20

'receiver' is defined but never used. Allowed unused args must match /^_/u.

Check failure on line 183 in index.js

View workflow job for this annotation

GitHub Actions / Node.js 18

'receiver' is defined but never used. Allowed unused args must match /^_/u.

Check failure on line 183 in index.js

View workflow job for this annotation

GitHub Actions / Node.js 16

'receiver' is defined but never used. Allowed unused args must match /^_/u.
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;
Expand Down

0 comments on commit 3d30f66

Please sign in to comment.