Use filters as is (Array) if passed as such via filter-arg
if Array.isArray filter-arg
filters = filter-arg
Would be so much easier to reason about than the current approach. Then you could also use the filter-regex and split etc. to generate such a filter structure to iterate instead...
Some initial ideas for refactoring this huge mess... way too many variables and too few functions.
Never have 100 line long deeply nested functions with dozens of local variables!! :O
For using grasp as a library and not simply for command line, it would be super useful if the following logic was changed:
PS: Super ugly/confusing code IMO, with all these nested if's and try/catch. Please let's improve the code!
Could we place make it into something like
And then if
filters-arg
is defined, iterate/extract each filter the Array of the form:Use filters as is (Array) if passed as such via
filter-arg
Would be so much easier to reason about than the current approach. Then you could also use the filter-regex and split etc. to generate such a filter structure to iterate instead...
Some initial ideas for refactoring this huge mess... way too many variables and too few functions. Never have 100 line long deeply nested functions with dozens of local variables!! :O