You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

extra-lazy

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extra-lazy - npm Package Compare versions

Comparing version

to
1.3.1

16

dist/es2015/index.umd.js

@@ -73,9 +73,10 @@ (function (global, factory) {

const context = contexts[contexts.length - 1];
if (context.index === context.cache.length) {
// 首次运行
// 自增context.index, 从而确保嵌套在getter里的lazyStatic能够正确工作
const index = context.index++;
const isFirstRun = index === context.cache.length;
if (isFirstRun) {
updateCache();
}
else {
// 非首次运行
const oldDeps = context.cache[context.index].deps;
const oldDeps = context.cache[index].deps;
if (deps.length === oldDeps.length) {

@@ -90,7 +91,8 @@ if (deps.some((x, i) => x !== oldDeps[i])) {

}
const result = context.cache[context.index].value;
context.index++;
const result = context.cache[index].value;
return result;
function updateCache() {
context.cache[context.index] = {
// 填充缓存, 从而确保getter里的lazyStatic能够正确工作
context.cache[index] = null;
context.cache[index] = {
value: getter(),

@@ -97,0 +99,0 @@ deps: Array.from(deps)

@@ -1,2 +0,2 @@

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).ExtraLazy={})}(this,(function(n){"use strict";function t(n){let t,e=!1;return function(){return e||(t=n(),e=!0),t}}function e(n,t,e,c){return new(e||(e=Promise))((function(i,o){function u(n){try{a(c.next(n))}catch(n){o(n)}}function r(n){try{a(c.throw(n))}catch(n){o(n)}}function a(n){var t;n.done?i(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(u,r)}a((c=c.apply(n,t||[])).next())}))}const c=[];n.lazy=t,n.lazyAsyncFunction=function(n){const c=t(n);return(...n)=>e(this,void 0,void 0,(function*(){return(yield c())(...n)}))},n.lazyFunction=function(n){const e=t(n);return(...n)=>e()(...n)},n.lazyStatic=function(n,t=[]){if(c.length){const i=c[c.length-1];if(i.index===i.cache.length)e();else{const n=i.cache[i.index].deps;t.length===n.length?t.some(((t,e)=>t!==n[e]))&&e():e()}const o=i.cache[i.index].value;return i.index++,o;function e(){i.cache[i.index]={value:n(),deps:Array.from(t)}}}throw new Error("lazyStatic can only be called in the function wrapped by withlazyStatic.")},n.withLazyStatic=function(n){const t=[];return(...e)=>{c.push({cache:t,index:0});try{return n(...e)}finally{c.pop()}}},Object.defineProperty(n,"__esModule",{value:!0})}));
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n="undefined"!=typeof globalThis?globalThis:n||self).ExtraLazy={})}(this,(function(n){"use strict";function t(n){let t,e=!1;return function(){return e||(t=n(),e=!0),t}}function e(n,t,e,c){return new(e||(e=Promise))((function(o,i){function u(n){try{a(c.next(n))}catch(n){i(n)}}function r(n){try{a(c.throw(n))}catch(n){i(n)}}function a(n){var t;n.done?o(n.value):(t=n.value,t instanceof e?t:new e((function(n){n(t)}))).then(u,r)}a((c=c.apply(n,t||[])).next())}))}const c=[];n.lazy=t,n.lazyAsyncFunction=function(n){const c=t(n);return(...n)=>e(this,void 0,void 0,(function*(){return(yield c())(...n)}))},n.lazyFunction=function(n){const e=t(n);return(...n)=>e()(...n)},n.lazyStatic=function(n,t=[]){if(c.length){const o=c[c.length-1],i=o.index++;if(i===o.cache.length)e();else{const n=o.cache[i].deps;t.length===n.length?t.some(((t,e)=>t!==n[e]))&&e():e()}return o.cache[i].value;function e(){o.cache[i]=null,o.cache[i]={value:n(),deps:Array.from(t)}}}throw new Error("lazyStatic can only be called in the function wrapped by withlazyStatic.")},n.withLazyStatic=function(n){const t=[];return(...e)=>{c.push({cache:t,index:0});try{return n(...e)}finally{c.pop()}}},Object.defineProperty(n,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map

@@ -48,9 +48,10 @@ (function (global, factory) {

const context = contexts[contexts.length - 1];
if (context.index === context.cache.length) {
// 首次运行
// 自增context.index, 从而确保嵌套在getter里的lazyStatic能够正确工作
const index = context.index++;
const isFirstRun = index === context.cache.length;
if (isFirstRun) {
updateCache();
}
else {
// 非首次运行
const oldDeps = context.cache[context.index].deps;
const oldDeps = context.cache[index].deps;
if (deps.length === oldDeps.length) {

@@ -65,7 +66,8 @@ if (deps.some((x, i) => x !== oldDeps[i])) {

}
const result = context.cache[context.index].value;
context.index++;
const result = context.cache[index].value;
return result;
function updateCache() {
context.cache[context.index] = {
// 填充缓存, 从而确保getter里的lazyStatic能够正确工作
context.cache[index] = null;
context.cache[index] = {
value: getter(),

@@ -72,0 +74,0 @@ deps: Array.from(deps)

@@ -1,2 +0,2 @@

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).ExtraLazy={})}(this,(function(n){"use strict";function e(n){let e,t=!1;return function(){return t||(e=n(),t=!0),e}}const t=[];n.lazy=e,n.lazyAsyncFunction=function(n){const t=e(n);return async(...n)=>(await t())(...n)},n.lazyFunction=function(n){const t=e(n);return(...n)=>t()(...n)},n.lazyStatic=function(n,e=[]){if(t.length){const i=t[t.length-1];if(i.index===i.cache.length)c();else{const n=i.cache[i.index].deps;e.length===n.length?e.some(((e,t)=>e!==n[t]))&&c():c()}const o=i.cache[i.index].value;return i.index++,o;function c(){i.cache[i.index]={value:n(),deps:Array.from(e)}}}throw new Error("lazyStatic can only be called in the function wrapped by withlazyStatic.")},n.withLazyStatic=function(n){const e=[];return(...c)=>{t.push({cache:e,index:0});try{return n(...c)}finally{t.pop()}}},Object.defineProperty(n,"__esModule",{value:!0})}));
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).ExtraLazy={})}(this,(function(n){"use strict";function e(n){let e,t=!1;return function(){return t||(e=n(),t=!0),e}}const t=[];n.lazy=e,n.lazyAsyncFunction=function(n){const t=e(n);return async(...n)=>(await t())(...n)},n.lazyFunction=function(n){const t=e(n);return(...n)=>t()(...n)},n.lazyStatic=function(n,e=[]){if(t.length){const o=t[t.length-1],i=o.index++;if(i===o.cache.length)c();else{const n=o.cache[i].deps;e.length===n.length?e.some(((e,t)=>e!==n[t]))&&c():c()}return o.cache[i].value;function c(){o.cache[i]=null,o.cache[i]={value:n(),deps:Array.from(e)}}}throw new Error("lazyStatic can only be called in the function wrapped by withlazyStatic.")},n.withLazyStatic=function(n){const e=[];return(...c)=>{t.push({cache:e,index:0});try{return n(...c)}finally{t.pop()}}},Object.defineProperty(n,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map

@@ -21,7 +21,9 @@ "use strict";

const context = contexts[contexts.length - 1];
if (context.index === context.cache.length) {
const index = context.index++;
const isFirstRun = index === context.cache.length;
if (isFirstRun) {
updateCache();
}
else {
const oldDeps = context.cache[context.index].deps;
const oldDeps = context.cache[index].deps;
if (deps.length === oldDeps.length) {

@@ -36,7 +38,7 @@ if (deps.some((x, i) => x !== oldDeps[i])) {

}
const result = context.cache[context.index].value;
context.index++;
const result = context.cache[index].value;
return result;
function updateCache() {
context.cache[context.index] = {
context.cache[index] = null;
context.cache[index] = {
value: getter(),

@@ -43,0 +45,0 @@ deps: Array.from(deps)

@@ -21,7 +21,9 @@ "use strict";

const context = contexts[contexts.length - 1];
if (context.index === context.cache.length) {
const index = context.index++;
const isFirstRun = index === context.cache.length;
if (isFirstRun) {
updateCache();
}
else {
const oldDeps = context.cache[context.index].deps;
const oldDeps = context.cache[index].deps;
if (deps.length === oldDeps.length) {

@@ -36,7 +38,7 @@ if (deps.some((x, i) => x !== oldDeps[i])) {

}
const result = context.cache[context.index].value;
context.index++;
const result = context.cache[index].value;
return result;
function updateCache() {
context.cache[context.index] = {
context.cache[index] = null;
context.cache[index] = {
value: getter(),

@@ -43,0 +45,0 @@ deps: Array.from(deps)

{
"name": "extra-lazy",
"version": "1.3.0",
"version": "1.3.1",
"description": "",

@@ -5,0 +5,0 @@ "keywords": [],

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

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

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet