source-cache-store.js
833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Source Cache Store
// ==================
//
// Used by lib/reporter
// Dependencies
// ------------
var util = require('util')
var Store = require('istanbul').Store
// Constructor
var SourceCacheStore = module.exports = function (opts) {
Store.call(this, opts)
opts = opts || {}
this.sourceCache = opts.sourceCache
}
// Class Constants
// ---------------
SourceCacheStore.TYPE = 'sourceCacheLookup'
// Inherits from an Istanbul.Store
util.inherits(SourceCacheStore, Store)
// Implement needed methods
Store.mix(SourceCacheStore, {
keys: function () {
throw new Error('Not implemented')
},
get: function (key) {
return this.sourceCache[key]
},
hasKey: function (key) {
return this.sourceCache.hasOwnProperty(key)
},
set: function (key, contents) {
throw new Error('Not applicable')
}
})