
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Query esprima ASTs by using a chainable query syntax.
npm install esprimaq
var find = require('esprimaq');
Find function calls of the mongo
function:
var syntax = esprima.parse("mongo('hello');", {tolerant: true});
var result = find(syntax).callFn('mongo').exec();
assert.equal('hello', result[0].arguments[0].value);
Find variable declarations of x
:
var syntax = esprima.parse("var x = 5;", {tolerant: true});
var result = find(syntax).varDecl('x').exec();
assert.equal('5', result[0].init.value);
Find calls to hello.bye
:
var syntax = esprima.parse("hello.bye(w00t);", {tolerant: true});
var result = find(syntax).callMethod('hello', 'bye').exec();
assert.equal('w00t', result[0].arguments[0].name);
Find calls using this
:
var syntax = esprima.parse('this.foo(bar);', {tolerant: true});
var result = find(syntax).callThisMethod('foo').exec();
assert.equal('bar', result[0].arguments[0].name);
AND
in queriesI wanted a simpler and CSS-selector-free alternative to query esprima ASTs.
Yes, check these projects:
callThisMethod
, fnExpressions
and identifiers
filters.(The MIT License)
Copyright (c) 2014-2016 Alberto Pose < albertopose at gmail.com >
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Query esprima ASTs by using a chainable query syntax.
The npm package esprimaq receives a total of 1,950 weekly downloads. As such, esprimaq popularity was classified as popular.
We found that esprimaq demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.