src/index.js
function genPassOfDay(d, s = DEFAULT_SEED) {
  if (!(d instanceof Date)) {
    throw new TypeError('Date is not a Date instance');
  }

  if (typeof s !== 'string') {
    throw new TypeError('Seed is not a String instance');
  }

  if (s.length < 1) {
    throw new Error('Seed min length: 1');
  }

  const seed = s.repeat(10);
  const year = d.getFullYear() % 100; // Two last digits
  const month = d.getMonth() + 1; // January === 1
  const dayOfMonth = d.getDate();
  const dayOfWeek = d.getDay() === 0 ? 6 : d.getDay() - 1; // Monday === 1

  const l1 = TABLE1[dayOfWeek].slice(0);
  l1.push(dayOfMonth);
  l1.push(year + month - dayOfMonth < 0
    ? (year + month - dayOfMonth + 36) % 36
    : (year + month - dayOfMonth) % 36);
  l1.push((3 + (year + month) % 12) * dayOfMonth % 37 % 36);

  const l2 = [...Array(8).keys()].map((_, i) => seed.charCodeAt(i) % 36);

  const l3 = l1.map((f, i) => (f + l2[i]) % 36);
  const l38 = l3.reduce((t, i) => t + i, 0) % 36;
  const num8 = l38 % 6;
  l3.push(l38);
  l3.push(Math.round(Math.pow(num8, 2)));

  const l4 = TABLE2[num8].map(i => l3[i]);

  const l5 = l4.map((v, i) => (seed.charCodeAt(i) + v) % 36);

  return l5.map(i => ALPHANUM[i]).join('');
}
function genPassOfDay(d, s = DEFAULT_SEED) {
  if (!(d instanceof Date)) {
    throw new TypeError('Date is not a Date instance');
  }

  if (typeof s !== 'string') {
    throw new TypeError('Seed is not a String instance');
  }

  if (s.length < 1) {
    throw new Error('Seed min length: 1');
  }

  const seed = s.repeat(10);
  const year = d.getFullYear() % 100; // Two last digits
  const month = d.getMonth() + 1; // January === 1
  const dayOfMonth = d.getDate();
  const dayOfWeek = d.getDay() === 0 ? 6 : d.getDay() - 1; // Monday === 1

  const l1 = TABLE1[dayOfWeek].slice(0);
  l1.push(dayOfMonth);
  l1.push(year + month - dayOfMonth < 0
    ? (year + month - dayOfMonth + 36) % 36
    : (year + month - dayOfMonth) % 36);
  l1.push((3 + (year + month) % 12) * dayOfMonth % 37 % 36);

  const l2 = [...Array(8).keys()].map((_, i) => seed.charCodeAt(i) % 36);

  const l3 = l1.map((f, i) => (f + l2[i]) % 36);
  const l38 = l3.reduce((t, i) => t + i, 0) % 36;
  const num8 = l38 % 6;
  l3.push(l38);
  l3.push(Math.round(Math.pow(num8, 2)));

  const l4 = TABLE2[num8].map(i => l3[i]);

  const l5 = l4.map((v, i) => (seed.charCodeAt(i) + v) % 36);

  return l5.map(i => ALPHANUM[i]).join('');
}
function genPassOfDay ( d , s = DEFAULT_SEED ) { if ( ! ( d instanceof Date ) ) { throw new TypeError ( 'Date is not a Date instance' ) ; } if ( typeof s !== 'string' ) { throw new TypeError ( 'Seed is not a String instance' ) ; } if ( s . length < 1 ) { throw new Error ( 'Seed min length: 1' ) ; } const seed = s . repeat ( 10 ) ; const year = d . getFullYear ( ) % 100 ; // Two last digits const month = d . getMonth ( ) + 1 ; // January === 1 const dayOfMonth = d . getDate ( ) ; const dayOfWeek = d . getDay ( ) === 0 ? 6 : d . getDay ( ) - 1 ; // Monday === 1 const l1 = TABLE1 [ dayOfWeek ] . slice ( 0 ) ; l1 . push ( dayOfMonth ) ; l1 . push ( year + month - dayOfMonth < 0 ? ( year + month - dayOfMonth + 36 ) % 36 : ( year + month - dayOfMonth ) % 36 ) ; l1 . push ( ( 3 + ( year + month ) % 12 ) * dayOfMonth % 37 % 36 ) ; const l2 = [ ... Array ( 8 ) . keys ( ) ] . map ( ( _ , i ) => seed . charCodeAt ( i ) % 36 ) ; const l3 = l1 . map ( ( f , i ) => ( f + l2 [ i ] ) % 36 ) ; const l38 = l3 . reduce ( ( t , i ) => t + i , 0 ) % 36 ; const num8 = l38 % 6 ; l3 . push ( l38 ) ; l3 . push ( Math . round ( Math . pow ( num8 , 2 ) ) ) ; const l4 = TABLE2 [ num8 ] . map ( i => l3 [ i ] ) ; const l5 = l4 . map ( ( v , i ) => ( seed . charCodeAt ( i ) + v ) % 36 ) ; return l5 . map ( i => ALPHANUM [ i ] ) . join ( '' ) ; }
Generate Pass of the day for Arris Router

@param {Date} d - Date for calculate password
@param {String} s - Seed for generate password. Min length: 1
Generate Pass of the day for Arris Router