function filterFields(groups, options) {
    return _.reduce(groups, function(_groups, group) {
        // Eliminate if non existant field
        if (_.contains(options.rejected || [], group.field)) return _groups;

        var fieldDef = options.fields[group.field] || {};

        // Convert type
        if (fieldDef.type) group.value = fieldDef.type (group.value);

        if (group) _groups.push(group);
        return _groups;
    }, []);
}
// Filter groups to eliminate and convert type of values based on the definition
Filter groups to eliminate and convert type of values based on the definition
Filter groups to eliminate and convert type of values based on the definition
function filterFields(groups, options) {
    return _.reduce(groups, function(_groups, group) {
        if (_.contains(options.rejected || [], group.field)) return _groups;
        var fieldDef = options.fields[group.field] || {};
        if (fieldDef.type) group.value = fieldDef.type (group.value);
        if (group) _groups.push(group);
        return _groups;
    }, []);
}
function filterFields ( groups , options ) { return _ . reduce ( groups , function ( _groups , group ) { if ( _ . contains ( options . rejected || [ ] , group . field ) ) return _groups ; var fieldDef = options . fields [ group . field ] || { } ; if ( fieldDef . type ) group . value = fieldDef . type ( group . value ) ; if ( group ) _groups . push ( group ) ; return _groups ; } , [ ] ) ; }
Filter groups to eliminate and convert type of values based on the definition
Filter groups to eliminate and convert type of values based on the definition
// Eliminate if non existant field // Convert type