packages/mdast-util-to-bemjson/lib/traverse.js
function traverse(transform, node, parent) {
    const type = node && node.type;
    assert(type, `Expected node, got '${node}'`);

    const baseHandler = transform.handlers[type] || transform.handlers.default;
    const userHandler = transform.userHandlers[type] || transform.userHandlers.default;
    const starHandler = transform.userHandlers['*'];
    const userBaseHandler = userHandler ? userHandler.bind({ __base: baseHandler }) : baseHandler;

    const handler = starHandler ? starHandler.bind({ __base: userBaseHandler }) : userBaseHandler;

    return handler(transform, node, parent);
}
function traverse(transform, node, parent) {
    const type = node && node.type;
    assert(type, `Expected node, got '${node}'`);

    const baseHandler = transform.handlers[type] || transform.handlers.default;
    const userHandler = transform.userHandlers[type] || transform.userHandlers.default;
    const starHandler = transform.userHandlers['*'];
    const userBaseHandler = userHandler ? userHandler.bind({ __base: baseHandler }) : baseHandler;

    const handler = starHandler ? starHandler.bind({ __base: userBaseHandler }) : userBaseHandler;

    return handler(transform, node, parent);
}
function traverse ( transform , node , parent ) { const type = node && node . type ; assert ( type , ` ${ node } ` ) ; const baseHandler = transform . handlers [ type ] || transform . handlers . default ; const userHandler = transform . userHandlers [ type ] || transform . userHandlers . default ; const starHandler = transform . userHandlers [ '*' ] ; const userBaseHandler = userHandler ? userHandler . bind ( { __base : baseHandler } ) : baseHandler ; const handler = starHandler ? starHandler . bind ( { __base : userBaseHandler } ) : userBaseHandler ; return handler ( transform , node , parent ) ; }
Traverse MDAST tree

@param {*} transform - transform function
@param {Object} node - MDAST node
@param {Object} [parent] - MDAST parent node
@returns {*}
Traverse MDAST tree