Skip to content

Commit

Permalink
Merge pull request #79 from brettlangdon/update-readme
Browse files Browse the repository at this point in the history
Update readme
  • Loading branch information
jimfleming committed Jun 12, 2014
2 parents a0f8c89 + 1a84831 commit 1271496
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ Usage
```
$ jsfmt --help
Usage:
jsfmt [--no-format] [--diff|--list|--write] [--rewrite PATTERN|--search PATTERN] [<file>...]
jsfmt [--no-format] [--diff|--list|--write] [--validate] [--rewrite PATTERN|--search PATTERN] [--json] [<file>...]
jsfmt (--version | --help)
Options:
-h --help Show this help text
-v --version Show jsfmt version
--version Show jsfmt version
-d --diff Show diff against original file
-l --list List the files which differ from jsfmt output
-v --validate Validate the input file(s)
--no-format Do not format the input file(s)
-w --write Overwrite the original file with jsfmt output
-j --json Tell jsfmt that the file being parsed is json
-r=PATTERN --rewrite PATTERN Rewrite rule (e.g., 'a.slice(b, len(a) -> a.slice(b)')
-s=PATTERN --search PATTERN Search rule (e.g., 'a.slice')
```
Expand Down Expand Up @@ -95,6 +97,10 @@ API
jsfmt.format(<javascript_string>, <config_object>) // Returns formatted JavaScript
```

```javascript
jsfmt.formatJSON(<JSON_string>, <config_object>) // Returns formatted JSON
```

```javascript
var config = jsfmt.getConfig(); // Loads the jsfmt config from the appropriate rc file or default config object
```
Expand Down Expand Up @@ -153,6 +159,10 @@ jsfmt.search(js, "R.Component.create(a, { dependencies: z })").forEach(function(
jsfmt.validate(<javascript_string>) // Returns errors found while parsing JavaScript
```

```javascript
jsfmt.validateJSON(<JSON_string>) // Returns errors found while parsing JSON
```

#### Example

```javascript
Expand Down

0 comments on commit 1271496

Please sign in to comment.