
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
config-cache
Advanced tools
General purpose JavaScript object storage methods.
Major breaking changes were made in 5.0!
In an effort to simplify the library, the following methods were removed:
clone: use clone-deep, example: var obj = cloneDeep(config.cache)keys: use Object.keys(config.cache)omit: use .del()exists: use config.cache.hasOwnProperty() or has-valuehas: use config.cache.hasownProperty() or has-valuehasOwn: use config.cache.hasOwnProperty() or has-valueThe following data methods were also removed, use plasma-cacheif you need these methods:
dataprocessplasmaextendDataInstall with npm
$ npm i config-cache --save
var Config = require('config-cache');
var config = new Config();
Initialize a new Config, optionally passing an object to initialize with.
Params
cache {Object}Example
var config = new Config();
Static method for mixing Config prototype properties onto obj.
Params
obj {Object}returns {Object}Example
function App() {
Config.call(this);
}
Config.mixin(App.prototype);
Assign value to key or return the value of key.
Params
key {String}value {*}returns {Object} Config: to enable chainingExample
config.set(key, value);
Return the stored value of key. Dot notation may be used to get nested property values.
Params
key {*}escape {Boolean}returns {*}Example
config.set('foo', 'bar');
config.get('foo');
// => "bar"
// also takes an array or list of property paths
config.set({data: {name: 'Jon'}})
config.get('data', 'name');
//=> 'Jon'
Create a constant (getter/setter) for setting and getting values on the given namespace or this.cache.
Params
key {String}value {*}Example
config.constant('site.title', 'Foo');
Add values to an array on the cache.
returns {Object} Config: to enable chainingExample
// config.cache['foo'] => ['a.hbs', 'b.hbs']
config
.union('foo', ['b.hbs', 'c.hbs'], ['d.hbs']);
.union('foo', ['e.hbs', 'f.hbs']);
// config.cache['foo'] => ['a.hbs', 'b.hbs', 'c.hbs', 'd.hbs', 'e.hbs', 'f.hbs']
Extend the cache with the given object. This method is chainable.
Or define the property to extend:
returns {Object} Config: to enable chainingExamples
config
.extend({foo: 'bar'}, {baz: 'quux'});
.extend({fez: 'bang'});
config
// extend `cache.a`
.extend('a', {foo: 'bar'}, {baz: 'quux'})
// extend `cache.b`
.extend('b', {fez: 'bang'})
// extend `cache.a.b.c`
.extend('a.b.c', {fez: 'bang'});
Remove keys from the cache. If no value is specified the entire cache is reset.
Example
config.del();
If expand: true is defined on the options, the value will be set using [expander].
Examples:
// as a key-value pair
config.set('a', {b: 'c'});
// or as an object
config.set({a: {b: 'c'}});
// chaining is possible
cache
.set({a: {b: 'c'}})
.set('d', 'e');
Expand template strings with expander:
config.set('a', {b: '${c}', c: 'd'}, true);
Visit the [expander] docs for more info.
a.b.c) to get a nested value from an object.'a.b.c') paths.Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Install dev dependencies:
$ npm i -d && npm test
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on June 13, 2015.
FAQs
General purpose JavaScript object storage methods.
The npm package config-cache receives a total of 347 weekly downloads. As such, config-cache popularity was classified as not popular.
We found that config-cache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.