lib/jyt.plugins.js
function init() {

    // ex. jif(true, div('blah'))
    registerPlugin('jif', function jif(condition, elem) {
        if (utils.isArray(elem)) {
            elem = runtime.naked(elem, null);
        }

        return condition ? elem : null;
    });

    // ex. jeach({}, function (item) {})
    registerPlugin('jeach', function jeach(items, cb) {
        if (!items || !cb) { return null; }

        var ret = [];
        for (var i = 0, len = items.length; i < len; ++i) {
            ret.push(cb(items[i]));
        }

        return ret;
    });
}
function init() {

    // ex. jif(true, div('blah'))
    registerPlugin('jif', function jif(condition, elem) {
        if (utils.isArray(elem)) {
            elem = runtime.naked(elem, null);
        }

        return condition ? elem : null;
    });

    // ex. jeach({}, function (item) {})
    registerPlugin('jeach', function jeach(items, cb) {
        if (!items || !cb) { return null; }

        var ret = [];
        for (var i = 0, len = items.length; i < len; ++i) {
            ret.push(cb(items[i]));
        }

        return ret;
    });
}
function init ( ) { // ex. jif(true, div('blah')) registerPlugin ( 'jif' , function jif ( condition , elem ) { if ( utils . isArray ( elem ) ) { elem = runtime . naked ( elem , null ) ; } return condition ? elem : null ; } ) ; // ex. jeach({}, function (item) {}) registerPlugin ( 'jeach' , function jeach ( items , cb ) { if ( ! items || ! cb ) { return null ; } var ret = [ ] ; for ( var i = 0 , len = items . length ; i < len ; ++ i ) { ret . push ( cb ( items [ i ] ) ) ; } return ret ; } ) ; }
Register common plugins
Register common plugins