lib/TemplateBuilder.js
function _addMetasToDoc($, metaList) {
    if (!_.isArray(metaList) || metaList.length === 0) return;
    const $head = $('head');
    let lastMeta;
    const existingMetas = $head.find('meta');
    if (existingMetas.length > 0) {
        lastMeta = existingMetas.eq(existingMetas.length - 1);
    } else {
        lastMeta = HtmlParser.DOM.N_TAB + HtmlParser.DOM.getMetaElem(metaList[0]);
        lastMeta = $head.prepend(lastMeta).find('meta');
        metaList.shift(); // remove first
    }
    metaList.forEach(metaInfo => {
        const meta = HtmlParser.DOM.N_TAB + HtmlParser.DOM.getMetaElem(metaInfo);
        lastMeta = $(meta).insertAfter(lastMeta);
    });
}
function _addMetasToDoc($, metaList) {
    if (!_.isArray(metaList) || metaList.length === 0) return;
    const $head = $('head');
    let lastMeta;
    const existingMetas = $head.find('meta');
    if (existingMetas.length > 0) {
        lastMeta = existingMetas.eq(existingMetas.length - 1);
    } else {
        lastMeta = HtmlParser.DOM.N_TAB + HtmlParser.DOM.getMetaElem(metaList[0]);
        lastMeta = $head.prepend(lastMeta).find('meta');
        metaList.shift(); // remove first
    }
    metaList.forEach(metaInfo => {
        const meta = HtmlParser.DOM.N_TAB + HtmlParser.DOM.getMetaElem(metaInfo);
        lastMeta = $(meta).insertAfter(lastMeta);
    });
}
function _addMetasToDoc ( $ , metaList ) { if ( ! _ . isArray ( metaList ) || metaList . length === 0 ) return ; const $head = $ ( 'head' ) ; let lastMeta ; const existingMetas = $head . find ( 'meta' ) ; if ( existingMetas . length > 0 ) { lastMeta = existingMetas . eq ( existingMetas . length - 1 ) ; } else { lastMeta = HtmlParser . DOM . N_TAB + HtmlParser . DOM . getMetaElem ( metaList [ 0 ] ) ; lastMeta = $head . prepend ( lastMeta ) . find ( 'meta' ) ; metaList . shift ( ) ; // remove first } metaList . forEach ( metaInfo => { const meta = HtmlParser . DOM . N_TAB + HtmlParser . DOM . getMetaElem ( metaInfo ) ; lastMeta = $ ( meta ) . insertAfter ( lastMeta ) ; } ) ; }
-------------------------------- HELPER METHODS -------------------------------- 
Adds the given meta list to the current document of the given jQuery
instance.
@private

@param {jQuery} $ - jQuery instance.
@param {Array} metaList - List of arbitrary meta objects.
-------------------------------- HELPER METHODS -------------------------------- Adds the given meta list to the current document of the given jQuery instance . @private