accessor-log-proxy
Advanced tools
Comparing version 1.0.1 to 1.1.0
export declare type createProxyOptions = { | ||
log: (keyStack: string[], value?: any) => void; | ||
log?: (keyStack: string[], value?: any) => void; | ||
includePrototypeProperties?: boolean; | ||
}; | ||
@@ -4,0 +5,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
var t={},r=t.toString,n=Object.getPrototypeOf,e=t.hasOwnProperty,o=e.toString,c=o.call(Object);exports.createProxy=function(t,l){var u=new Set;return{proxyObject:function t(a,i){return void 0===i&&(i=[]),new Proxy(a,{get:function(a,f,g){var j=Reflect.get(a,f,g),s=function(t){if(!t||"[object Object]"!==r.call(t))return!1;var l=n(t);if(!l)return!0;var u=e.call(l,"constructor")&&l.constructor;return"function"==typeof u&&o.call(u)===c}(j),v=String(f),y=i.concat(v);return function(t,r){null==l||null==l.log||l.log(t,r),u.add(t.join("."))}(y,j),null!==j&&s?t(j,y):j}})}(t),accessSet:u}}; | ||
var t={},r=t.toString,n=Object.getPrototypeOf,e=t.hasOwnProperty,o=e.toString,c=o.call(Object);exports.createProxy=function(t,l){var u,a=new Set,i=null==(u=null==l?void 0:l.includePrototypeProperties)||u;return{proxyObject:function t(u,f){return void 0===f&&(f=[]),new Proxy(u,{get:function(p,y,g){var s=Reflect.get(p,y,g),O=function(t){if(!t||"[object Object]"!==r.call(t))return!1;var l=n(t);if(!l)return!0;var u=e.call(l,"constructor")&&l.constructor;return"function"==typeof u&&o.call(u)===c}(s),j=String(y),v=f.concat(j);return i||Object.prototype.hasOwnProperty.call(u,y)?(function(t,r){null==l||null==l.log||l.log(t,r),a.add(t.join("."))}(v,s),null!==s&&O?t(s,v):s):s}})}(t),accessSet:a}}; | ||
//# sourceMappingURL=accessor-log-proxy.js.map |
@@ -1,2 +0,2 @@ | ||
const t={},n=t.toString,c=Object.getPrototypeOf,o=t.hasOwnProperty,e=o.toString,r=e.call(Object),l=(t,l)=>{const u=new Set,s=(t,a=[])=>new Proxy(t,{get(t,g,i){const f=Reflect.get(t,g,i),j=function(t){if(!t||"[object Object]"!==n.call(t))return!1;const l=c(t);if(!l)return!0;const u=o.call(l,"constructor")&&l.constructor;return"function"==typeof u&&e.call(u)===r}(f),O=String(g),b=a.concat(O);return((t,n)=>{null==l||null==l.log||l.log(t,n),u.add(t.join("."))})(b,f),null!==f&&j?s(f,b):f}});return{proxyObject:s(t),accessSet:u}};export{l as createProxy}; | ||
const t={},o=t.toString,e=Object.getPrototypeOf,n=t.hasOwnProperty,r=n.toString,c=r.call(Object),l=(t,l)=>{var u;const s=new Set,a=null==(u=null==l?void 0:l.includePrototypeProperties)||u,i=(t,u=[])=>new Proxy(t,{get(p,g,y){const O=Reflect.get(p,g,y),f=function(t){if(!t||"[object Object]"!==o.call(t))return!1;const l=e(t);if(!l)return!0;const u=n.call(l,"constructor")&&l.constructor;return"function"==typeof u&&r.call(u)===c}(O),j=String(g),b=u.concat(j);return a||Object.prototype.hasOwnProperty.call(t,g)?(((t,o)=>{null==l||null==l.log||l.log(t,o),s.add(t.join("."))})(b,O),null!==O&&f?i(O,b):O):O}});return{proxyObject:i(t),accessSet:s}};export{l as createProxy}; | ||
//# sourceMappingURL=accessor-log-proxy.modern.js.map |
@@ -1,2 +0,2 @@ | ||
var t={},n=t.toString,r=Object.getPrototypeOf,e=t.hasOwnProperty,o=e.toString,c=o.call(Object),l=function(t,l){var u=new Set;return{proxyObject:function t(a,i){return void 0===i&&(i=[]),new Proxy(a,{get:function(a,f,g){var j=Reflect.get(a,f,g),v=function(t){if(!t||"[object Object]"!==n.call(t))return!1;var l=r(t);if(!l)return!0;var u=e.call(l,"constructor")&&l.constructor;return"function"==typeof u&&o.call(u)===c}(j),O=String(f),b=i.concat(O);return function(t,n){null==l||null==l.log||l.log(t,n),u.add(t.join("."))}(b,j),null!==j&&v?t(j,b):j}})}(t),accessSet:u}};export{l as createProxy}; | ||
var t={},r=t.toString,n=Object.getPrototypeOf,e=t.hasOwnProperty,o=e.toString,c=o.call(Object),l=function(t,l){var u,i=new Set,a=null==(u=null==l?void 0:l.includePrototypeProperties)||u;return{proxyObject:function t(u,f){return void 0===f&&(f=[]),new Proxy(u,{get:function(p,g,y){var O=Reflect.get(p,g,y),j=function(t){if(!t||"[object Object]"!==r.call(t))return!1;var l=n(t);if(!l)return!0;var u=e.call(l,"constructor")&&l.constructor;return"function"==typeof u&&o.call(u)===c}(O),s=String(g),v=f.concat(s);return a||Object.prototype.hasOwnProperty.call(u,g)?(function(t,r){null==l||null==l.log||l.log(t,r),i.add(t.join("."))}(v,O),null!==O&&j?t(O,v):O):O}})}(t),accessSet:i}};export{l as createProxy}; | ||
//# sourceMappingURL=accessor-log-proxy.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).accessorLogProxy={})}(this,function(t){var e={},n=e.toString,o=Object.getPrototypeOf,r=e.hasOwnProperty,c=r.toString,f=c.call(Object);t.createProxy=function(t,e){var u=new Set;return{proxyObject:function t(i,l){return void 0===l&&(l=[]),new Proxy(i,{get:function(i,a,s){var d=Reflect.get(i,a,s),p=function(t){if(!t||"[object Object]"!==n.call(t))return!1;var e=o(t);if(!e)return!0;var u=r.call(e,"constructor")&&e.constructor;return"function"==typeof u&&c.call(u)===f}(d),y=String(a),g=l.concat(y);return function(t,n){null==e||null==e.log||e.log(t,n),u.add(t.join("."))}(g,d),null!==d&&p?t(d,g):d}})}(t),accessSet:u}}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).accessorLogProxy={})}(this,function(t){var e={},n=e.toString,o=Object.getPrototypeOf,r=e.hasOwnProperty,c=r.toString,l=c.call(Object);t.createProxy=function(t,e){var u,i=new Set,f=null==(u=null==e?void 0:e.includePrototypeProperties)||u;return{proxyObject:function t(u,a){return void 0===a&&(a=[]),new Proxy(u,{get:function(p,s,y){var d=Reflect.get(p,s,y),g=function(t){if(!t||"[object Object]"!==n.call(t))return!1;var e=o(t);if(!e)return!0;var u=r.call(e,"constructor")&&e.constructor;return"function"==typeof u&&c.call(u)===l}(d),j=String(s),O=a.concat(j);return f||Object.prototype.hasOwnProperty.call(u,s)?(function(t,n){null==e||null==e.log||e.log(t,n),i.add(t.join("."))}(O,d),null!==d&&g?t(d,O):d):d}})}(t),accessSet:i}}}); | ||
//# sourceMappingURL=accessor-log-proxy.umd.js.map |
{ | ||
"name": "accessor-log-proxy", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/azu/accessor-log-proxy", |
@@ -35,4 +35,4 @@ # accessor-log-proxy | ||
````js | ||
import { createProxy } from "accessor-log-proxy"; | ||
```js | ||
const { createProxy } = await import("https://cdn.skypack.dev/accessor-log-proxy"); | ||
const object = { | ||
@@ -47,3 +47,3 @@ a: { | ||
// Accecs | ||
proxyObject.a.b.c | ||
console.log(proxyObject.a.b.c); | ||
// Log | ||
@@ -53,3 +53,13 @@ console.log(accessSet); // => Set{ "a", "a.b", "a.b.c" } | ||
## Options | ||
```ts | ||
export type createProxyOptions = { | ||
log?: (keyStack: string[], value?: any) => void; | ||
// include prototype property like "hasOwnProperty" | ||
// default: true | ||
includePrototypeProperties?: boolean; | ||
}; | ||
``` | ||
## Changelog | ||
@@ -56,0 +66,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
26356
36
91