function resolveExpiry(subject) {
    var pattern = new RegExp('^([1-9][0-9]*)([smhdw])$','i');
    var multipliers = {s: 1, m: 60, h : 60*60, d:60*60*24, w: 60*60*24*7, y: 60*60*24*365};
    var match = pattern.exec(subject);
    if (match) {
      return match[1] * multipliers[match[2]] * 1000;
    }
    return -1;
  }
function resolveExpiry(subject) {
    var pattern = new RegExp('^([1-9][0-9]*)([smhdw])$','i');
    var multipliers = {s: 1, m: 60, h : 60*60, d:60*60*24, w: 60*60*24*7, y: 60*60*24*365};
    var match = pattern.exec(subject);
    if (match) {
      return match[1] * multipliers[match[2]] * 1000;
    }
    return -1;
  }
function resolveExpiry ( subject ) { var pattern = new RegExp ( '^([1-9][0-9]*)([smhdw])$' , 'i' ) ; var multipliers = { s : 1 , m : 60 , h : 60 * 60 , d : 60 * 60 * 24 , w : 60 * 60 * 24 * 7 , y : 60 * 60 * 24 * 365 } ; var match = pattern . exec ( subject ) ; if ( match ) { return match [ 1 ] * multipliers [ match [ 2 ] ] * 1000 ; } return - 1 ; }
/*
convert a simple timespan string, expressed in days, hours, minutes, or
seconds, such as 30d, 12d, 8h, 45m, 30s, into a numeric quantity in
seconds.
/ * convert a simple timespan string expressed in days hours minutes or seconds such as 30d 12d 8h 45m 30s into a numeric quantity in seconds .