node/adapter/array.js
function checkFilter(filter, type, test, real) {
    if (type == Table.TYPE_DATETIME) {
        if (typeof real != 'object')
            real = new Date(real * 1000);
        if (filter == Table.FILTER_BETWEEN
                && Array.isArray(test) && test.length == 2) {
            test = [
                test[0] ? moment.unix(test[0]) : null,
                test[1] ? moment.unix(test[1]) : null,
            ];
        } else if (filter != Table.FILTER_BETWEEN) {
            test = moment.unix(test);
        } else {
            return null;
        }
    } else {
        if (filter == Table.FILTER_BETWEEN) {
            if (!Array.isArray(test) || test.length != 2)
                return null;
        }
    }

    switch (filter) {
        case Table.FILTER_LIKE:
            return real !== null && real.indexOf(test) != -1;
        case Table.FILTER_EQUAL:
            return real !== null && test == real;
        case Table.FILTER_BETWEEN:
            if (real === null)
                return false;
            if (test[0] !== null && real < test[0])
                return false;
            if (test[1] !== null && real > test[1])
                return false;
            return true;
        case Table.FILTER_NULL:
            return real === null;
        default:
            throw new Error("Unknown filter: " + filter);
    }

    return false;
}
function checkFilter(filter, type, test, real) {
    if (type == Table.TYPE_DATETIME) {
        if (typeof real != 'object')
            real = new Date(real * 1000);
        if (filter == Table.FILTER_BETWEEN
                && Array.isArray(test) && test.length == 2) {
            test = [
                test[0] ? moment.unix(test[0]) : null,
                test[1] ? moment.unix(test[1]) : null,
            ];
        } else if (filter != Table.FILTER_BETWEEN) {
            test = moment.unix(test);
        } else {
            return null;
        }
    } else {
        if (filter == Table.FILTER_BETWEEN) {
            if (!Array.isArray(test) || test.length != 2)
                return null;
        }
    }

    switch (filter) {
        case Table.FILTER_LIKE:
            return real !== null && real.indexOf(test) != -1;
        case Table.FILTER_EQUAL:
            return real !== null && test == real;
        case Table.FILTER_BETWEEN:
            if (real === null)
                return false;
            if (test[0] !== null && real < test[0])
                return false;
            if (test[1] !== null && real > test[1])
                return false;
            return true;
        case Table.FILTER_NULL:
            return real === null;
        default:
            throw new Error("Unknown filter: " + filter);
    }

    return false;
}
function checkFilter ( filter , type , test , real ) { if ( type == Table . TYPE_DATETIME ) { if ( typeof real != 'object' ) real = new Date ( real * 1000 ) ; if ( filter == Table . FILTER_BETWEEN && Array . isArray ( test ) && test . length == 2 ) { test = [ test [ 0 ] ? moment . unix ( test [ 0 ] ) : null , test [ 1 ] ? moment . unix ( test [ 1 ] ) : null , ] ; } else if ( filter != Table . FILTER_BETWEEN ) { test = moment . unix ( test ) ; } else { return null ; } } else { if ( filter == Table . FILTER_BETWEEN ) { if ( ! Array . isArray ( test ) || test . length != 2 ) return null ; } } switch ( filter ) { case Table . FILTER_LIKE : return real !== null && real . indexOf ( test ) != - 1 ; case Table . FILTER_EQUAL : return real !== null && test == real ; case Table . FILTER_BETWEEN : if ( real === null ) return false ; if ( test [ 0 ] !== null && real < test [ 0 ] ) return false ; if ( test [ 1 ] !== null && real > test [ 1 ] ) return false ; return true ; case Table . FILTER_NULL : return real === null ; default : throw new Error ( "Unknown filter: " + filter ) ; } return false ; }
Check and apply filter

@param {string} filter
@param {string} type
@param {*} test
@param {*} real
Check and apply filter