Skip to content
This repository has been archived by the owner on Mar 22, 2018. It is now read-only.

Commit

Permalink
implementation #132
Browse files Browse the repository at this point in the history
  • Loading branch information
arafato committed Mar 14, 2018
1 parent 3520da4 commit 95c5268
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/model/table/AzuriteTableRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,22 @@ class AzuriteTableRequest {
.replace(/\bne\b/g, '!==')
.replace(/\band\b/g, '&&')
.replace(/\bor\b/g, '||')
.replace(/\bnot\b/g, '!');
.replace(/\(/g, ' ( ')
.replace(/\)/g, ' ) ')
.replace(/\bnot\b/g, ' ! ');

// If a token is neither a number, nor a boolean, nor a string enclosed with quotation marks it is an operand.
// Operands are attributes of the object used within the where clause of LokiJS, thus we need to prepend each
// attribute with an object identifier 'item.attribs'.
let transformedQuery = '';
for (const token of filter.split(' ')) {
if (token === '') {
continue;
}
if (!token.match(/\d+/) &&
token !== 'true' && token !== 'false' &&
!token.includes('`') &&
!['===', '>', '>=', '<', '<=', '!==', '&&', '||', '!'].includes(token)) {
!['===', '>', '>=', '<', '<=', '!==', '&&', '||', '!', '(', ')'].includes(token)) {
if (token === 'PartitionKey' || token === 'RowKey') {
transformedQuery += `item.${token} `;
} else {
Expand Down

0 comments on commit 95c5268

Please sign in to comment.