lib/widgets.js
function (type) {
    return function (opts) {
        var opt = opts || {};
        var userAttrs = getUserAttrs(opt);
        var w = {
            classes: opt.classes,
            type: type,
            formatValue: function (value) {
                return (value || value === 0) ? value : null;
            }
        };
        w.toHTML = function (name, field) {
            var f = field || {};
            var attrs = {
                type: type,
                name: name,
                id: f.id === false ? false : (f.id || true),
                classes: w.classes,
                value: w.formatValue(f.value)
            };
            return tag('input', [attrs, userAttrs, w.attrs || {}]);
        };
        return w;
    };
}
function (type) {
    return function (opts) {
        var opt = opts || {};
        var userAttrs = getUserAttrs(opt);
        var w = {
            classes: opt.classes,
            type: type,
            formatValue: function (value) {
                return (value || value === 0) ? value : null;
            }
        };
        w.toHTML = function (name, field) {
            var f = field || {};
            var attrs = {
                type: type,
                name: name,
                id: f.id === false ? false : (f.id || true),
                classes: w.classes,
                value: w.formatValue(f.value)
            };
            return tag('input', [attrs, userAttrs, w.attrs || {}]);
        };
        return w;
    };
}
function ( type ) { return function ( opts ) { var opt = opts || { } ; var userAttrs = getUserAttrs ( opt ) ; var w = { classes : opt . classes , type : type , formatValue : function ( value ) { return ( value || value === 0 ) ? value : null ; } } ; w . toHTML = function ( name , field ) { var f = field || { } ; var attrs = { type : type , name : name , id : f . id === false ? false : ( f . id || true ) , classes : w . classes , value : w . formatValue ( f . value ) } ; return tag ( 'input' , [ attrs , userAttrs , w . attrs || { } ] ) ; } ; return w ; } ; }
used to generate different input elements varying only by type attribute
used to generate different input elements varying only by type attribute