Grasp 0.4.0 released with ES6 support!

29 December 2015 - George Zahariev

ES6 support!

Grasp 0.4.0 has been released with ES6 support!

Grasp is a command line utility that allows you to search and replace your JavaScript code - but unlike programs such as grep or sed it searches the structure behind your code (the abstract syntax tree), rather than simply the text you’ve written.

Grasp now uses the latest version of the Acorn parser, and supports ES6/ES2015 code.

For example, you can quickly find all the import sources in your app, you could use:

$ grasp 'import-dec.source' file.js

If file.js was

import * as x from 'lib';
import {y, z} from 'foo';
...

You would get:

$ grasp 'import-dec.source' file.js
1:import * as x from 'lib';
2:import {y, z} from 'foo';

For all the different possiblities, check out the JavaScript syntax documentation.

Parser Options

You can also supply your own parser and parser options if you wish using the --parser option. Its default value is (acorn, {locations: true, ecmaVersion: 6, sourceType: 'module', allowHashBang: true}) see the options documentation for more information. Using this option you could, for example, attempt to use a parser supporting JSX.

Install/Update

Install with npm install -g grasp (or see install page).

Update with npm update -g grasp.

More

Check out the main site, the demo, the quick start guide, and the documentation!

Questions? Comments? Post an issue in the GitHub issues section.

For updates on Grasp including new blog posts follow: 

Share this post: 

comments powered by Disqus