Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b3ee0b9

Browse files
run verb to generate readme documentation
1 parent dc3f5c5 commit b3ee0b9

File tree

2 files changed

+72
-63
lines changed

2 files changed

+72
-63
lines changed

‎.npmrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

‎README.md‎

Lines changed: 71 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,58 @@ More [usage examples](#usage-examples) below.
5050
const app = new CacheBase();
5151
```
5252

53-
### [.prime](index.js#L60)
53+
### [.set](index.js#L65)
54+
55+
Assign `value` to `key`. Also emits `set` with the key and value.
56+
57+
**Params**
58+
59+
* `key` **{String|Array}**: The name of the property to set. Dot-notation may be used to set nested properties.
60+
* `value` **{any}**
61+
* `returns` **{Object}**: Returns the instance for chaining.
62+
63+
**Events**
64+
65+
* `emits`: `set` with `key` and `value` as arguments.
66+
67+
**Example**
68+
69+
```js
70+
app.on('set', function(key, val) {
71+
// do something when `set` is emitted
72+
});
73+
74+
app.set('admin', true);
75+
76+
// also takes an object or an array of objects
77+
app.set({ name: 'Brian' });
78+
app.set([{ foo: 'bar' }, { baz: 'quux' }]);
79+
console.log(app);
80+
//=> { name: 'Brian', foo: 'bar', baz: 'quux' }
81+
```
82+
83+
### [.get](index.js#L90)
84+
85+
Return the value of `key`.
86+
87+
**Params**
88+
89+
* `key` **{String|Array}**: The name of the property to get. Dot-notation may be used to set nested properties.
90+
* `returns` **{any}**: Returns the value of `key`
91+
92+
**Events**
93+
94+
* `emits`: `get` with `key` and `value` as arguments.
95+
96+
**Example**
97+
98+
```js
99+
app.set('a.b.c', 'd');
100+
app.get('a.b');
101+
//=> { c: 'd' }
102+
```
103+
104+
### [.prime](index.js#L120)
54105

55106
Create a property on the cache with the given `value` only if it doesn't already exist.
56107

@@ -71,7 +122,7 @@ console.log(app.cache.one); //=> { foo: 'bar' }
71122
console.log(app.cache.two); //=> { c: 'd' }
72123
```
73124

74-
### [.default](index.js#L104)
125+
### [.default](index.js#L162)
75126

76127
Set a default value to be used when `.get()` is called and the value is not defined on the cache. Returns a value from the defaults when only a key is passed.
77128

@@ -105,37 +156,7 @@ console.log(app);
105156
// defaults: { foo: 'one', bar: 'two', baz: 'three' } }
106157
```
107158

108-
### [.set](index.js#L145)
109-
110-
Assign `value` to `key`. Also emits `set` with the key and value.
111-
112-
**Params**
113-
114-
* `key` **{String|Array}**: The name of the property to set. Dot-notation may be used to set nested properties.
115-
* `value` **{any}**
116-
* `returns` **{Object}**: Returns the instance for chaining.
117-
118-
**Events**
119-
120-
* `emits`: `set` with `key` and `value` as arguments.
121-
122-
**Example**
123-
124-
```js
125-
app.on('set', function(key, val) {
126-
// do something when `set` is emitted
127-
});
128-
129-
app.set('admin', true);
130-
131-
// also takes an object or an array of objects
132-
app.set({ name: 'Brian' });
133-
app.set([{ foo: 'bar' }, { baz: 'quux' }]);
134-
console.log(app);
135-
//=> { name: 'Brian', foo: 'bar', baz: 'quux' }
136-
```
137-
138-
### [.union](index.js#L173)
159+
### [.union](index.js#L199)
139160

140161
Set an array of unique values on cache `key`.
141162

@@ -155,28 +176,7 @@ console.log(app.get('a'));
155176
//=> { b: { c: ['foo', 'bar', 'baz'] } }
156177
```
157178

158-
### [.get](index.js#L194)
159-
160-
Return the value of `key`.
161-
162-
**Params**
163-
164-
* `key` **{String|Array}**: The name of the property to get. Dot-notation may be used to set nested properties.
165-
* `returns` **{any}**: Returns the value of `key`
166-
167-
**Events**
168-
169-
* `emits`: `get` with `key` and `value` as arguments.
170-
171-
**Example**
172-
173-
```js
174-
app.set('a.b.c', 'd');
175-
app.get('a.b');
176-
//=> { c: 'd' }
177-
```
178-
179-
### [.has](index.js#L224)
179+
### [.has](index.js#L223)
180180

181181
Return true if the value of property `key` is not `undefined`.
182182

@@ -185,10 +185,6 @@ Return true if the value of property `key` is not `undefined`.
185185
* `key` **{String|Array}**: The name of the property to check. Dot-notation may be used to set nested properties.
186186
* `returns` **{Boolean}**
187187

188-
**Events**
189-
190-
* `emits`: `has` with `key` and true or false as arguments.
191-
192188
**Example**
193189

194190
```js
@@ -201,7 +197,7 @@ app.has('bar'); //=> true
201197
app.has('baz'); //=> false
202198
```
203199

204-
### [.hasOwn](index.js#L254)
200+
### [.hasOwn](index.js#L253)
205201

206202
Returns true if the specified property is an own (not inherited) property. Similar to [.has()](#has), but returns true if the key exists, even if the value is `undefined`.
207203

@@ -228,7 +224,7 @@ app.hasOwn('z'); //=> true
228224
app.hasOwn('lslsls'); //=> false
229225
```
230226

231-
### [.del](index.js#L279)
227+
### [.del](index.js#L278)
232228

233229
Delete one or more properties from the instance.
234230

@@ -255,6 +251,10 @@ app.del('foo');
255251
app.del(['foo', 'bar']);
256252
```
257253

254+
### [.clear](index.js#L301)
255+
256+
Reset the entire cache to an empty object. Note that this does not also clear the `defaults` object, since you can manually do `cache.defaults = {}` if you want to reset that object as well.
257+
258258
**Example**
259259

260260
```js
@@ -270,10 +270,14 @@ given object or array.
270270

271271
**Params**
272272

273-
* `key` **{String|Array}**: The name of the method to visit. Dot-notation may be used to set nested properties.
273+
* `key` **{String|Array}**: The name of the method to visit.
274274
* `val` **{Object|Array}**: The object or array to iterate over.
275275
* `returns` **{Object}**: Returns the instance for chaining.
276276

277+
### [.keys](index.js#L338)
278+
279+
Gets an array of names of all enumerable properties on the cache.
280+
277281
**Example**
278282

279283
```js
@@ -285,6 +289,10 @@ console.log(app.keys);
285289
//=> ['user', 'admin']
286290
```
287291

292+
### [.size](index.js#L357)
293+
294+
Gets the length of [keys](#keys).
295+
288296
**Example**
289297

290298
```js
@@ -431,4 +439,4 @@ Released under the [MIT License](LICENSE).
431439

432440
***
433441

434-
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on March 03, 2018._
442+
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on March 23, 2018._

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /