Socket
Book a DemoInstallSign in
Socket

rewrite-js

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rewrite-js

CLI tool to transform javascript programs using falafel

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

rewrite-js

A CLI tool for transforming JavaScript input using falafel and cssauron. Works great with Vim!


# usage: rewrite-js [tranform-module, ...]
$ cat myfile.js | rewrite-js transform.js > myfile-transformed.js

Transformation modules should export and object mapping cssauron-falafel selectors to transformation functions.

// example transform
module.exports = {
  'call:contains(async) > function:last-child': rewrite_async_wrap
}

function rewrite_async_wrap(node) {
  node.parent.update(node.source())
}

// takes `async(function() { })` and rewrites it to `function() { }`

Installation

npm install -g rewrite-js

License

MIT

Keywords

cli

FAQs

Package last updated on 08 Dec 2015

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