lib/util.js
function getLetterTime(timeString) {
  var totalSeconds = 0;
  var timeValues = {
    's': 1,
    'm': 1 * 60,
    'h': 1 * 60 * 60,
    'd': 1 * 60 * 60 * 24,
    'w': 1 * 60 * 60 * 24 * 7,
  };
  var timePairs;

  //expand to "1 h 30 m 20 s" and split
  timeString = timeString.replace(/([smhdw])/g, ' $1 ').trim();
  timePairs = timeString.split(' ');

  for (var i = 0; i < timePairs.length; i += 2) {
    totalSeconds += parseInt(timePairs[i], 10) *
      timeValues[timePairs[i + 1] || 's'];
  }
  return totalSeconds;
}
function getLetterTime(timeString) {
  var totalSeconds = 0;
  var timeValues = {
    's': 1,
    'm': 1 * 60,
    'h': 1 * 60 * 60,
    'd': 1 * 60 * 60 * 24,
    'w': 1 * 60 * 60 * 24 * 7,
  };
  var timePairs;

  //expand to "1 h 30 m 20 s" and split
  timeString = timeString.replace(/([smhdw])/g, ' $1 ').trim();
  timePairs = timeString.split(' ');

  for (var i = 0; i < timePairs.length; i += 2) {
    totalSeconds += parseInt(timePairs[i], 10) *
      timeValues[timePairs[i + 1] || 's'];
  }
  return totalSeconds;
}
function getLetterTime ( timeString ) { var totalSeconds = 0 ; var timeValues = { 's' : 1 , 'm' : 1 * 60 , 'h' : 1 * 60 * 60 , 'd' : 1 * 60 * 60 * 24 , 'w' : 1 * 60 * 60 * 24 * 7 , } ; var timePairs ; //expand to "1 h 30 m 20 s" and split timeString = timeString . replace ( / ([smhdw]) / g , ' $1 ' ) . trim ( ) ; timePairs = timeString . split ( ' ' ) ; for ( var i = 0 ; i < timePairs . length ; i += 2 ) { totalSeconds += parseInt ( timePairs [ i ] , 10 ) * timeValues [ timePairs [ i + 1 ] || 's' ] ; } return totalSeconds ; }
parses strings like 1h30m20s to seconds
parses strings like 1h30m20s to seconds