LookupStore Class
a Store
implementation that doesn't actually store anything. It assumes that keys
are absolute file paths, and contents are contents of those files.
Thus, set
for this store is no-op, get
returns the
contents of the filename that the key represents, hasKey
returns true if the key
supplied is a valid file path and keys
always returns an empty array.
Usage
var store = require('istanbul').Store.create('fslookup');
Constructor
LookupStore
()
Methods
dispose
()
lifecycle method to dispose temporary resources associated with the store
get
-
key
returns the content associated to a specific key or throws if the key
was not set
Parameters:
-
key
Stringthe key for which to get the content
Returns:
the content for the specified key
getObject
-
key
sugar method to return an object associated with a specific key. Throws if the content set against the key was not a valid JSON string.
Parameters:
-
key
Stringthe key for which to return the associated object
Returns:
the object corresponding to the key
hasKey
-
key
returns true if the key is one for which a get()
call would work.
Parameters:
-
key
String
Returns:
true if the key is valid for this store, false otherwise
keys
()
Array
returns a list of all known keys
Returns:
an array of seen keys
set
-
key
-
contents
sets some content associated with a specific key. The manner in which
duplicate keys are handled for multiple set()
calls with the same
key is implementation-specific.
Parameters:
-
key
Stringthe key for the content
-
contents
Stringthe contents for the key
setObject
-
key
-
object
sugar method to set an object against a specific key.
Parameters:
-
key
Stringthe key for the object
-
object
Objectthe object to be stored