Socket
Socket
Sign inDemoInstall

cache-base

Package Overview
Dependencies
Maintainers
2
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.8.2 to 0.8.3

23

index.js

@@ -90,2 +90,25 @@ 'use strict';

/**
* Union `array` to `key`. Also emits `set` with
* the key and value.
*
* ```js
* app.union('a.b', ['foo']);
* app.union('a.b', ['bar']);
* console.log(app.get('a'));
* //=> {b: ['foo', 'bar']}
* ```
* @name .union
* @param {String} `key`
* @param {any} `value`
* @return {Object} Returns the instance for chaining.
* @api public
*/
Cache.prototype.union = function(key, val) {
var ctx = prop ? this[prop] : this;
utils.union(ctx, key, utils.arrayify(val));
return this;
};
/**
* Return the value of `key`. Dot notation may be used

@@ -92,0 +115,0 @@ * to get [nested property values][get-value].

13

package.json
{
"name": "cache-base",
"description": "Basic object cache with `get`, `set`, `del`, and `has` methods for node.js/javascript projects.",
"version": "0.8.2",
"version": "0.8.3",
"homepage": "https://github.com/jonschlinkert/cache-base",

@@ -25,5 +25,5 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"collection-visit": "^0.2.1",
"component-emitter": "^1.2.0",
"get-value": "^2.0.3",
"has-value": "^0.3.0",
"component-emitter": "^1.2.1",
"get-value": "^2.0.5",
"has-value": "^0.3.1",
"isobject": "^2.0.0",

@@ -33,7 +33,8 @@ "lazy-cache": "^1.0.3",

"to-object-path": "^0.3.0",
"union-value": "^0.2.3",
"unset-value": "^0.1.1"
},
"devDependencies": {
"gulp-format-md": "^0.1.7",
"mocha": "*"
"gulp-format-md": "^0.1.8",
"mocha": "^2.4.5"
},

@@ -40,0 +41,0 @@ "keywords": [

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

# cache-base [![NPM version](https://img.shields.io/npm/v/cache-base.svg)](https://www.npmjs.com/package/cache-base) [![Build Status](https://img.shields.io/travis/jonschlinkert/cache-base.svg)](https://travis-ci.org/jonschlinkert/cache-base)
# cache-base [![NPM version](https://img.shields.io/npm/v/cache-base.svg?style=flat)](https://www.npmjs.com/package/cache-base) [![NPM downloads](https://img.shields.io/npm/dm/cache-base.svg?style=flat)](https://npmjs.org/package/cache-base) [![Build Status](https://img.shields.io/travis/jonschlinkert/cache-base.svg?style=flat)](https://travis-ci.org/jonschlinkert/cache-base)

@@ -129,4 +129,23 @@ > Basic object cache with `get`, `set`, `del`, and `has` methods for node.js/javascript projects.

### [.get](index.js#L109)
### [.union](index.js#L106)
Union `array` to `key`. Also emits `set` with the key and value.
**Params**
* `key` **{String}**
* `value` **{any}**
* `returns` **{Object}**: Returns the instance for chaining.
**Example**
```js
app.union('a.b', ['foo']);
app.union('a.b', ['bar']);
console.log(app.get('a'));
//=> {b: ['foo', 'bar']}
```
### [.get](index.js#L132)
Return the value of `key`. Dot notation may be used to get [nested property values][get-value].

@@ -154,3 +173,3 @@

### [.has](index.js#L136)
### [.has](index.js#L159)

@@ -176,3 +195,3 @@ Return true if app has a stored value for `key`, false only if value is `undefined`.

### [.del](index.js#L164)
### [.del](index.js#L187)

@@ -200,3 +219,3 @@ Delete one or more properties from the instance.

### [.clear](index.js#L183)
### [.clear](index.js#L206)

@@ -211,3 +230,3 @@ Reset the entire cache to an empty object.

### [.visit](index.js#L200)
### [.visit](index.js#L223)

@@ -225,4 +244,6 @@ Visit `method` over the properties in the given object, or map

You might also be interested in these projects:
* [base-methods](https://www.npmjs.com/package/base-methods): base-methods is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… [more](https://www.npmjs.com/package/base-methods) | [homepage](https://github.com/jonschlinkert/base-methods)
* [get-value](https://www.npmjs.com/package/get-value): Use property paths (` a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value)
* [get-value](https://www.npmjs.com/package/get-value): Use property paths (`a.b.c`) to get a nested value from an object. | [homepage](https://github.com/jonschlinkert/get-value)
* [has-value](https://www.npmjs.com/package/has-value): Returns true if a value exists, false if empty. Works with deeply nested values using… [more](https://www.npmjs.com/package/has-value) | [homepage](https://github.com/jonschlinkert/has-value)

@@ -268,3 +289,3 @@ * [option-cache](https://www.npmjs.com/package/option-cache): Simple API for managing options in JavaScript applications. | [homepage](https://github.com/jonschlinkert/option-cache)

Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert)
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/cache-base/blob/master/LICENSE).

@@ -274,2 +295,2 @@

_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on March 02, 2016._
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 21, 2016._

@@ -22,2 +22,3 @@ 'use strict';

require('set-value', 'set');
require('union-value', 'union');
require('to-object-path', 'toPath');

@@ -27,2 +28,10 @@ require = fn;

/**
* Cast val to an array
*/
utils.arrayify = function(val) {
return val ? (Array.isArray(val) ? val : [val]) : [];
};
/**
* Expose `utils` modules

@@ -29,0 +38,0 @@ */

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