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