JSFiddle - React, Tailwind, and code Playground
JavaScript
var words = [
'fjijfjjoij',
'fjijfjjoij',
'fjijfjjoij',
'fjijfjjoij',
'fjijfjjoijfijopboihgjADSVFADSFVAioajvFDASVFadjvadosjnvajfdsdsanldsajfFVAVfvajnvoa',
'fjijfabckfdafajfpajfpafavaopfmajjoij',
'YTOUERHGBKNFLKSDNBFREWLJGRFVKSFADAFAODJAFKASV<ADSFADNVVBSB<FGQPERPQRANKBA',
'FMDAFMALDNVAFNf vasfabddhvovbffvoiawvhfaoivfao fvaofhe feiuvfioqvhifvio fviqoefviov iofvqifvofvioqfvfvoiqwfvahv afvaofvldsafvladskfha fvdvvadljkvsdfhalvk lvl',
'abc',
'bcd',
'hoge',
'fuga',
'aaa',
'fda',
'MFDAK'
];
var tree = {
type: 'and',
children: [
{
type: 'or',
children: [
{fn: x => /abc/.test(x)},
{fn: x => /bcd/.test(x)},
{fn: x => /hoge/.test(x)},
{fn: x => /fuga/.test(x)},
{fn: x => /aaa/.test(x)},
{fn: x => /fda/.test(x)},
]
},
{
type: 'or',
children: [
{fn: x => /ABC/.test(x)},
{fn: x => /DEF/.test(x)},
{fn: x => /A/.test(x)},
{fn: x => /D/.test(x)},
{fn: x => /FFDA/.test(x)},
{fn: x => /MFDAK/.test(x)},
]
},
{
type: 'and',
children: [
{
type: 'and',
children: [
{
type: 'and',
children: [
{
type: 'or',
children: [
{
type: 'and',
children: [
{fn: x => x.length < 100},
{fn: x => x.length > 20},
]
},
{
type: 'and',
children: [
{fn: x => x.length < 200},
{fn: x => x.length > 150},
]
}
]
}
]
}
]
}
]
}
]
};
var BINARY_LOGICAL_OPERATORS_TABLE = {
and: '&&',
or: '||'
};
function filter1(tree, x)...