From 99df28542530c3ec0da6b311793e1bb43f7a870a Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 21 May 2020 15:20:20 +0200 Subject: [PATCH] bit filters --- packages/filterparser/src/parseFilter.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/filterparser/src/parseFilter.ts b/packages/filterparser/src/parseFilter.ts index f6a24d53e..655ec04dc 100644 --- a/packages/filterparser/src/parseFilter.ts +++ b/packages/filterparser/src/parseFilter.ts @@ -135,6 +135,8 @@ const createParser = (filterType: FilterType) => { notEmpty: (r) => r.not.then(r.empty).map(unaryCondition('isNotEmpty')), true: () => word('TRUE').map(binaryFixedValueCondition(1)), false: () => word('FALSE').map(binaryFixedValueCondition(0)), + trueNum: () => word('1').map(binaryFixedValueCondition(1)), + falseNum: () => word('0').map(binaryFixedValueCondition(0)), eq: (r) => word('=').then(r.value).map(binaryCondition('=')), ne: (r) => word('!=').then(r.value).map(binaryCondition('<>')), lt: (r) => word('<').then(r.value).map(binaryCondition('<')), @@ -170,7 +172,7 @@ const createParser = (filterType: FilterType) => { 'endsWithNot', 'containsNot' ); - if (filterType == 'logical') allowedElements.push('true', 'false'); + if (filterType == 'logical') allowedElements.push('true', 'false', 'trueNum', 'falseNum'); // must be last if (filterType == 'string') allowedElements.push('valueTestStr');