src/index.js
function handleNode (node, ...extraArgs) {
  const cbObj = extraArgs[extraArgs.length - 1];

  if (!nodeTypeToMethodMap.has(node.nodeType)) {
    throw new TypeError('Not a valid `nodeType` value');
  }
  const methodName = nodeTypeToMethodMap.get(node.nodeType);
  if (!cbObj[methodName]) {
    return undefined;
  }
  return cbObj[methodName](node, ...extraArgs);
}
function handleNode (node, ...extraArgs) {
  const cbObj = extraArgs[extraArgs.length - 1];

  if (!nodeTypeToMethodMap.has(node.nodeType)) {
    throw new TypeError('Not a valid `nodeType` value');
  }
  const methodName = nodeTypeToMethodMap.get(node.nodeType);
  if (!cbObj[methodName]) {
    return undefined;
  }
  return cbObj[methodName](node, ...extraArgs);
}
function handleNode ( node , ... extraArgs ) { const cbObj = extraArgs [ extraArgs . length - 1 ] ; if ( ! nodeTypeToMethodMap . has ( node . nodeType ) ) { throw new TypeError ( 'Not a valid `nodeType` value' ) ; } const methodName = nodeTypeToMethodMap . get ( node . nodeType ) ; if ( ! cbObj [ methodName ] ) { return undefined ; } return cbObj [ methodName ] ( node , ... extraArgs ) ; }
Returns the value from executing a callback on a supplied callback
object according to the type of node supplied.
@param {Node} node An XML or HTML node
@param {Object} extraArgs Callback object whose properties–all optional
(`element`, `attribute`, `text`, `cdata`, `entityReference`, `entity`,
`processingInstruction`, `comment`, `document`, `documentType`,
`documentFragment`, `notation`) are callbacks which will be passed
the supplied arguments
@returns {any|void} The result of calling the relevant callback
(or `undefined` if no handler present)
Returns the value from executing a callback on a supplied callback object according to the type of node supplied .