Closed zArubaru closed 4 years ago
Look under "Attributes" on http://www.graspjs.com/docs/squery/
For primitive attributes, you can use either of those, or the < less than, > greater than, <= less than or equal to, >= greater to or equal to, or
~=
regex test operators. For example, [value<2] matches the literals 1 and 0. [value~=/^hi/] matches the literal "hi there".
Thank you,
I re-read that part a few times, but for some reason it didn't register that I literally need to use value
.
Thus, for future reference, here is the solution:
import-dec[source.value~=/^common/]
And maybe the following will also help someone, I was trying to select an imported specifier:
import-dec[source.value~=/^common/] > import-specifier[local=#logger]
For example, if my file contains this line:
import { logger } from 'common-components/util/logger';
I can match it with:
grasp 'import-dec[source="common-components/util/logger"]
I would like to be able to do something like this:
grasp 'import-dec[source=/^common/]
grasp 'import-dec[source^="common"]
I tried a few different approaches, but couldn't get them to work.