code-scrub
JS module code formatter per @HenrikJoreteg's preferences
Last updated 6 years ago by henrikjoreteg .
MIT · Original npm · Tarball · package.json
$ cnpm install code-scrub 
SYNC missed versions from official npm registry.

code-scrub

JS module code formatter per @HenrikJoreteg's preferences.

Mainly for personal use, but sharing if someone wants to use it.

install

cli usage:

$ npm install code-scrub -g
$ cat some.js | code-scrub

# can also pass options
$ cat some.js | code-scrub --indent=4

# or set options by creating `$HOME/.code-scrubrc` as a JSON (or INI) file with config options

# or if you're brave
$ code-scrub myfile.js

This will re-write the file in place with new style applied

api:

var fs = require('fs');
var scrub = require('code-scrub');

// read in some code
var code = fs.readFileSync('my.js', 'utf8');

// available options and their defaults
var scrubbed = scrub(code, {
    indent: 4,       // indent amount
    useTabs: false,  // indent type
    quotes: '\'',    // prefer single or double quotes
    ecmaVersion: 6   // version of ecma to be ok with
});

console.log(scrubbed);

credits

If you like this follow @HenrikJoreteg on twitter.

license

MIT

Current Tags

  • 1.0.2                                ...           latest (6 years ago)

3 Versions

  • 1.0.2                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 1
Last Month 3
Dependencies (6)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |