Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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 1.0.1 to 1.1.0

lib/es2015/lazy-async-function.d.ts

34

dist/es2015/index.umd.js

@@ -488,3 +488,37 @@ (function (global, factory) {

/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function lazyAsyncFunction(getter) {
const getFn = lazy(getter);
return (...args) => __awaiter(this, void 0, void 0, function* () {
const fn = yield getFn();
return fn(...args);
});
}
exports.lazy = lazy;
exports.lazyAsyncFunction = lazyAsyncFunction;
exports.lazyFunction = lazyFunction;

@@ -491,0 +525,0 @@

17

dist/es2015/index.umd.min.js

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ExtraLazy={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=/\s/;var r=function(t){for(var e=t.length;e--&&n.test(t.charAt(e)););return e},o=/^\s+/;var f=function(t){return t?t.slice(0,r(t)+1).replace(o,""):t};var i=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},u="object"==typeof e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,a=(u||c||Function("return this")()).Symbol,l=a,s=Object.prototype,p=s.hasOwnProperty,d=s.toString,v=l?l.toStringTag:void 0;var y=function(t){var e=p.call(t,v),n=t[v];try{t[v]=void 0;var r=!0}catch(t){}var o=d.call(t);return r&&(e?t[v]=n:delete t[v]),o},b=Object.prototype.toString;var j=y,g=function(t){return b.call(t)},h=a?a.toStringTag:void 0;var O=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":h&&h in Object(t)?j(t):g(t)},w=function(t){return null!=t&&"object"==typeof t};var T=f,m=i,x=function(t){return"symbol"==typeof t||w(t)&&"[object Symbol]"==O(t)},S=/^[-+]0x[0-9a-f]+$/i,N=/^0b[01]+$/i,z=/^0o[0-7]+$/i,E=parseInt;var $=function(t){if("number"==typeof t)return t;if(x(t))return NaN;if(m(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=m(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=T(t);var n=N.test(t);return n||z.test(t)?E(t.slice(2),n?2:8):S.test(t)?NaN:+t},F=1/0;var P=function(t){return t?(t=$(t))===F||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0};var _=function(t){var e=P(t),n=e%1;return e==e?n?e-n:e:0};var A=function(t,e){var n;if("function"!=typeof e)throw new TypeError("Expected a function");return t=_(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}};var I=function(t){return A(2,t)};function L(t){return I(t)}t.lazy=L,t.lazyFunction=function(t){const e=L(t);return(...t)=>e()(...t)},Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((t="undefined"!=typeof globalThis?globalThis:t||self).ExtraLazy={})}(this,(function(t){"use strict";var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},e=/\s/;var o=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n},r=/^\s+/;var i=function(t){return t?t.slice(0,o(t)+1).replace(r,""):t};var f=function(t){var n=typeof t;return null!=t&&("object"==n||"function"==n)},u="object"==typeof n&&n&&n.Object===Object&&n,c="object"==typeof self&&self&&self.Object===Object&&self,a=(u||c||Function("return this")()).Symbol,l=a,s=Object.prototype,y=s.hasOwnProperty,v=s.toString,d=l?l.toStringTag:void 0;var p=function(t){var n=y.call(t,d),e=t[d];try{t[d]=void 0;var o=!0}catch(t){}var r=v.call(t);return o&&(n?t[d]=e:delete t[d]),r},b=Object.prototype.toString;var h=p,j=function(t){return b.call(t)},g=a?a.toStringTag:void 0;var O=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":g&&g in Object(t)?h(t):j(t)},w=function(t){return null!=t&&"object"==typeof t};var x=i,m=f,T=function(t){return"symbol"==typeof t||w(t)&&"[object Symbol]"==O(t)},S=/^[-+]0x[0-9a-f]+$/i,N=/^0b[01]+$/i,z=/^0o[0-7]+$/i,E=parseInt;var F=function(t){if("number"==typeof t)return t;if(T(t))return NaN;if(m(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=m(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=x(t);var e=N.test(t);return e||z.test(t)?E(t.slice(2),e?2:8):S.test(t)?NaN:+t},P=1/0;var $=function(t){return t?(t=F(t))===P||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0};var A=function(t){var n=$(t),e=n%1;return n==n?e?n-e:n:0};var _=function(t,n){var e;if("function"!=typeof n)throw new TypeError("Expected a function");return t=A(t),function(){return--t>0&&(e=n.apply(this,arguments)),t<=1&&(n=void 0),e}};var I=function(t){return _(2,t)};function L(t){return I(t)}
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function M(t,n,e,o){return new(e||(e=Promise))((function(r,i){function f(t){try{c(o.next(t))}catch(t){i(t)}}function u(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var n;t.done?r(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(f,u)}c((o=o.apply(t,n||[])).next())}))}t.lazy=L,t.lazyAsyncFunction=function(t){const n=L(t);return(...t)=>M(this,void 0,void 0,(function*(){return(yield n())(...t)}))},t.lazyFunction=function(t){const n=L(t);return(...t)=>n()(...t)},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map

@@ -488,3 +488,12 @@ (function (global, factory) {

function lazyAsyncFunction(getter) {
const getFn = lazy(getter);
return async (...args) => {
const fn = await getFn();
return fn(...args);
};
}
exports.lazy = lazy;
exports.lazyAsyncFunction = lazyAsyncFunction;
exports.lazyFunction = lazyFunction;

@@ -491,0 +500,0 @@

2

dist/es2018/index.umd.min.js

@@ -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="undefined"!=typeof globalThis?globalThis:t||self).ExtraLazy={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=/\s/;var r=function(t){for(var e=t.length;e--&&n.test(t.charAt(e)););return e},o=/^\s+/;var f=function(t){return t?t.slice(0,r(t)+1).replace(o,""):t};var i=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},u="object"==typeof e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,a=(u||c||Function("return this")()).Symbol,l=a,s=Object.prototype,p=s.hasOwnProperty,d=s.toString,v=l?l.toStringTag:void 0;var y=function(t){var e=p.call(t,v),n=t[v];try{t[v]=void 0;var r=!0}catch(t){}var o=d.call(t);return r&&(e?t[v]=n:delete t[v]),o},b=Object.prototype.toString;var j=y,g=function(t){return b.call(t)},h=a?a.toStringTag:void 0;var O=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":h&&h in Object(t)?j(t):g(t)},w=function(t){return null!=t&&"object"==typeof t};var T=f,m=i,x=function(t){return"symbol"==typeof t||w(t)&&"[object Symbol]"==O(t)},S=/^[-+]0x[0-9a-f]+$/i,N=/^0b[01]+$/i,z=/^0o[0-7]+$/i,E=parseInt;var $=function(t){if("number"==typeof t)return t;if(x(t))return NaN;if(m(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=m(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=T(t);var n=N.test(t);return n||z.test(t)?E(t.slice(2),n?2:8):S.test(t)?NaN:+t},F=1/0;var P=function(t){return t?(t=$(t))===F||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0};var _=function(t){var e=P(t),n=e%1;return e==e?n?e-n:e:0};var A=function(t,e){var n;if("function"!=typeof e)throw new TypeError("Expected a function");return t=_(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}};var I=function(t){return A(2,t)};function L(t){return I(t)}t.lazy=L,t.lazyFunction=function(t){const e=L(t);return(...t)=>e()(...t)},Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).ExtraLazy={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=/\s/;var r=function(t){for(var e=t.length;e--&&n.test(t.charAt(e)););return e},o=/^\s+/;var i=function(t){return t?t.slice(0,r(t)+1).replace(o,""):t};var f=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},u="object"==typeof e&&e&&e.Object===Object&&e,c="object"==typeof self&&self&&self.Object===Object&&self,a=(u||c||Function("return this")()).Symbol,l=a,s=Object.prototype,y=s.hasOwnProperty,p=s.toString,d=l?l.toStringTag:void 0;var v=function(t){var e=y.call(t,d),n=t[d];try{t[d]=void 0;var r=!0}catch(t){}var o=p.call(t);return r&&(e?t[d]=n:delete t[d]),o},b=Object.prototype.toString;var j=v,g=function(t){return b.call(t)},h=a?a.toStringTag:void 0;var O=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":h&&h in Object(t)?j(t):g(t)},w=function(t){return null!=t&&"object"==typeof t};var T=i,m=f,x=function(t){return"symbol"==typeof t||w(t)&&"[object Symbol]"==O(t)},S=/^[-+]0x[0-9a-f]+$/i,N=/^0b[01]+$/i,z=/^0o[0-7]+$/i,E=parseInt;var F=function(t){if("number"==typeof t)return t;if(x(t))return NaN;if(m(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=m(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=T(t);var n=N.test(t);return n||z.test(t)?E(t.slice(2),n?2:8):S.test(t)?NaN:+t},$=1/0;var A=function(t){return t?(t=F(t))===$||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0};var P=function(t){var e=A(t),n=e%1;return e==e?n?e-n:e:0};var _=function(t,e){var n;if("function"!=typeof e)throw new TypeError("Expected a function");return t=P(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}};var I=function(t){return _(2,t)};function L(t){return I(t)}t.lazy=L,t.lazyAsyncFunction=function(t){const e=L(t);return async(...t)=>(await e())(...t)},t.lazyFunction=function(t){const e=L(t);return(...t)=>e()(...t)},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map
export * from './lazy';
export * from './lazy-function';
export * from './lazy-async-function';

@@ -19,2 +19,3 @@ "use strict";

__exportStar(require("./lazy-function"), exports);
__exportStar(require("./lazy-async-function"), exports);
//# sourceMappingURL=index.js.map
export * from './lazy';
export * from './lazy-function';
export * from './lazy-async-function';

@@ -19,2 +19,3 @@ "use strict";

__exportStar(require("./lazy-function"), exports);
__exportStar(require("./lazy-async-function"), exports);
//# sourceMappingURL=index.js.map
{
"name": "extra-lazy",
"version": "1.0.1",
"version": "1.1.0",
"description": "",

@@ -43,3 +43,3 @@ "keywords": [],

"@commitlint/config-conventional": "^16.2.1",
"@rollup/plugin-commonjs": "^21.0.2",
"@rollup/plugin-commonjs": "^21.0.3",
"@rollup/plugin-json": "^4.1.0",

@@ -50,6 +50,6 @@ "@rollup/plugin-node-resolve": "^13.1.3",

"@types/jest": "^27.4.1",
"@types/lodash": "^4.14.180",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"eslint": "^8.11.0",
"@types/lodash": "^4.14.181",
"@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0",
"eslint": "^8.12.0",
"husky": "4",

@@ -64,6 +64,6 @@ "jest": "^27.5.1",

"standard-version": "^9.3.1",
"ts-jest": "^27.1.3",
"ts-jest": "^27.1.4",
"tscpaths": "^0.0.9",
"tslib": "^2.3.1",
"typescript": "^4.6.2"
"typescript": "^4.6.3"
},

@@ -70,0 +70,0 @@ "dependencies": {

@@ -5,3 +5,2 @@ # extra-lazy

## Install
```sh

@@ -14,3 +13,2 @@ npm install --save extra-lazy

## Usage
```ts

@@ -27,5 +25,3 @@ import { lazy } from 'extra-lazy'

## API
### lazy
```ts

@@ -41,3 +37,2 @@ function lazy<T>(getter: () => T): () => T

### lazyFunction
```ts

@@ -50,1 +45,10 @@ function lazyFunction<Result, Args extends any[]>(

Create a function lazily.
### lazyAsyncFunction
```ts
function lazyAsyncFunction<Result, Args extends any[]>(
getter: () => PromiseLike<(...args: Args) => Result>
): (...args: Args) => Promise<Result>
```
Create a async function lazily.

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

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