function matchOperator(str, operatorList) {
  return operatorList.reduce((match, operator) => {
    return match ||
      (str.startsWith(operator.symbol) ? operator : null);
  }, null);
}
/**
 * Attempts to match a given list of operators against the head of a given string.
 * Returns the first match if successful, otherwise null.
 *
 * @private
 * @static
 * @param {string}   str          - a string to match against
 * @param {Object[]} operatorList - an array of operator definitions, sorted by longest symbol
 * @returns {?Object}
 */
Attempts to match a given list of operators against the head of a given string.
Returns the first match if successful, otherwise null.


Attempts to match a given list of operators against the head of a given string . Returns the first match if successful otherwise null .
function matchOperator(str, operatorList) {
  return operatorList.reduce((match, operator) => {
    return match ||
      (str.startsWith(operator.symbol) ? operator : null);
  }, null);
}
function matchOperator ( str , operatorList ) { return operatorList . reduce ( ( match , operator ) => { return match || ( str . startsWith ( operator . symbol ) ? operator : null ) ; } , null ) ; }
Attempts to match a given list of operators against the head of a given string.
Attempts to match a given list of operators against the head of a given string .