/* eslint-disable fecs-min-vars-per-destructure 
Find the matched transformer

@inner
@param {Array} transformers the transformers
@param {string} value the element name or attribute name or text node data to match
@param {string|Object} matchItem the element or attribute name or text node item to match
@return {?Object}
function findMatchTransformer(transformers, value, matchItem) {
    if (!value) {
        return;
    }

    let found;
    transformers.some(item => {
        let match = item.match;
        let isMatch = false;
        let type = typeof match;
        if (type === 'string') {
            isMatch = match === value;
        }
        else if (type === 'function') {
            isMatch = match(matchItem);
        }
        else {
            // default RegExp
            isMatch = match.test('' + value);
        }

        if (isMatch) {
            found = item.transform;
        }
        return isMatch;
    });

    return found;
}