diff --git a/bcrypt.js b/bcrypt.js index dd8aed0..7fc281c 100644 --- a/bcrypt.js +++ b/bcrypt.js @@ -87,14 +87,10 @@ module.exports.genSalt = function genSalt(rounds, minor, cb) { /// @param {String} salt the salt to use when hashing /// @return {String} hash module.exports.hashSync = function hashSync(data, salt) { - if (data == null || salt == null) { throw new Error('data and salt arguments required'); } - - if (salt === '') { - throw new Error('Salt cannot be empty'); - } + if (typeof data !== 'string' || (typeof salt !== 'string' && typeof salt !== 'number')) { throw new Error('data must be a string and salt must either be a salt string or a number of rounds'); }