lib/util.js
function createFilter(jsonQuery) {
    if ('function' === typeof jsonQuery) return jsonQuery;
    if ((!jsonQuery) || (Object.keys(jsonQuery).length === 0)) {
        return () => true;
    }
    jsonQuery = Object.assign({}, jsonQuery); // protect against side effects
    return function(obj) {
        for (let key of Object.keys(jsonQuery)) {
            if (! Object.is(obj[key], jsonQuery[key])) return false;
        }
        return true;
    };
}
function createFilter(jsonQuery) {
    if ('function' === typeof jsonQuery) return jsonQuery;
    if ((!jsonQuery) || (Object.keys(jsonQuery).length === 0)) {
        return () => true;
    }
    jsonQuery = Object.assign({}, jsonQuery); // protect against side effects
    return function(obj) {
        for (let key of Object.keys(jsonQuery)) {
            if (! Object.is(obj[key], jsonQuery[key])) return false;
        }
        return true;
    };
}
function createFilter ( jsonQuery ) { if ( 'function' === typeof jsonQuery ) return jsonQuery ; if ( ( ! jsonQuery ) || ( Object . keys ( jsonQuery ) . length === 0 ) ) { return ( ) => true ; } jsonQuery = Object . assign ( { } , jsonQuery ) ; // protect against side effects return function ( obj ) { for ( let key of Object . keys ( jsonQuery ) ) { if ( ! Object . is ( obj [ key ] , jsonQuery [ key ] ) ) return false ; } return true ; } ; }
Turns the given JSON object into a filter function.

@param {object} [jsonQuery] - An object specifying properties and values
that an object has to match in order to pass the filter. If
omitted, or if the object has no keys, any object will pass the
generated filter.
@returns {function} the generated filter function, accepts an object as
argument and returns true if it passes the filter and false
otherwise.
@memberof module:lib/util
Turns the given JSON object into a filter function .