Skip to content

Commit 1271496

Browse files
committed
Merge pull request #79 from brettlangdon/update-readme
Update readme
2 parents a0f8c89 + 1a84831 commit 1271496

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@ Usage
1919
```
2020
$ jsfmt --help
2121
Usage:
22-
jsfmt [--no-format] [--diff|--list|--write] [--rewrite PATTERN|--search PATTERN] [<file>...]
22+
jsfmt [--no-format] [--diff|--list|--write] [--validate] [--rewrite PATTERN|--search PATTERN] [--json] [<file>...]
2323
jsfmt (--version | --help)
2424
2525
Options:
2626
-h --help Show this help text
27-
-v --version Show jsfmt version
27+
--version Show jsfmt version
2828
-d --diff Show diff against original file
2929
-l --list List the files which differ from jsfmt output
30+
-v --validate Validate the input file(s)
3031
--no-format Do not format the input file(s)
3132
-w --write Overwrite the original file with jsfmt output
33+
-j --json Tell jsfmt that the file being parsed is json
3234
-r=PATTERN --rewrite PATTERN Rewrite rule (e.g., 'a.slice(b, len(a) -> a.slice(b)')
3335
-s=PATTERN --search PATTERN Search rule (e.g., 'a.slice')
3436
```
@@ -95,6 +97,10 @@ API
9597
jsfmt.format(<javascript_string>, <config_object>) // Returns formatted JavaScript
9698
```
9799

100+
```javascript
101+
jsfmt.formatJSON(<JSON_string>, <config_object>) // Returns formatted JSON
102+
```
103+
98104
```javascript
99105
var config = jsfmt.getConfig(); // Loads the jsfmt config from the appropriate rc file or default config object
100106
```
@@ -153,6 +159,10 @@ jsfmt.search(js, "R.Component.create(a, { dependencies: z })").forEach(function(
153159
jsfmt.validate(<javascript_string>) // Returns errors found while parsing JavaScript
154160
```
155161

162+
```javascript
163+
jsfmt.validateJSON(<JSON_string>) // Returns errors found while parsing JSON
164+
```
165+
156166
#### Example
157167

158168
```javascript

0 commit comments

Comments
 (0)