New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ast-grep

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ast-grep

Like grep, but more powerful than you can possibly imagine.

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

ast-grep

Travis Prettier npm semantic-release License

Like grep, but more powerful than you can possibly imagine.

Search your JavaScript files for patterns based on AST shape, rather than substrings or regular expressions.

Install

With yarn:

yarn global add ast-grep

With npm:

npm install --global ast-grep

Usage

$ ast-grep --help
Options:
  --anonymous, -a  Ignore all names in the AST                         [boolean]
  --file, -f       Load pattern from a file                             [string]
  --help           Show help                                           [boolean]
  --version        Show version number                                 [boolean]

Examples:
  ast-grep.js -a 'fn()' file.js        Find all no-arg function calls in
                                       'file.js'.
  ast-grep.js -f pattern.js '**/*.js'  Match the pattern in 'pattern.js' across
                                       all JS files.
  echo 'foo' | ast-grep.js 'pattern'   Match 'pattern' on standard input.

On standard in:

$ echo 'code();' | ast-grep 'code'
code();
$ ast-grep 'foo()' < file.js
foo();

On a set of files:

$ ast-grep 'yield* foo();' '**/*.js'

FAQ

Q. But @azz, grep stands for Global Regular Expression Print, this tool doesn't use Regular Expressions!

A. I know, but gastp doesn't sound great.

FAQs

Package last updated on 14 Jan 2018

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc