18559: Remove dead code
[arvados-workbench2.git] / src / store / search-bar / search-query / arv-parser.ts
index c9b7024b921ecb4e1c232779df420ce25c1fa34b..5331d2a19d011024de3c1127ed9f339d28c28976 100644 (file)
@@ -3,7 +3,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as parser from '~/store/search-bar/search-query/parser';
+import * as parser from 'store/search-bar/search-query/parser';
 
 interface Property {
     key: string;
@@ -20,7 +20,8 @@ export enum Keywords {
 }
 
 export enum States {
-    TRASHED = 'trashed'
+    TRASHED = 'trashed',
+    PAST_VERSION = 'pastVersion'
 }
 
 const keyValuePattern = (key: string) => new RegExp(`${key}:([^ ]*)`);
@@ -60,12 +61,16 @@ export const getProperties = (tokens: string[]) =>
     }, [] as Property[]);
 
 
-export const isTrashed = (tokens: string[]) => {
+export const isTrashed = (tokens: string[]) => isSomeState(States.TRASHED, tokens);
+
+export const isPastVersion = (tokens: string[]) => isSomeState(States.PAST_VERSION, tokens);
+
+const isSomeState = (state: string, tokens: string[]) => {
     for (const token of tokens) {
         const match = token.match(keyValuePattern(Keywords.IS)) || ['', ''];
         if (match) {
             const [, value] = match;
-            if(value === States.TRASHED) {
+            if(value === state) {
                 return true;
             }
         }