File tree Expand file tree Collapse file tree 1 file changed +19
-18
lines changed
Expand file tree Collapse file tree 1 file changed +19
-18
lines changed Original file line number Diff line number Diff line change 11const { Octokit } = require ( "@octokit/rest" ) ;
22const { throttling } = require ( "@octokit/plugin-throttling" ) ;
33
4+
5+ /* Filtering constants. */
6+ const attributeRgx = '([a-z]+)' ;
7+ const operatorRgx = '(<=|>=|[<=>])' ;
8+ const valueRgx = '([0-9]{4}-[0-9]{2}-[0-9]{2}|[0-9]+)' ;
9+ const regex = new RegExp ( attributeRgx + operatorRgx + valueRgx ) ;
10+ const mapTable = {
11+ 'ahead' : 'ahead_by' ,
12+ 'behind' : 'behind_by' ,
13+ 'pushed' : 'pushed_at' ,
14+ 'date' : 'pushed_at' ,
15+ 'd' : 'pushed_at' ,
16+ 'a' : 'ahead_by' ,
17+ 'b' : 'behind_by' ,
18+ 'p' : 'pushed_at' ,
19+ 's' : 'stars' ,
20+ 'f' : 'forks' ,
21+ } ;
22+
423/* Variables that should be cleared for every new query (defaults are set in "clear_old_data"). */
524let TABLE_DATA = [ ] ;
625let REPO_DATE ;
@@ -310,28 +329,10 @@ function updateFilterFunction() {
310329 return ;
311330 }
312331
313- const mapTable = {
314- 'ahead' : 'ahead_by' ,
315- 'behind' : 'behind_by' ,
316- 'pushed' : 'pushed_at' ,
317- 'date' : 'pushed_at' ,
318- 'd' : 'pushed_at' ,
319- 'a' : 'ahead_by' ,
320- 'b' : 'behind_by' ,
321- 'p' : 'pushed_at' ,
322- 's' : 'stars' ,
323- 'f' : 'forks' ,
324- } ;
325-
326332 // parse filter string into condition object
327333 const conditionStrList = filter . split ( ' ' ) ;
328334 let conditionObj = { } ;
329335 for ( const condition of conditionStrList ) {
330- const attributeRgx = '([a-z]+)' ;
331- const operatorRgx = '(<=|>=|[<=>])' ;
332- const valueRgx = '([0-9]{4}-[0-9]{2}-[0-9]{2}|[0-9]+)' ;
333- const regex = new RegExp ( attributeRgx + operatorRgx + valueRgx ) ;
334-
335336 const matchResult = condition . match ( regex ) ;
336337 let [ attribute , operator , value ] = matchResult ? matchResult . slice ( 1 ) : [ ] ;
337338 if ( ! attribute || ! operator || ! value ) {
You can’t perform that action at this time.
0 commit comments