2 Copyright (c) 2012, Yahoo! Inc. All rights reserved.
3 Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
6 var util = require('util'),
7 Store = require('./index');
10 * a `Store` implementation using an in-memory object.
15 * var store = require('istanbul').Store.create('memory');
23 function MemoryStore() {
28 MemoryStore.TYPE = 'memory';
29 util.inherits(MemoryStore, Store);
31 Store.mix(MemoryStore, {
32 set: function (key, contents) {
33 this.map[key] = contents;
37 if (!this.hasKey(key)) {
38 throw new Error('Unable to find entry for [' + key + ']');
43 hasKey: function (key) {
44 return this.map.hasOwnProperty(key);
48 return Object.keys(this.map);
51 dispose: function () {
56 module.exports = MemoryStore;