src/lib/generate.js
function hashRound(input, length, hashFunction, rounds, callback) {
  if (rounds > 0 || !validatePassword(input, length)) {
    process.nextTick(() => {
      hashRound(hashFunction(input), length, hashFunction, rounds - 1, callback);
    });
    return;
  }
  process.nextTick(() => {
    callback(input.substring(0, length));
  });
}
function hashRound(input, length, hashFunction, rounds, callback) {
  if (rounds > 0 || !validatePassword(input, length)) {
    process.nextTick(() => {
      hashRound(hashFunction(input), length, hashFunction, rounds - 1, callback);
    });
    return;
  }
  process.nextTick(() => {
    callback(input.substring(0, length));
  });
}
function hashRound ( input , length , hashFunction , rounds , callback ) { if ( rounds > 0 || ! validatePassword ( input , length ) ) { process . nextTick ( ( ) => { hashRound ( hashFunction ( input ) , length , hashFunction , rounds - 1 , callback ) ; } ) ; return ; } process . nextTick ( ( ) => { callback ( input . substring ( 0 , length ) ) ; } ) ; }
Hash the input for the requested number of rounds, then continue hashing until the password policy is satisfied. Finally, pass result to callback.
Hash the input for the requested number of rounds then continue hashing until the password policy is satisfied . Finally pass result to callback .