config-cache
Advanced tools
Comparing version 5.0.0 to 5.0.1
51
index.js
@@ -32,3 +32,3 @@ /*! | ||
function Cache() { | ||
function Cache(obj) { | ||
Emitter.call(this); | ||
@@ -39,5 +39,32 @@ this.cache = {}; | ||
Emitter(Cache.prototype); | ||
Cache.mixin = mixin; | ||
/** | ||
* Static method for mixing `Cache` properties onto `obj` | ||
* | ||
* ```js | ||
* function App() { | ||
* Cache.call(this); | ||
* } | ||
* Cache.mixin(App.prototype); | ||
* ``` | ||
* | ||
* @param {Object} `obj` | ||
* @return {Object} | ||
* @api public | ||
*/ | ||
Cache.mixin = function(obj) { | ||
for (var key in this) { | ||
obj.constructor[key] = this[key]; | ||
} | ||
obj.constructor.prototype = Object.create(this.prototype); | ||
for (var key in obj) { | ||
obj.constructor.prototype[key] = obj[key]; | ||
} | ||
// save a reference to `this.prototype` | ||
obj.constructor.__super__ = this.prototype; | ||
return obj.constructor; | ||
}; | ||
/** | ||
* Assign `value` to `key` or return the value of `key`. | ||
@@ -219,22 +246,2 @@ * | ||
/** | ||
* Mix `Cache` properties onto `obj` | ||
* | ||
* @param {[type]} obj [description] | ||
* @return {[type]} | ||
*/ | ||
function mixin(obj) { | ||
var receiver = obj.constructor; | ||
var provider = this; | ||
for (var key in provider) { | ||
receiver[key] = provider[key]; | ||
} | ||
receiver.prototype = Object.create(provider.prototype); | ||
for (var key in obj) { | ||
receiver.prototype[key] = obj[key]; | ||
} | ||
return receiver; | ||
} | ||
/** | ||
* Expose `Cache` | ||
@@ -241,0 +248,0 @@ */ |
{ | ||
"name": "config-cache", | ||
"description": "General purpose JavaScript object storage methods.", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"homepage": "https://github.com/jonschlinkert/config-cache", | ||
@@ -62,2 +62,2 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
] | ||
} | ||
} |
@@ -56,4 +56,22 @@ # config-cache [![NPM version](https://badge.fury.io/js/config-cache.svg)](http://badge.fury.io/js/config-cache) [![Build Status](https://travis-ci.org/jonschlinkert/config-cache.svg)](https://travis-ci.org/jonschlinkert/config-cache) | ||
### [.set](index.js#L54) | ||
### [.mixin](index.js#L54) | ||
Static method for mixing `Cache` properties onto `obj` | ||
**Params** | ||
* `obj` **{Object}** | ||
* `returns` **{Object}** | ||
**Example** | ||
```js | ||
function App() { | ||
Cache.call(this); | ||
} | ||
Cache.mixin(App.prototype); | ||
``` | ||
### [.set](index.js#L81) | ||
Assign `value` to `key` or return the value of `key`. | ||
@@ -74,3 +92,3 @@ | ||
### [.get](index.js#L91) | ||
### [.get](index.js#L118) | ||
@@ -98,3 +116,3 @@ Return the stored value of `key`. Dot notation may be used to get [nested property values](https://github.com/jonschlinkert/get-value). | ||
### [.constant](index.js#L108) | ||
### [.constant](index.js#L135) | ||
@@ -114,3 +132,3 @@ Set a constant on the cache. | ||
### [.union](index.js#L139) | ||
### [.union](index.js#L166) | ||
@@ -132,3 +150,3 @@ Add values to an array on the `cache`. | ||
### [.extend](index.js#L181) | ||
### [.extend](index.js#L208) | ||
@@ -159,3 +177,3 @@ Extend the `cache` with the given object. This method is chainable. | ||
### [.del](index.js#L210) | ||
### [.del](index.js#L237) | ||
@@ -209,3 +227,3 @@ Remove `keys` from the cache. If no value is specified the entire cache is reset. | ||
* [option-cache](https://github.com/jonschlinkert/option-cache): Simple API for managing options in JavaScript applications. | ||
* [plasma-cache](https://github.com/jonschlinkert/plasma-cache): Object cache for Plasma. | ||
* [plasma-cache](https://github.com/jonschlinkert/plasma-cache): Object cache for [Plasma]. | ||
* [parser-cache](https://github.com/jonschlinkert/parser-cache): Cache and load parsers, similiar to consolidate.js engines. | ||
@@ -240,2 +258,2 @@ * [set-value](https://github.com/jonschlinkert/set-value): Create nested values and any intermediaries using dot notation (`'a.b.c'`) paths. | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 31, 2015._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on June 01, 2015._ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
13900
225
252
0