Skip to content

Commit

Permalink
validating arguments and supporting get with undefined key
Browse files Browse the repository at this point in the history
  • Loading branch information
pgte committed Jul 4, 2017
1 parent 174fff0 commit 8e8055d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ module.exports = (store) => {
callback = key
key = undefined
}
if (!key) {
key = undefined
}
store.get(configKey, (err, encodedValue) => {
if (err) { return callback(err) }

Expand Down Expand Up @@ -55,7 +58,14 @@ module.exports = (store) => {
callback = value
value = key
key = undefined
} else if (!key || typeof key !== 'string') {
return callback(new Error('Invalid key type'))
}

if (value === undefined || Buffer.isBuffer(value)) {
return callback(new Error('Invalid value type'))
}

setQueue.push({
key: key,
value: value
Expand Down

0 comments on commit 8e8055d

Please sign in to comment.