packages/okam-build/lib/processor/template/index.js
function mergeVisitors(plugins) {
    let result = {};
    plugins.forEach(item => {
        let transform = item;
        let options;
        if (Array.isArray(item)) {
            [transform, options] = item;
        }

        typeof transform === 'string' && (transform = require(transform));

        Object.keys(transform).forEach(type => {
            let visitor = transform[type];
            let list = result[type];
            list || (list = result[type] = []);
            list.push([
                visitor, options
            ]);
        });
    });

    return result;
}
function mergeVisitors(plugins) {
    let result = {};
    plugins.forEach(item => {
        let transform = item;
        let options;
        if (Array.isArray(item)) {
            [transform, options] = item;
        }

        typeof transform === 'string' && (transform = require(transform));

        Object.keys(transform).forEach(type => {
            let visitor = transform[type];
            let list = result[type];
            list || (list = result[type] = []);
            list.push([
                visitor, options
            ]);
        });
    });

    return result;
}
Merge the plugin visitors by the visited node type.
e.g., [ [transform, options], [transform, options] ]
=> {tag: [ [tagVisitor, options], [tagVisitor, options] ]}

@inner
@param {Array.<Object>} plugins the plugins to merge
@return {Object}