Comparing version 11.3.0 to 11.4.0
(function() { | ||
'use strict'; | ||
var GUY_props, H, Strict_owner, builtins, def, def_oneoff, get, hide, no_such_value, rpr; | ||
/* see https://nodejs.org/dist/latest-v18.x/docs/api/util.html#utilinspectcustom */ | ||
var GUY_props, H, Strict_owner, builtins, def, def_oneoff, get, hide, no_such_value, node_inspect, rpr; | ||
@@ -20,2 +21,4 @@ //########################################################################################################### | ||
node_inspect = Symbol.for('nodejs.util.inspect.custom'); | ||
//----------------------------------------------------------------------------------------------------------- | ||
@@ -313,5 +316,24 @@ H.types.declare('guy_props_keys_cfg', { | ||
} | ||
if (key === 'constructor') { | ||
return target.constructor; | ||
} | ||
if (key === 'toString') { | ||
return target.toString; | ||
} | ||
if (key === 'call') { | ||
return target.call; | ||
} | ||
if (key === 'apply') { | ||
return target.apply; | ||
} | ||
if (key === Symbol.iterator) { | ||
return void 0; | ||
return target[Symbol.iterator]; | ||
} | ||
if (key === node_inspect) { | ||
return target[node_inspect]; | ||
} | ||
if (key === '0') { | ||
/* NOTE necessitated by behavior of `node:util.inspect()`: */ | ||
return target[0]; | ||
} | ||
if ((value = GUY_props.get(target, key, no_such_value)) === no_such_value) { | ||
@@ -372,2 +394,26 @@ if (!cfg.locked) { | ||
//--------------------------------------------------------------------------------------------------------- | ||
static create(cfg) { | ||
var R, proxy_cfg; | ||
cfg = { | ||
target: {}, | ||
...cfg | ||
}; | ||
H.types.validate.guy_props_strict_owner_cfg(cfg = {...H.types.defaults.guy_props_strict_owner_cfg, ...cfg}); | ||
proxy_cfg = this.constructor._get_proxy_cfg(cfg.target, cfg); | ||
if (!cfg.oneshot) { | ||
delete proxy_cfg.set; | ||
} | ||
R = new Proxy(cfg.target, proxy_cfg); | ||
GUY_props.hide(R, Strict_owner_cfg, cfg); | ||
if (cfg.freeze) { | ||
/* TAINT consider to freeze, seal target instread of proxy */ | ||
Object.freeze(R); | ||
} | ||
if (cfg.seal) { | ||
Object.seal(R); | ||
} | ||
return R; | ||
} | ||
}; | ||
@@ -374,0 +420,0 @@ |
{ | ||
"name": "guy", | ||
"version": "11.3.0", | ||
"version": "11.4.0", | ||
"description": "npm dependencies checker", | ||
@@ -5,0 +5,0 @@ "main": "lib/main.js", |
@@ -17,2 +17,3 @@ | ||
- [Class for Strict Ownership](#class-for-strict-ownership) | ||
- [Special Keys](#special-keys) | ||
- [`GUY.async`: Asynchronous Helpers](#guyasync-asynchronous-helpers) | ||
@@ -310,3 +311,14 @@ - [`GUY.nowait`: De-Asyncify JS Async Functions](#guynowait-de-asyncify-js-async-functions) | ||
##### Special Keys | ||
* `return "#{instance.constructor.name}" if key is Symbol.toStringTag` | ||
* `return target.constructor if key is 'constructor'` | ||
* `return target.toString if key is 'toString'` | ||
* `return target.call if key is 'call'` | ||
* `return target.apply if key is 'apply'` | ||
* `return target[ Symbol.iterator ] if key is Symbol.iterator` | ||
* `return target[ node_inspect ] if key is node_inspect` | ||
* `return target[ 0 ] if key is '0'` | ||
### `GUY.async`: Asynchronous Helpers | ||
@@ -313,0 +325,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
281278
2780
665