Socket
Socket
Sign inDemoInstall

@ark7/lazyload

Package Overview
Dependencies
4
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

59

index.js

@@ -7,11 +7,54 @@ "use strict";

let val;
return new Proxy({}, {
get: function (_target, prop) {
if (!calculated) {
val = fn.apply(this, arguments);
calculated = true;
}
return val[prop];
function getVal() {
if (!calculated) {
val = fn.apply(this, arguments);
calculated = true;
}
return val;
}
const handler = {
apply(_target, thisArg, argArray) {
const fn = getVal();
return fn.apply(thisArg, argArray);
},
});
construct(_target, argArray) {
const cls = getVal();
return new cls(...argArray);
},
defineProperty(_target, p, attributes) {
return Object.defineProperty(getVal(), p, attributes);
},
deleteProperty(_target, p) {
return Reflect.deleteProperty(getVal(), p);
},
get(_target, prop) {
return getVal()[prop];
},
getOwnPropertyDescriptor(_target, p) {
return Object.getOwnPropertyDescriptor(getVal(), p);
},
getPrototypeOf(_target) {
return Object.getPrototypeOf(getVal());
},
has(_target, p) {
return Reflect.has(getVal(), p);
},
isExtensible(_target) {
return Reflect.isExtensible(getVal());
},
ownKeys(_target) {
return Reflect.ownKeys(getVal());
},
preventExtensions(_target) {
return Reflect.preventExtensions(getVal());
},
set(_target, p, value) {
getVal()[p] = value;
return true;
},
setPrototypeOf(_target, v) {
return Reflect.setPrototypeOf(getVal(), v);
},
};
return new Proxy(function () { }, handler);
};

@@ -18,0 +61,0 @@ return fnWrap;

2

package.json
{
"name": "@ark7/lazyload",
"version": "1.0.1",
"version": "1.0.2",
"description": "@ark7/lazyload delays loading of object creation. Object will not be loaded before accessing its properties.",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc