src/index.js
function getSalt(inputSalt) {
    let salt = '';

    if (inputSalt) {
        // Remove $apr1$ token and extract salt.
        salt = inputSalt.split('$')[2];
    } else {
        while(salt.length < 8) { // Random 8 chars.
            let rchIndex = Math.floor((Math.random() * 64));
            salt += itoa64[rchIndex];
        }
    }

    return salt;
}
function getSalt(inputSalt) {
    let salt = '';

    if (inputSalt) {
        // Remove $apr1$ token and extract salt.
        salt = inputSalt.split('$')[2];
    } else {
        while(salt.length < 8) { // Random 8 chars.
            let rchIndex = Math.floor((Math.random() * 64));
            salt += itoa64[rchIndex];
        }
    }

    return salt;
}
function getSalt ( inputSalt ) { let salt = '' ; if ( inputSalt ) { // Remove $apr1$ token and extract salt. salt = inputSalt . split ( '$' ) [ 2 ] ; } else { while ( salt . length < 8 ) { // Random 8 chars. let rchIndex = Math . floor ( ( Math . random ( ) * 64 ) ) ; salt += itoa64 [ rchIndex ] ; } } return salt ; }
Returns salt.
Returns salt .