Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function namespace(name) {
var Cache = name ? CacheBase.namespace(name) : CacheBase;
var fns = [];
/**
* Create an instance of `Base` with the given `config` and `options`.
*
* ```js
* // initialize with `config` and `options`
* var app = new Base({isApp: true}, {abc: true});
* app.set('foo', 'bar');
*
* // values defined with the given `config` object will be on the root of the instance
* console.log(app.baz); //=> undefined
* console.log(app.foo); //=> 'bar'
* // or use `.get`
* console.log(app.get('isApp')); //=> true
* console.log(app.get('foo')); //=> 'bar'
/*!
* base-data
*
* Copyright (c) 2015-2017, Jon Schlinkert.
* Released under the MIT License.
*/
'use strict';
var util = require('util');
var cache = require('cache-base');
var Cache = cache.namespace('cache');
var utils = require('./utils');
module.exports = function(prop, config) {
if (utils.isObject(prop)) {
config = prop;
prop = 'cache.data';
}
if (typeof prop === 'undefined') {
prop = 'cache.data';
}
return function baseData() {
if (!utils.isValid(this, prop)) {
return;
}