Socket
Socket
Sign inDemoInstall

blister

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.9.1 to 0.10.0

src/errors.js

223

dist/blister.js

@@ -5,15 +5,10 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Blister = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

var wrappers = require('./wrappers');
var errors = require('./errors');
/**
* @name BlisterDependencyType
* @enum {string}
*
* @property {string} VALUE
* @property {string} SINGLETON
* @property {string} FACTORY
*/
var IllegalExtensionError = errors.IllegalExtensionError;
var MissingExtendedDependencyError = errors.MissingExtendedDependencyError;
var VALUE = 'VALUE';
var SINGLETON = 'SINGLETON';
var FACTORY = 'FACTORY';
var VALUE = 'value';
var SINGLETON = 'singleton';
var FACTORY = 'factory';

@@ -25,3 +20,3 @@ /**

* var container = new BlisterContainer();
* container.set('id', 'value');
* container.value('id', 'value');
* container.get('id'); //> 'value';

@@ -35,2 +30,5 @@ *

BlisterContainer.IllegalExtensionError = IllegalExtensionError;
BlisterContainer.MissingExtendedDependencyError = MissingExtendedDependencyError;
BlisterContainer.prototype = {

@@ -41,26 +39,2 @@

/**
* Type for VALUE dependencies.
* It is the default type for dependencies specified as primitives: strings,
* numbers, booleans, etc.
*
* @constant {string}
*/
VALUE: VALUE,
/**
* Type for SINGLETON dependencies.
* It is the default type for dependencies specified as functions
*
* @constant {string}
*/
SINGLETON: SINGLETON,
/**
* Type for FACTORY dependencies
*
* @constant {string}
*/
FACTORY: FACTORY,
/**
* Returns the dependency set with the given id,

@@ -77,45 +51,54 @@ * or undefined if it is not present

/**
* Registers the specified dependency in the container with the given type.
*
* If no type is passed, the default is SINGLETON for functions and
* VALUE for others.
* If the type is VALUE, the given value is returned each time the dependency
* is requested.
* If the type is SINGLETON, the given function will be called the first time
* the dependency is requested. The value is returned and cached for the
* subsequent calls.
* If the type is FACTORY, the given function is called each time the
* dependency is requested.
*
* @param {string} id The dependency id
* @param {*|Function} [value] The dependency definition
* @param {BlisterDependencyType} [type] VALUE, SINGLETON or FACTORY
* properties
* @return {BlisterContainer} The container itself
* Registers the given value with the specified id
* @param {string} id
* @param {*} value
* @return {BlisterContainer} this
* @throws {TypeError} If id is not a string
*/
set: function(id, value, type) {
return this._set(id, value, type);
value: function(id, value) {
return this._set(id, value, VALUE, false);
},
/**
* Extends the specified dependency in the container with the given type.
*
* If no type is passed, inherits the original type if it is a function or
* it is defined as VALUE otherwise.
*
* @param {string} id The dependency id
* @param {*|Function} [value] The dependency definition
* @param {BlisterDependencyType} [type] VALUE, SINGLETON or FACTORY
* properties
* @return {BlisterContainer} The container itself
* Registers the given factory function with the specified id
* @param {string} id
* @param {Function} factoryFn
* @return {BlisterContainer} this
* @throws {TypeError} If id is not a string
* @throws {TypeError} If factoryFn is not a function
*/
extend: function(id, value, type) {
if (!this._deps[id]) {
throw new Error('Cannot extend a dependency not previously set: ' + id);
}
factory: function(id, factoryFn) {
return this._set(id, factoryFn, FACTORY, false);
},
return this._set(id, value, type, true);
/**
* Registers the given singleton function with the specified id
* @param {string} id
* @param {Function} singletonFn
* @return {BlisterContainer} this
* @throws {TypeError} If id is not a string
* @throws {TypeError} If singletonFn is not a function
*/
singleton: function(id, singletonFn) {
return this._set(id, singletonFn, SINGLETON, false);
},
/**
* Extends a previously defined dependency with the same type:
* factory or singleton
* @param {string} id
* @param {Function} definition
* @return {BlisterContainer} this
* @throws {TypeError} If id is not a string
* @throws {TypeError} If definition is not a function
* @throws {MissingExtendedDependencyError} If there was not a previously
* defined dependency with that id
* @throws {IllegalExtensionError} If trying to extend a dependency
* registered as value
*/
extend: function(id, definition) {
return this._set(id, definition, undefined, true);
},
/**
* Internal dependency setter that adds extension support

@@ -125,5 +108,4 @@ *

* @param {string} id The dependency id
* @param {*|Function} [value] The dependency definition
* @param {BlisterDependencyType} [type] VALUE, SINGLETON or FACTORY
* properties
* @param {*|Function} value The dependency definition
* @param {string} 'VALUE', 'SINGLETON' or 'FACTORY'
* @param {boolean} isExtension Determines if extends a previous dependency,

@@ -140,21 +122,19 @@ * so the original value is stored and passed to

var originalWrapper = isExtension ? this._deps[id] : undefined;
var originalType = originalWrapper && originalWrapper.type;
var typeOfValue = typeof value;
if (!type) {
if (typeOfValue !== 'function') {
type = VALUE;
} else if (isExtension && originalType !== VALUE) {
type = originalType;
} else {
type = SINGLETON;
if (isExtension) {
if (!originalWrapper) {
throw new MissingExtendedDependencyError();
}
type = originalWrapper.type;
}
if (typeOfValue !== 'function' && type !== VALUE) {
if (typeof value !== 'function' && type !== VALUE) {
throw new TypeError(
'The value must be a function for types SINGLETON and FACTORY: ' +
'The argument must be a function: ' +
value);
}
if (type === VALUE && isExtension) {
throw new IllegalExtensionError();
}
this._deps[id] = wrappers.create(type, value, this, originalWrapper);

@@ -205,6 +185,51 @@ return this;

},{"./wrappers":2}],2:[function(require,module,exports){
},{"./errors":2,"./wrappers":3}],2:[function(require,module,exports){
'use strict';
/**
* Wrapper just to create new subclasses of Error without
* executing its constructor (ES3-compatible)
* @class
* @private
*/
function ErrorWrapper() {}
ErrorWrapper.prototype = Error.prototype;
/**
* @class
* @extends {Error}
* @param {string} [message='Values cannot be extended. Redefine them instead']
* @private
*/
function IllegalExtensionError(message) {
this.name = 'IllegalExtensionError';
this.message = message || 'Values cannot be extended. Redefine them instead';
}
IllegalExtensionError.prototype = new ErrorWrapper();
IllegalExtensionError.constructor = IllegalExtensionError;
/**
* @class
* @extends {Error}
* @param {string} [message='Cannot extend a dependency not previously set']
* @private
*/
function MissingExtendedDependencyError(message) {
this.name = 'MissingExtendedDependencyError';
this.message = message || 'Cannot extend a dependency not previously set';
}
MissingExtendedDependencyError.prototype = new ErrorWrapper();
MissingExtendedDependencyError.constructor = MissingExtendedDependencyError;
module.exports = {
IllegalExtensionError: IllegalExtensionError,
MissingExtendedDependencyError: MissingExtendedDependencyError
};
},{}],3:[function(require,module,exports){
'use strict';
/**
* Wrapper functions to store the different types of dependencies in the

@@ -218,7 +243,7 @@ * container

/**
* Returns a wrapper for a VALUE dependency to be stored in the container
* Returns a wrapper for a value dependency to be stored in the container
* @param {*} value
* @return {Function}
*/
VALUE: function wrapValue(value) {
value: function wrapValue(value) {
return function() {

@@ -230,3 +255,3 @@ return value;

/**
* Returns a wrapper for a FACTORY dependency to be stored in the container
* Returns a wrapper for a factory dependency to be stored in the container
* @param {Function} value The factory function

@@ -237,6 +262,8 @@ * @param {BlisterContainer} container

*/
FACTORY: function wrapFactory(value, container, originalWrapper) {
factory: function wrapFactory(value, container, originalWrapper) {
return function() {
var originalValue = originalWrapper && originalWrapper();
return value.call(container, container, originalValue);
if (originalWrapper) {
return value.call(container, container, originalWrapper());
}
return value.call(container, container);
};

@@ -246,3 +273,3 @@ },

/**
* Returns a wrapper for a SINGLETON dependency to be stored in the container
* Returns a wrapper for a singleton dependency to be stored in the container
* @param {Function} value The singleton generator function

@@ -253,11 +280,13 @@ * @param {BlisterContainer} container

*/
SINGLETON: function wrapSingleton(value, container, originalWrapper) {
singleton: function wrapSingleton(value, container, originalWrapper) {
var cached = false;
var cachedValue;
return function() {
var originalValue;
if (!cached) {
cached = true;
originalValue = originalWrapper && originalWrapper();
cachedValue = value.call(container, container, originalValue);
if (originalWrapper) {
cachedValue = value.call(container, container, originalWrapper());
} else {
cachedValue = value.call(container, container);
}
value = null;

@@ -264,0 +293,0 @@ }

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

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Blister=e()}}(function(){return function e(t,n,r){function i(u,f){if(!n[u]){if(!t[u]){var s="function"==typeof require&&require;if(!f&&s)return s(u,!0);if(o)return o(u,!0);var c=new Error("Cannot find module '"+u+"'");throw c.code="MODULE_NOT_FOUND",c}var p=n[u]={exports:{}};t[u][0].call(p.exports,function(e){var n=t[u][1][e];return i(n?n:e)},p,p.exports,e,t,n,r)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;u<r.length;u++)i(r[u]);return i}({1:[function(e,t){"use strict";function n(){this._deps={}}var r=e("./wrappers"),i="VALUE",o="SINGLETON",u="FACTORY";n.prototype={constructor:n,VALUE:i,SINGLETON:o,FACTORY:u,get:function(e){var t=this._deps[e];return t&&t()},set:function(e,t,n){return this._set(e,t,n)},extend:function(e,t,n){if(!this._deps[e])throw new Error("Cannot extend a dependency not previously set: "+e);return this._set(e,t,n,!0)},_set:function(e,t,n,u){if("string"!=typeof e)throw new TypeError("The dependency id must be a string: "+e);var f=u?this._deps[e]:void 0,s=f&&f.type,c=typeof t;if(n||(n="function"!==c?i:u&&s!==i?s:o),"function"!==c&&n!==i)throw new TypeError("The value must be a function for types SINGLETON and FACTORY: "+t);return this._deps[e]=r.create(n,t,this,f),this},register:function(e){return e.register(this),this}},t.exports=n},{"./wrappers":2}],2:[function(e,t){"use strict";var n={VALUE:function(e){return function(){return e}},FACTORY:function(e,t,n){return function(){var r=n&&n();return e.call(t,t,r)}},SINGLETON:function(e,t,n){var r,i=!1;return function(){var o;return i||(i=!0,o=n&&n(),r=e.call(t,t,o),e=null),r}},create:function(e,t,n,r){var i=this[e](t,n,r);return i.type=e,i}};t.exports=n},{}]},{},[1])(1)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.Blister=e()}}(function(){return function e(n,t,r){function o(s,u){if(!t[s]){if(!n[s]){var f="function"==typeof require&&require;if(!u&&f)return f(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var d=t[s]={exports:{}};n[s][0].call(d.exports,function(e){var t=n[s][1][e];return o(t?t:e)},d,d.exports,e,n,t,r)}return t[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)o(r[s]);return o}({1:[function(e,n){"use strict";function t(){this._deps={}}var r=e("./wrappers"),o=e("./errors"),i=o.IllegalExtensionError,s=o.MissingExtendedDependencyError,u="value",f="singleton",c="factory";t.IllegalExtensionError=i,t.MissingExtendedDependencyError=s,t.prototype={constructor:t,get:function(e){var n=this._deps[e];return n&&n()},value:function(e,n){return this._set(e,n,u,!1)},factory:function(e,n){return this._set(e,n,c,!1)},singleton:function(e,n){return this._set(e,n,f,!1)},extend:function(e,n){return this._set(e,n,void 0,!0)},_set:function(e,n,t,o){if("string"!=typeof e)throw new TypeError("The dependency id must be a string: "+e);var f=o?this._deps[e]:void 0;if(o){if(!f)throw new s;t=f.type}if("function"!=typeof n&&t!==u)throw new TypeError("The argument must be a function: "+n);if(t===u&&o)throw new i;return this._deps[e]=r.create(t,n,this,f),this},register:function(e){return e.register(this),this}},n.exports=t},{"./errors":2,"./wrappers":3}],2:[function(e,n){"use strict";function t(){}function r(e){this.name="IllegalExtensionError",this.message=e||"Values cannot be extended. Redefine them instead"}function o(e){this.name="MissingExtendedDependencyError",this.message=e||"Cannot extend a dependency not previously set"}t.prototype=Error.prototype,r.prototype=new t,r.constructor=r,o.prototype=new t,o.constructor=o,n.exports={IllegalExtensionError:r,MissingExtendedDependencyError:o}},{}],3:[function(e,n){"use strict";var t={value:function(e){return function(){return e}},factory:function(e,n,t){return function(){return t?e.call(n,n,t()):e.call(n,n)}},singleton:function(e,n,t){var r,o=!1;return function(){return o||(o=!0,r=t?e.call(n,n,t()):e.call(n,n),e=null),r}},create:function(e,n,t,r){var o=this[e](n,t,r);return o.type=e,o}};n.exports=t},{}]},{},[1])(1)});
//# sourceMappingURL=blister.min.js.map
{
"name": "blister",
"version": "0.9.1",
"version": "0.10.0",
"author": "Rubén Norte <rubennorte@gmail.com>",

@@ -14,3 +14,8 @@ "description": "Minimalist dependency injection container for JavaScript",

"pimple",
"provider"
"provider",
"singleton",
"factory",
"configuration",
"config",
"IoC"
],

@@ -17,0 +22,0 @@ "homepage": "https://github.com/rubennorte/blister",

# Blister
Minimalist dependency injection container for JavaScript, inspired by Fabien Potencier's [Pimple](http://pimple.sensiolabs.org/).
Minimalist dependency injection container for JavaScript.
## Installation
The package is available as a UMD module: compatible with AMD, CommonJS and exposing a global variable `Blister` in `dist/blister.min.js` (910 bytes minified and gzipped).
The package is available as a UMD module: compatible with AMD, CommonJS and exposing a global variable `Blister` in `dist/blister.min.js` (1.2 KB minified and gzipped).

@@ -50,6 +50,6 @@ It can be installed via npm (for both Node.js and browserify/webpack), Bower or downloading it from the repository:

```js
container.set('protocol', 'http://' /*, container.VALUE */);
container.value('protocol', 'http://');
container.get('protocol'); //> 'http://'
container.set('randomFn', Math.random, container.VALUE);
container.value('randomFn', Math.random);
container.get('randomFn'); //> function random() { [native code] }

@@ -62,12 +62,10 @@ ```

All the dependencies specified as functions are singletons by default.
Example:
```js
container.set('host', function(c) {
container.singleton('host', function(c) {
console.log('called');
return c.get('protocol') === 'http://' ?
'example.com' : 'secure.example.com';
} /*, container.SINGLETON */);
});
container.get('host'); //> 'example.com'

@@ -85,5 +83,5 @@ // called

```js
container.set('timestamp', function() {
container.factory('timestamp', function() {
return Date.now();
}, container.FACTORY);
});
container.get('timestamp'); 1431773272660

@@ -97,8 +95,10 @@ container.get('timestamp'); 1431773281953

If both the extension and the original definitions were functions, the extension inherits the type of dependency (SINGLETON or FACTORY) by default.
The extension preserves the type of the original dependency (factory or singleton).
Value dependencies cannot be extended. They must be redefined instead.
Example:
```js
container.set('some-service', function() {
container.singleton('some-service', function() {
return service;

@@ -115,3 +115,3 @@ });

If the previous dependency is not used in the definition of the extension, it can be replaced using `set` instead.
If the previous dependency is not used in the definition of the extension, it can be replaced using `value`, `factory` or `singleton` instead.

@@ -118,0 +118,0 @@ #### Registering service providers

'use strict';
var wrappers = require('./wrappers');
var errors = require('./errors');
/**
* @name BlisterDependencyType
* @enum {string}
*
* @property {string} VALUE
* @property {string} SINGLETON
* @property {string} FACTORY
*/
var IllegalExtensionError = errors.IllegalExtensionError;
var MissingExtendedDependencyError = errors.MissingExtendedDependencyError;
var VALUE = 'VALUE';
var SINGLETON = 'SINGLETON';
var FACTORY = 'FACTORY';
var VALUE = 'value';
var SINGLETON = 'singleton';
var FACTORY = 'factory';

@@ -23,3 +18,3 @@ /**

* var container = new BlisterContainer();
* container.set('id', 'value');
* container.value('id', 'value');
* container.get('id'); //> 'value';

@@ -33,2 +28,5 @@ *

BlisterContainer.IllegalExtensionError = IllegalExtensionError;
BlisterContainer.MissingExtendedDependencyError = MissingExtendedDependencyError;
BlisterContainer.prototype = {

@@ -39,26 +37,2 @@

/**
* Type for VALUE dependencies.
* It is the default type for dependencies specified as primitives: strings,
* numbers, booleans, etc.
*
* @constant {string}
*/
VALUE: VALUE,
/**
* Type for SINGLETON dependencies.
* It is the default type for dependencies specified as functions
*
* @constant {string}
*/
SINGLETON: SINGLETON,
/**
* Type for FACTORY dependencies
*
* @constant {string}
*/
FACTORY: FACTORY,
/**
* Returns the dependency set with the given id,

@@ -75,45 +49,54 @@ * or undefined if it is not present

/**
* Registers the specified dependency in the container with the given type.
*
* If no type is passed, the default is SINGLETON for functions and
* VALUE for others.
* If the type is VALUE, the given value is returned each time the dependency
* is requested.
* If the type is SINGLETON, the given function will be called the first time
* the dependency is requested. The value is returned and cached for the
* subsequent calls.
* If the type is FACTORY, the given function is called each time the
* dependency is requested.
*
* @param {string} id The dependency id
* @param {*|Function} [value] The dependency definition
* @param {BlisterDependencyType} [type] VALUE, SINGLETON or FACTORY
* properties
* @return {BlisterContainer} The container itself
* Registers the given value with the specified id
* @param {string} id
* @param {*} value
* @return {BlisterContainer} this
* @throws {TypeError} If id is not a string
*/
set: function(id, value, type) {
return this._set(id, value, type);
value: function(id, value) {
return this._set(id, value, VALUE, false);
},
/**
* Extends the specified dependency in the container with the given type.
*
* If no type is passed, inherits the original type if it is a function or
* it is defined as VALUE otherwise.
*
* @param {string} id The dependency id
* @param {*|Function} [value] The dependency definition
* @param {BlisterDependencyType} [type] VALUE, SINGLETON or FACTORY
* properties
* @return {BlisterContainer} The container itself
* Registers the given factory function with the specified id
* @param {string} id
* @param {Function} factoryFn
* @return {BlisterContainer} this
* @throws {TypeError} If id is not a string
* @throws {TypeError} If factoryFn is not a function
*/
extend: function(id, value, type) {
if (!this._deps[id]) {
throw new Error('Cannot extend a dependency not previously set: ' + id);
}
factory: function(id, factoryFn) {
return this._set(id, factoryFn, FACTORY, false);
},
return this._set(id, value, type, true);
/**
* Registers the given singleton function with the specified id
* @param {string} id
* @param {Function} singletonFn
* @return {BlisterContainer} this
* @throws {TypeError} If id is not a string
* @throws {TypeError} If singletonFn is not a function
*/
singleton: function(id, singletonFn) {
return this._set(id, singletonFn, SINGLETON, false);
},
/**
* Extends a previously defined dependency with the same type:
* factory or singleton
* @param {string} id
* @param {Function} definition
* @return {BlisterContainer} this
* @throws {TypeError} If id is not a string
* @throws {TypeError} If definition is not a function
* @throws {MissingExtendedDependencyError} If there was not a previously
* defined dependency with that id
* @throws {IllegalExtensionError} If trying to extend a dependency
* registered as value
*/
extend: function(id, definition) {
return this._set(id, definition, undefined, true);
},
/**
* Internal dependency setter that adds extension support

@@ -123,5 +106,4 @@ *

* @param {string} id The dependency id
* @param {*|Function} [value] The dependency definition
* @param {BlisterDependencyType} [type] VALUE, SINGLETON or FACTORY
* properties
* @param {*|Function} value The dependency definition
* @param {string} 'VALUE', 'SINGLETON' or 'FACTORY'
* @param {boolean} isExtension Determines if extends a previous dependency,

@@ -138,21 +120,19 @@ * so the original value is stored and passed to

var originalWrapper = isExtension ? this._deps[id] : undefined;
var originalType = originalWrapper && originalWrapper.type;
var typeOfValue = typeof value;
if (!type) {
if (typeOfValue !== 'function') {
type = VALUE;
} else if (isExtension && originalType !== VALUE) {
type = originalType;
} else {
type = SINGLETON;
if (isExtension) {
if (!originalWrapper) {
throw new MissingExtendedDependencyError();
}
type = originalWrapper.type;
}
if (typeOfValue !== 'function' && type !== VALUE) {
if (typeof value !== 'function' && type !== VALUE) {
throw new TypeError(
'The value must be a function for types SINGLETON and FACTORY: ' +
'The argument must be a function: ' +
value);
}
if (type === VALUE && isExtension) {
throw new IllegalExtensionError();
}
this._deps[id] = wrappers.create(type, value, this, originalWrapper);

@@ -159,0 +139,0 @@ return this;

@@ -12,7 +12,7 @@ 'use strict';

/**
* Returns a wrapper for a VALUE dependency to be stored in the container
* Returns a wrapper for a value dependency to be stored in the container
* @param {*} value
* @return {Function}
*/
VALUE: function wrapValue(value) {
value: function wrapValue(value) {
return function() {

@@ -24,3 +24,3 @@ return value;

/**
* Returns a wrapper for a FACTORY dependency to be stored in the container
* Returns a wrapper for a factory dependency to be stored in the container
* @param {Function} value The factory function

@@ -31,6 +31,8 @@ * @param {BlisterContainer} container

*/
FACTORY: function wrapFactory(value, container, originalWrapper) {
factory: function wrapFactory(value, container, originalWrapper) {
return function() {
var originalValue = originalWrapper && originalWrapper();
return value.call(container, container, originalValue);
if (originalWrapper) {
return value.call(container, container, originalWrapper());
}
return value.call(container, container);
};

@@ -40,3 +42,3 @@ },

/**
* Returns a wrapper for a SINGLETON dependency to be stored in the container
* Returns a wrapper for a singleton dependency to be stored in the container
* @param {Function} value The singleton generator function

@@ -47,11 +49,13 @@ * @param {BlisterContainer} container

*/
SINGLETON: function wrapSingleton(value, container, originalWrapper) {
singleton: function wrapSingleton(value, container, originalWrapper) {
var cached = false;
var cachedValue;
return function() {
var originalValue;
if (!cached) {
cached = true;
originalValue = originalWrapper && originalWrapper();
cachedValue = value.call(container, container, originalValue);
if (originalWrapper) {
cachedValue = value.call(container, container, originalWrapper());
} else {
cachedValue = value.call(container, container);
}
value = null;

@@ -58,0 +62,0 @@ }

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