push
travis-ci
1768 of 2322 relevant lines covered (76.14%)
3180.88 hits per line
1 |
'use strict';
|
|
2 |
|
|
3 |
function MemoryStore() { |
6✔ |
4 |
|
|
5 |
var store = {};
|
1,578✔ |
6 |
|
|
7 |
this.get = function get(key, cb) { |
1,578✔ |
8 |
return cb(null, store[key]); |
334✔ |
9 |
}; |
|
10 |
|
|
11 |
this.set = function set(key, val, cb) { |
1,578✔ |
12 |
store[key] = val; |
28,151✔ |
13 |
return cb(null, val); |
28,151✔ |
14 |
}; |
|
15 |
|
|
16 |
this.delete = function del(key, cb) { |
1,578✔ |
17 |
delete store[key];
|
270✔ |
18 |
return cb(null); |
270✔ |
19 |
}; |
|
20 |
|
|
21 |
this.clear = function clear(cb) { |
1,578✔ |
22 |
store = {}; |
× |
23 |
cb(null);
|
× |
24 |
}; |
|
25 |
|
|
26 |
this.size = function dbsize(cb) { |
1,578✔ |
27 |
cb(null, Object.keys(store).length);
|
× |
28 |
}; |
|
29 |
} |
|
30 |
|
|
31 |
module.exports = MemoryStore; |
6✔ |