JSFiddle - React, Tailwind, and code Playground

by swoogie

HTML

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

JavaScript

_.mixin({
    //If you would like to know how these functions word, read the docs.
    isSet: function (e) {
        return (_.isArray(e) && (_.filter(e, function (x) {
            return (x[0] !== "")
        }).length > 0)) || (_.isString(e) && e.length > 0);
    }
});
var metaInsert = function (name, content) {
    console.log("called", Date.now());
    $("head").append($('<meta>', {
        name: name,
        content: content
    }));
},
handler = function (prefix, dataSet) {
    _.each(dataSet, function (data, key) {
        if (_.isSet(data.value)) {
            if (data.delimiter) {
                data.value = data.value.join(data.delimiter);
            }
            metaInsert(prefix + "." + key, data.value);
        }
    });
};

handler("WT", {
    cg_n: {
        value: [
            ['hi'],
            ['hello']
        ],
        delimiter: ";"
    },
    cg_s: {
        value: "##WEBTRENDS_WT_CG_S##"
    }
});