@@ -19,16 +19,18 @@ Usage
19
19
```
20
20
$ jsfmt --help
21
21
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>...]
23
23
jsfmt (--version | --help)
24
24
25
25
Options:
26
26
-h --help Show this help text
27
- -v -- version Show jsfmt version
27
+ -- version Show jsfmt version
28
28
-d --diff Show diff against original file
29
29
-l --list List the files which differ from jsfmt output
30
+ -v --validate Validate the input file(s)
30
31
--no-format Do not format the input file(s)
31
32
-w --write Overwrite the original file with jsfmt output
33
+ -j --json Tell jsfmt that the file being parsed is json
32
34
-r=PATTERN --rewrite PATTERN Rewrite rule (e.g., 'a.slice(b, len(a) -> a.slice(b)')
33
35
-s=PATTERN --search PATTERN Search rule (e.g., 'a.slice')
34
36
```
95
97
jsfmt .format (< javascript_string> , < config_object> ) // Returns formatted JavaScript
96
98
```
97
99
100
+ ``` javascript
101
+ jsfmt .formatJSON (< JSON_string> , < config_object> ) // Returns formatted JSON
102
+ ```
103
+
98
104
``` javascript
99
105
var config = jsfmt .getConfig (); // Loads the jsfmt config from the appropriate rc file or default config object
100
106
```
@@ -153,6 +159,10 @@ jsfmt.search(js, "R.Component.create(a, { dependencies: z })").forEach(function(
153
159
jsfmt .validate (< javascript_string> ) // Returns errors found while parsing JavaScript
154
160
```
155
161
162
+ ``` javascript
163
+ jsfmt .validateJSON (< JSON_string> ) // Returns errors found while parsing JSON
164
+ ```
165
+
156
166
#### Example
157
167
158
168
``` javascript
0 commit comments