lib/index.js
function parseInput(input) {
  var match = re.exec(input);

  if (match !== null) {
    var _match = _slicedToArray(match, 6),
        pre_keyword = _match[1],
        operator_keyword = _match[2],
        value = _match[3],
        unit = _match[4],
        post_keyword = _match[5];

    if (pre_keyword && post_keyword || pre_keyword && operator_keyword || post_keyword && operator_keyword) {
      return null;
    }

    return {
      value: sanitizeValue({
        value: value,
        operator_keyword: operator_keyword,
        post_keyword: post_keyword
      }),
      unit: unit
    };
  }

  return null;
}
function parseInput(input) {
  var match = re.exec(input);

  if (match !== null) {
    var _match = _slicedToArray(match, 6),
        pre_keyword = _match[1],
        operator_keyword = _match[2],
        value = _match[3],
        unit = _match[4],
        post_keyword = _match[5];

    if (pre_keyword && post_keyword || pre_keyword && operator_keyword || post_keyword && operator_keyword) {
      return null;
    }

    return {
      value: sanitizeValue({
        value: value,
        operator_keyword: operator_keyword,
        post_keyword: post_keyword
      }),
      unit: unit
    };
  }

  return null;
}
function parseInput ( input ) { var match = re . exec ( input ) ; if ( match !== null ) { var _match = _slicedToArray ( match , 6 ) , pre_keyword = _match [ 1 ] , operator_keyword = _match [ 2 ] , value = _match [ 3 ] , unit = _match [ 4 ] , post_keyword = _match [ 5 ] ; if ( pre_keyword && post_keyword || pre_keyword && operator_keyword || post_keyword && operator_keyword ) { return null ; } return { value : sanitizeValue ( { value : value , operator_keyword : operator_keyword , post_keyword : post_keyword } ) , unit : unit } ; } return null ; }
Parses value and unit from human-readable relative time.
@param {string} input
@return {parsed_input | null} Returns `null` if input can not be parsed.
Parses value and unit from human - readable relative time .