lib/modelValidator/lib/modelValidator.js
function (values, schema) {

    var publicList = find(schema, 'public')
        , arrElem;

    for (var value in values) {
        if (publicList[value]) {
            if (_.isArray(publicList[value])) {
                for (var thisArrayElem in publicList[value]) {

                    if (!_.isArray(values[value])) {
                        // Delete values due to it should be an array defined in schema
                        delete(values[value]);
                    }
                    else {
                        for (var thisValue in values[value]) {
                            values[value][thisValue] = unsetPublicSet(values[value][thisValue], publicList[value][thisArrayElem]);

                            if (_.isEmpty(values[value][thisValue])) {
                                (values[value]).splice(thisValue);
                            }
                        }

                        if (_.isEmpty(values[value])) {
                            delete(values[value]);
                        }
                    }
                }
            }
            else {
                if (publicList[value].public) {
                    if (publicList[value].public == false || (publicList[value].public.hasOwnProperty('set') && publicList[value].public.set != true)) {
                        delete(values[value]);
                    }
                }
            }
        }
    }
    return values;
}
function (values, schema) {

    var publicList = find(schema, 'public')
        , arrElem;

    for (var value in values) {
        if (publicList[value]) {
            if (_.isArray(publicList[value])) {
                for (var thisArrayElem in publicList[value]) {

                    if (!_.isArray(values[value])) {
                        // Delete values due to it should be an array defined in schema
                        delete(values[value]);
                    }
                    else {
                        for (var thisValue in values[value]) {
                            values[value][thisValue] = unsetPublicSet(values[value][thisValue], publicList[value][thisArrayElem]);

                            if (_.isEmpty(values[value][thisValue])) {
                                (values[value]).splice(thisValue);
                            }
                        }

                        if (_.isEmpty(values[value])) {
                            delete(values[value]);
                        }
                    }
                }
            }
            else {
                if (publicList[value].public) {
                    if (publicList[value].public == false || (publicList[value].public.hasOwnProperty('set') && publicList[value].public.set != true)) {
                        delete(values[value]);
                    }
                }
            }
        }
    }
    return values;
}
function ( values , schema ) { var publicList = find ( schema , 'public' ) , arrElem ; for ( var value in values ) { if ( publicList [ value ] ) { if ( _ . isArray ( publicList [ value ] ) ) { for ( var thisArrayElem in publicList [ value ] ) { if ( ! _ . isArray ( values [ value ] ) ) { // Delete values due to it should be an array defined in schema delete ( values [ value ] ) ; } else { for ( var thisValue in values [ value ] ) { values [ value ] [ thisValue ] = unsetPublicSet ( values [ value ] [ thisValue ] , publicList [ value ] [ thisArrayElem ] ) ; if ( _ . isEmpty ( values [ value ] [ thisValue ] ) ) { ( values [ value ] ) . splice ( thisValue ) ; } } if ( _ . isEmpty ( values [ value ] ) ) { delete ( values [ value ] ) ; } } } } else { if ( publicList [ value ] . public ) { if ( publicList [ value ] . public == false || ( publicList [ value ] . public . hasOwnProperty ( 'set' ) && publicList [ value ] . public . set != true ) ) { delete ( values [ value ] ) ; } } } } } return values ; }
Remove values where schema setting public.set false
@param values
@param schema
@returns {*}
Remove values where schema setting public . set false