How to use the cx/util.getSearchQueryPredicate function in cx

To help you get started, we’ve selected a few cx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codaxy / tdo / app / util / getAdvancedSearchQueryPredicate.js View on Github external
break;

            case 'NOT':
                if (opExpected)
                    fstr.push(" && ");
                fstr.push("!");
                opExpected = false;
                break;

            default:
                let x = p.trim();
                if (x) {
                    if (opExpected)
                        fstr.push(" && ");
                    fstr.push(`check('${x}', q)`);
                    checks[x] = getSearchQueryPredicate(x);
                    opExpected = true;
                }
                break;
        }
    }

    if (fstr.length == 1)
        return () => true;

    function check(word, query) {
        return checks[word](query)
    }

    try {
        let fbody = fstr.join('');
        //console.log(fbody);
github codaxy / tdo / app / util / getAdvancedSearchQueryPredicate.js View on Github external
}

    if (fstr.length == 1)
        return () => true;

    function check(word, query) {
        return checks[word](query)
    }

    try {
        let fbody = fstr.join('');
        //console.log(fbody);
        return new Function('check', 'q', fbody).bind(null, check);
    }
    catch (err) {
        return getSearchQueryPredicate(query);
    }
}
github codaxy / dashboards / app / routes / default / index.js View on Github external
onCreateFilter={filter => {
                                let predicate = getSearchQueryPredicate(filter);
                                return record => predicate(record.description);
                            }}
                        >