function parseDuration(durationString) {
  if (durationString === null || typeof durationString === 'undefined') {
    return -1;
  } // Some VAST doesn't have an HH:MM:SS duration format but instead jus the number of seconds


  if (util.isNumeric(durationString)) {
    return parseInt(durationString);
  }

  var durationComponents = durationString.split(':');

  if (durationComponents.length !== 3) {
    return -1;
  }

  var secondsAndMS = durationComponents[2].split('.');
  var seconds = parseInt(secondsAndMS[0]);

  if (secondsAndMS.length === 2) {
    seconds += parseFloat("0.".concat(secondsAndMS[1]));
  }

  var minutes = parseInt(durationComponents[1] * 60);
  var hours = parseInt(durationComponents[0] * 60 * 60);

  if (isNaN(hours) || isNaN(minutes) || isNaN(seconds) || minutes > 60 * 60 || seconds > 60) {
    return -1;
  }

  return hours + minutes + seconds;
}
/**
 * Parses a String duration into a Number.
 * @param  {String} durationString - The dureation represented as a string.
 * @return {Number}
 */
Parses a String duration into a Number.
@param  {String} durationString - The dureation represented as a string.
@return {Number}
Parses a String duration into a Number . @param { String } durationString - The dureation represented as a string . @return { Number }
function parseDuration(durationString) {
  if (durationString === null || typeof durationString === 'undefined') {
    return -1;
  } 
  if (util.isNumeric(durationString)) {
    return parseInt(durationString);
  }
  var durationComponents = durationString.split(':');
  if (durationComponents.length !== 3) {
    return -1;
  }
  var secondsAndMS = durationComponents[2].split('.');
  var seconds = parseInt(secondsAndMS[0]);
  if (secondsAndMS.length === 2) {
    seconds += parseFloat("0.".concat(secondsAndMS[1]));
  }
  var minutes = parseInt(durationComponents[1] * 60);
  var hours = parseInt(durationComponents[0] * 60 * 60);
  if (isNaN(hours) || isNaN(minutes) || isNaN(seconds) || minutes > 60 * 60 || seconds > 60) {
    return -1;
  }
  return hours + minutes + seconds;
}
function parseDuration ( durationString ) { if ( durationString === null || typeof durationString === 'undefined' ) { return - 1 ; } if ( util . isNumeric ( durationString ) ) { return parseInt ( durationString ) ; } var durationComponents = durationString . split ( ':' ) ; if ( durationComponents . length !== 3 ) { return - 1 ; } var secondsAndMS = durationComponents [ 2 ] . split ( '.' ) ; var seconds = parseInt ( secondsAndMS [ 0 ] ) ; if ( secondsAndMS . length === 2 ) { seconds += parseFloat ( "0." . concat ( secondsAndMS [ 1 ] ) ) ; } var minutes = parseInt ( durationComponents [ 1 ] * 60 ) ; var hours = parseInt ( durationComponents [ 0 ] * 60 * 60 ) ; if ( isNaN ( hours ) || isNaN ( minutes ) || isNaN ( seconds ) || minutes > 60 * 60 || seconds > 60 ) { return - 1 ; } return hours + minutes + seconds ; }
Parses a String duration into a Number.
Parses a String duration into a Number .
// Some VAST doesn't have an HH:MM:SS duration format but instead jus the number of seconds