varMAX_ALLOC=Math.pow(2,30)-1// default in iojsfunctioncheckBuffer(buf,name){if(typeofbuf!=='string'&&!Buffer.isBuffer(buf)){thrownewTypeError(name+' must be a buffer or string')}}module.exports=function(password,salt,iterations,keylen){checkBuffer(password,'Password')checkBuffer(salt,'Salt')if(typeofiterations!=='number'){thrownewTypeError('Iterations not a number')}if(iterations<0){thrownewTypeError('Bad iterations')}if(typeofkeylen!=='number'){thrownewTypeError('Key length not a number')}if(keylen<0||keylen>MAX_ALLOC||keylen!==keylen){/* eslint no-self-compare: 0 */thrownewTypeError('Bad key length')}}