Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

create-error-types

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-error-types - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

30

build/src/proxy.js

@@ -12,14 +12,34 @@ import{isErrorName,createCustomError}from"./types.js";

return new Proxy(state,{get:getProxyProp.bind(undefined,onCreate)});
return new Proxy(state,getProxyHooks(onCreate));
};
const getProxyHooks=function(onCreate){
return Object.fromEntries(
HOOK_NAMES.map((hookName)=>[
hookName,
getProxyProp.bind(undefined,onCreate,hookName)]));
const getProxyProp=function(onCreate,target,propName,receiver){
};
const HOOK_NAMES=["get","has","getOwnPropertyDescriptor"];
const getProxyProp=function(
onCreate,
methodName,
target,
propName,
...args)
{
createIfUnset({onCreate,target,propName,args});
return Reflect[methodName](target,propName,...args);
};
const createIfUnset=function({onCreate,target,propName,args}){
if(!(propName in target)&&isErrorName(propName)){
const ErrorType=createCustomError(propName,onCreate);
Reflect.set(target,propName,ErrorType,receiver);
Reflect.set(target,propName,ErrorType,...args);
}
return Reflect.get(target,propName,receiver);
};
//# sourceMappingURL=proxy.js.map

2

package.json
{
"name": "create-error-types",
"version": "1.0.1",
"version": "1.0.2",
"type": "module",

@@ -5,0 +5,0 @@ "exports": "./build/src/main.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc