From 43f7c664c5b7056c95e694eac85f4686910a25e5 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Thu, 12 Jun 2014 13:27:58 -0400 Subject: [PATCH 1/2] update usage documentation --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3df40fa..dd6f4be 100644 --- a/README.md +++ b/README.md @@ -19,16 +19,18 @@ Usage ``` $ jsfmt --help Usage: - jsfmt [--no-format] [--diff|--list|--write] [--rewrite PATTERN|--search PATTERN] [...] + jsfmt [--no-format] [--diff|--list|--write] [--validate] [--rewrite PATTERN|--search PATTERN] [--json] [...] 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') ``` From 1a84831ee598c6df74e526f1b84e0d621067de48 Mon Sep 17 00:00:00 2001 From: brettlangdon Date: Thu, 12 Jun 2014 13:28:15 -0400 Subject: [PATCH 2/2] add formatJSON and validateJSON examples --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index dd6f4be..011b480 100644 --- a/README.md +++ b/README.md @@ -97,6 +97,10 @@ API jsfmt.format(, ) // Returns formatted JavaScript ``` +```javascript +jsfmt.formatJSON(, ) // Returns formatted JSON +``` + ```javascript var config = jsfmt.getConfig(); // Loads the jsfmt config from the appropriate rc file or default config object ``` @@ -155,6 +159,10 @@ jsfmt.search(js, "R.Component.create(a, { dependencies: z })").forEach(function( jsfmt.validate() // Returns errors found while parsing JavaScript ``` +```javascript +jsfmt.validateJSON() // Returns errors found while parsing JSON +``` + #### Example ```javascript