Pass undefined directly on data.get when key doesn't exists

To prevent confusing async
This commit is contained in:
Juan Cruz Viotti 2014-11-14 15:26:25 -04:00
parent a4a9ebf0bb
commit b0dde8104f

View File

@ -22,7 +22,10 @@ constructPath = (key) ->
exports.get = haltIfNoPrefix (key, options, callback) ->
exports.has key, (hasKey) ->
if not hasKey
return callback?(null)
# Pass undefined explicitly, otherwise
# async gets confused
return callback?(null, undefined)
keyPath = constructPath(key)
fs.readFile(keyPath, options, callback)