From a6410d540db302409a2d86e0f9aa37a070acfe27 Mon Sep 17 00:00:00 2001 From: "josh.hollandsworth" Date: Wed, 30 Dec 2015 09:58:47 -0600 Subject: [PATCH] Added pretty diff ternaryline option - Issue 524 --- docs/options.md | 24 ++++++++++++++++++++++++ src/beautifiers/prettydiff.coffee | 1 + 2 files changed, 25 insertions(+) diff --git a/docs/options.md b/docs/options.md index 308f987..d8cf899 100644 --- a/docs/options.md +++ b/docs/options.md @@ -1322,6 +1322,30 @@ Break chained method calls across subsequent lines (Supported by JS Beautify, Pr } ``` +#### [JavaScript - Preserve Ternary On Single Line](#javascript---preserve-ternary-lines) + +**Namespace**: `js` + +**Key**: `preserve_ternary_lines` + +**Type**: `boolean` + +**Supported Beautifiers**: [`JS Beautify`](#js-beautify) [`Pretty Diff`](#pretty-diff) + +**Description**: + +Preserve ternary methods on a single line (Supported by JS Beautify, Pretty Diff) + +**Example `.jsbeautifyrc` Configuration** + +```json +{ + "js": { + "preserve_ternary_lines": true + } +} +``` + #### [JavaScript - Keep array indentation](#javascript---keep-array-indentation) **Namespace**: `js` diff --git a/src/beautifiers/prettydiff.coffee b/src/beautifiers/prettydiff.coffee index d116434..47aa286 100644 --- a/src/beautifiers/prettydiff.coffee +++ b/src/beautifiers/prettydiff.coffee @@ -33,6 +33,7 @@ module.exports = class PrettyDiff extends Beautifier if (break_chained_methods is true ) then \ false else true ] + ternaryline: "preserve_ternary_lines" # Apply language-specific options CSV: true ERB: true