source: trip-planner-front/node_modules/map-cache/README.md@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.4 KB
Line 
1# map-cache [![NPM version](https://img.shields.io/npm/v/map-cache.svg?style=flat)](https://www.npmjs.com/package/map-cache) [![NPM downloads](https://img.shields.io/npm/dm/map-cache.svg?style=flat)](https://npmjs.org/package/map-cache) [![Build Status](https://img.shields.io/travis/jonschlinkert/map-cache.svg?style=flat)](https://travis-ci.org/jonschlinkert/map-cache)
2
3Basic cache object for storing key-value pairs.
4
5## Install
6
7Install with [npm](https://www.npmjs.com/):
8
9```sh
10$ npm install map-cache --save
11```
12
13Based on MapCache in Lo-dash v3.0. [MIT License](https://github.com/lodash/lodash/blob/master/LICENSE.txt)
14
15## Usage
16
17```js
18var MapCache = require('map-cache');
19var mapCache = new MapCache();
20```
21
22## API
23
24### [MapCache](index.js#L28)
25
26Creates a cache object to store key/value pairs.
27
28**Example**
29
30```js
31var cache = new MapCache();
32```
33
34### [.set](index.js#L45)
35
36Adds `value` to `key` on the cache.
37
38**Params**
39
40* `key` **{String}**: The key of the value to cache.
41* `value` **{any}**: The value to cache.
42* `returns` **{Object}**: Returns the `Cache` object for chaining.
43
44**Example**
45
46```js
47cache.set('foo', 'bar');
48```
49
50### [.get](index.js#L65)
51
52Gets the cached value for `key`.
53
54**Params**
55
56* `key` **{String}**: The key of the value to get.
57* `returns` **{any}**: Returns the cached value.
58
59**Example**
60
61```js
62cache.get('foo');
63//=> 'bar'
64```
65
66### [.has](index.js#L82)
67
68Checks if a cached value for `key` exists.
69
70**Params**
71
72* `key` **{String}**: The key of the entry to check.
73* `returns` **{Boolean}**: Returns `true` if an entry for `key` exists, else `false`.
74
75**Example**
76
77```js
78cache.has('foo');
79//=> true
80```
81
82### [.del](index.js#L98)
83
84Removes `key` and its value from the cache.
85
86**Params**
87
88* `key` **{String}**: The key of the value to remove.
89* `returns` **{Boolean}**: Returns `true` if the entry was removed successfully, else `false`.
90
91**Example**
92
93```js
94cache.del('foo');
95```
96
97## Related projects
98
99You might also be interested in these projects:
100
101* [cache-base](https://www.npmjs.com/package/cache-base): Basic object cache with `get`, `set`, `del`, and `has` methods for node.js/javascript projects. | [homepage](https://github.com/jonschlinkert/cache-base)
102* [config-cache](https://www.npmjs.com/package/config-cache): General purpose JavaScript object storage methods. | [homepage](https://github.com/jonschlinkert/config-cache)
103* [option-cache](https://www.npmjs.com/package/option-cache): Simple API for managing options in JavaScript applications. | [homepage](https://github.com/jonschlinkert/option-cache)
104
105## Contributing
106
107Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/map-cache/issues/new).
108
109## Building docs
110
111Generate readme and API documentation with [verb](https://github.com/verbose/verb):
112
113```sh
114$ npm install verb && npm run docs
115```
116
117Or, if [verb](https://github.com/verbose/verb) is installed globally:
118
119```sh
120$ verb
121```
122
123## Running tests
124
125Install dev dependencies:
126
127```sh
128$ npm install -d && npm test
129```
130
131## Author
132
133**Jon Schlinkert**
134
135* [github/jonschlinkert](https://github.com/jonschlinkert)
136* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
137
138## License
139
140Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
141Released under the [MIT license](https://github.com/jonschlinkert/map-cache/blob/master/LICENSE).
142
143***
144
145_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 10, 2016._
Note: See TracBrowser for help on using the repository browser.