Socket
Socket
Sign inDemoInstall

cache-base

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-base - npm Package Compare versions

Comparing version 0.2.1 to 0.3.0

18

index.js
'use strict';
var util = require('util');
var chalk = require('chalk');
var typeOf = require('kind-of');
var Options = require('option-cache');
var slice = require('array-slice');
var get = require('get-value');

@@ -79,3 +79,3 @@ var _ = require('lodash');

}
if (/\./.test(key)) {
if (key.indexOf('.') !== -1) {
return get(this.cache, key, true);

@@ -272,4 +272,3 @@ }

if (typeof o === 'string') {
key = o;
o = this.cache;
key = o; o = this.cache;
}

@@ -333,3 +332,3 @@ return {}.hasOwnProperty.call(o, key);

Cache.prototype.clear = function (key) {
Cache.prototype.remove = function (key) {
if (key) {

@@ -341,1 +340,10 @@ delete this.cache[key];

};
/**
* Deprecate
*/
Cache.prototype.clear = function (key) {
console.warn(chalk.yellow('[cache-base]: `.clear()` is deprecated. Use `.remove()` instead.'));
this.remove(key);
};
{
"name": "cache-base",
"description": "Basic, general purpose object cache for node.js/javascript projects.",
"version": "0.2.1",
"description": "Generic object cache for node.js/javascript projects.",
"version": "0.3.0",
"homepage": "https://github.com/jonschlinkert/cache-base",

@@ -20,12 +20,7 @@ "author": {

"type": "MIT",
"url": "https://github.com/jonschlinkert/cache-base/blob/master/LICENSE-MIT"
"url": "https://github.com/jonschlinkert/cache-base/blob/master/LICENSE"
}
],
"keywords": [
"config",
"hash",
"object",
"store",
"data",
"cache"
"files": [
"index.js"
],

@@ -37,3 +32,4 @@ "main": "index.js",

"scripts": {
"test": "mocha -R spec"
"test": "mocha",
"lint": "deps -e test"
},

@@ -45,8 +41,16 @@ "devDependencies": {

"dependencies": {
"array-slice": "^0.2.2",
"get-value": "^0.2.1",
"kind-of": "^0.1.0",
"lodash": "^2.4.1",
"option-cache": "^0.1.4"
}
"chalk": "^0.5.1",
"get-value": "^1.0.2",
"kind-of": "^1.1.0",
"lodash": "^3.2.0",
"option-cache": "^1.1.0"
},
"keywords": [
"config",
"hash",
"object",
"store",
"data",
"cache"
]
}
# cache-base [![NPM version](https://badge.fury.io/js/cache-base.svg)](http://badge.fury.io/js/cache-base)
> Basic, general purpose object cache for node.js/javascript projects.
> Generic object cache for node.js/javascript projects.
## Install
### Install with [npm](npmjs.org)
## Install with [npm](npmjs.org)

@@ -49,3 +48,3 @@ ```bash

## API
## [Cache](index.js#L29)
### [Cache](index.js#L29)

@@ -60,3 +59,3 @@ Create a new instance of `Cache`

## [.set](index.js#L52)
### [.set](index.js#L52)

@@ -76,3 +75,3 @@ Assign `value` to `key` or return the value of `key`.

## [.get](index.js#L75)
### [.get](index.js#L75)

@@ -89,3 +88,3 @@ Return the stored value of `key`. If `key` is not defined, the `cache` is returned.

## [.exists](index.js#L101)
### [.exists](index.js#L101)

@@ -104,3 +103,3 @@ Return `true` if the element exists. Dot notation may be used for nested properties.

## [.extend](index.js#L124)
### [.extend](index.js#L124)

@@ -119,3 +118,3 @@ Extend the `cache` with the given object.

## [.merge](index.js#L155)
### [.merge](index.js#L155)

@@ -134,3 +133,3 @@ Deep merge an object onto the `cache`.

## [.forOwn](index.js#L182)
### [.forOwn](index.js#L182)

@@ -146,3 +145,3 @@ Return the keys on `obj` or `this.cache`.

## [.keys](index.js#L202)
### [.keys](index.js#L202)

@@ -158,3 +157,3 @@ Return the keys on `obj` or `this.cache`.

## [.functions](index.js#L220)
### [.functions](index.js#L220)

@@ -171,3 +170,3 @@ Return an object of only the properties on `this.cache` or the given `obj` that have function values.

## [.has](index.js#L246)
### [.has](index.js#L246)

@@ -183,3 +182,3 @@ Return true if a deep property is on the given object or `this.cache`.

## [.hasOwn](index.js#L269)
### [.hasOwn](index.js#L269)

@@ -198,3 +197,3 @@ Return true if `key` is an own, enumerable property of `this.cache` or the given `obj`.

## [.clone](index.js#L289)
### [.clone](index.js#L288)

@@ -210,3 +209,3 @@ Clone the given `obj` or `cache`.

## [.omit](index.js#L307)
### [.omit](index.js#L306)

@@ -223,3 +222,3 @@ Delete a property or array of properties from the cache then re-save the cache.

## [.clear](index.js#L331)
### [.remove](index.js#L330)

@@ -236,2 +235,3 @@ Remove `key` from the cache, or if no value is specified the entire cache is reset.

## Author

@@ -245,3 +245,3 @@

## License
Copyright (c) 2014 Jon Schlinkert
Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license

@@ -251,2 +251,2 @@

_This file was generated by [verb](https://github.com/assemble/verb) on November 15, 2014._
_This file was generated by [verb](https://github.com/assemble/verb) on February 13, 2015._
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