We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I would expect this to work:
echo "let a=10,o={a}" | grasp 'prop[shorthand=true]'
$ echo "let a=10,o={a}" | acorn { "type": "Program", "start": 0, "end": 15, "body": [ { "type": "VariableDeclaration", "start": 0, "end": 14, "declarations": [ { "type": "VariableDeclarator", "start": 4, "end": 8, "id": { "type": "Identifier", "start": 4, "end": 5, "name": "a" }, "init": { "type": "Literal", "start": 6, "end": 8, "value": 10, "raw": "10" } }, { "type": "VariableDeclarator", "start": 9, "end": 14, "id": { "type": "Identifier", "start": 9, "end": 10, "name": "o" }, "init": { "type": "ObjectExpression", "start": 11, "end": 14, "properties": [ { "type": "Property", "start": 12, "end": 13, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 12, "end": 13, "name": "a" }, "kind": "init", "value": { "type": "Identifier", "start": 12, "end": 13, "name": "a" } } ] } } ], "kind": "let" } ], "sourceType": "script" }
The text was updated successfully, but these errors were encountered:
Your (s)query is (wrongly??) interpreted as compound attribute. That's why it does not match. See the docs https://www.graspjs.com/docs/squery/.
If you want to only match primitive attributes, you can add a & before your attribute name, eg. [&value=2].
I am not sure if this is a bug or feature, but if you use this syntax, it works. echo "let a=10,o={a}" | grasp 'prop[&shorthand=true]'
echo "let a=10,o={a}" | grasp 'prop[&shorthand=true]'
Sorry, something went wrong.
No branches or pull requests
I would expect this to work:
echo "let a=10,o={a}" | grasp 'prop[shorthand=true]'
$ echo "let a=10,o={a}" | acorn
{
"type": "Program",
"start": 0,
"end": 15,
"body": [
{
"type": "VariableDeclaration",
"start": 0,
"end": 14,
"declarations": [
{
"type": "VariableDeclarator",
"start": 4,
"end": 8,
"id": {
"type": "Identifier",
"start": 4,
"end": 5,
"name": "a"
},
"init": {
"type": "Literal",
"start": 6,
"end": 8,
"value": 10,
"raw": "10"
}
},
{
"type": "VariableDeclarator",
"start": 9,
"end": 14,
"id": {
"type": "Identifier",
"start": 9,
"end": 10,
"name": "o"
},
"init": {
"type": "ObjectExpression",
"start": 11,
"end": 14,
"properties": [
{
"type": "Property",
"start": 12,
"end": 13,
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 12,
"end": 13,
"name": "a"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 12,
"end": 13,
"name": "a"
}
}
]
}
}
],
"kind": "let"
}
],
"sourceType": "script"
}
The text was updated successfully, but these errors were encountered: