lib/filter.js
function _filter(data, schema) {
    if (typeof data !== 'object' ||
        data === null ||
        schema === null) {
        return data;
    }
    if (schema instanceof Array) {
        return _filterByArraySchema(data, schema);
    }
    if (typeof schema === 'object') {
        return _filterByObjectSchema(data, schema);
    }
    return data;
}
function _filter(data, schema) {
    if (typeof data !== 'object' ||
        data === null ||
        schema === null) {
        return data;
    }
    if (schema instanceof Array) {
        return _filterByArraySchema(data, schema);
    }
    if (typeof schema === 'object') {
        return _filterByObjectSchema(data, schema);
    }
    return data;
}
function _filter ( data , schema ) { if ( typeof data !== 'object' || data === null || schema === null ) { return data ; } if ( schema instanceof Array ) { return _filterByArraySchema ( data , schema ) ; } if ( typeof schema === 'object' ) { return _filterByObjectSchema ( data , schema ) ; } return data ; }
private 
Returns a new object with fields from data and present in the given schema
@param data Object to filter
@param schema Fields to keep
@returns {*}
@private
private Returns a new object with fields from data and present in the given schema