lib/api.js
function match (expression, cb) {
  return Array.isArray(expression)
    ? traverse(this, function (node) {
      for (var i = 0; i < expression.length; i++) {
        if (compare(expression[i], node)) return cb(node)
      }

      return node
    })
    : traverse(this, function (node) {
      if (compare(expression, node)) return cb(node)

      return node
    })
}
function match (expression, cb) {
  return Array.isArray(expression)
    ? traverse(this, function (node) {
      for (var i = 0; i < expression.length; i++) {
        if (compare(expression[i], node)) return cb(node)
      }

      return node
    })
    : traverse(this, function (node) {
      if (compare(expression, node)) return cb(node)

      return node
    })
}
function match ( expression , cb ) { return Array . isArray ( expression ) ? traverse ( this , function ( node ) { for ( var i = 0 ; i < expression . length ; i ++ ) { if ( compare ( expression [ i ] , node ) ) return cb ( node ) } return node } ) : traverse ( this , function ( node ) { if ( compare ( expression , node ) ) return cb ( node ) return node } ) }
Matches an expression to search for nodes in the tree

@memberof tree

@param  {String|RegExp|Object|Array} expression - Matcher(s) to search
@param  {Function} cb Callback

@return {Function} Callback(node)

@example
```js
export const match = (tree) => {
// Single matcher
tree.match({ tag: 'custom-tag' }, (node) => {
let tag = node.tag

Object.assign(node, { tag: 'div', attrs: {class: tag} })

return node
})
// Multiple matchers
tree.match([{ tag: 'b' }, { tag: 'strong' }], (node) => {
let style = 'font-weight: bold;'

node.tag = 'span'

node.attrs
? ( node.attrs.style
? ( node.attrs.style += style )
: node.attrs.style = style
)
: node.attrs = { style: style }

return node
})
}
```
Matches an expression to search for nodes in the tree