From c6bfd96a3eba3fe87ce74984f0d1547fc455f31c Mon Sep 17 00:00:00 2001 From: Benjamin Falk Date: Wed, 13 Feb 2019 14:10:29 +0100 Subject: [PATCH 1/4] #133 Set defaults for toggle --- lib/elements/toggle.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/elements/toggle.js b/lib/elements/toggle.js index 8659e0ec..43d6e3ce 100644 --- a/lib/elements/toggle.js +++ b/lib/elements/toggle.js @@ -18,9 +18,9 @@ class TogglePrompt extends Prompt { super(opts); this.msg = opts.message; this.value = !!opts.initial; - this.active = opts.active; - this.inactive = opts.inactive; - this.initialValue = this.value; + this.active = opts.active || 'on'; + this.inactive = opts.inactive || 'off'; + this.initialValue = !!this.value; this.render(); } From d5c6ac204da21815418298efa8ecf967bff15cdc Mon Sep 17 00:00:00 2001 From: Benjamin Falk Date: Wed, 13 Feb 2019 14:11:03 +0100 Subject: [PATCH 2/4] #133 Match editorconfig to current source and fix indentation of tests --- .editorconfig | 2 +- test/prompts.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.editorconfig b/.editorconfig index 9c3daa69..183c908a 100755 --- a/.editorconfig +++ b/.editorconfig @@ -9,5 +9,5 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -[*.{json,yml,md}] +[*.{js,json,yml,md}] indent_style = space diff --git a/test/prompts.js b/test/prompts.js index 25f547b8..1a0b6f0e 100644 --- a/test/prompts.js +++ b/test/prompts.js @@ -51,6 +51,6 @@ test('injects', t => { t.same(bar, { b:2, c:3 }, 'immediately handles two prompts at once'); t.same(prompt._injected, [], 'leaves behind empty internal array when exhausted'); t.end(); - }) - }) -}) + }); + }); +}); From 5d374885213b09f364d6ec5e5857123a680b4203 Mon Sep 17 00:00:00 2001 From: Benjamin Falk Date: Wed, 13 Feb 2019 14:11:43 +0100 Subject: [PATCH 3/4] #133 Bump patch number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d7000b56..aaa346e6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "prompts", - "version": "2.0.2", + "version": "2.0.3", "description": "Lightweight, beautiful and user-friendly prompts", "license": "MIT", "repository": "terkelg/prompts", From edf5c410912e4ac7ba23ea447b88b70010baedef Mon Sep 17 00:00:00 2001 From: Benjamin Falk Date: Fri, 15 Feb 2019 20:07:43 +0100 Subject: [PATCH 4/4] #133 Unnecessary boolification --- lib/elements/toggle.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/elements/toggle.js b/lib/elements/toggle.js index 43d6e3ce..124660ae 100644 --- a/lib/elements/toggle.js +++ b/lib/elements/toggle.js @@ -20,7 +20,7 @@ class TogglePrompt extends Prompt { this.value = !!opts.initial; this.active = opts.active || 'on'; this.inactive = opts.inactive || 'off'; - this.initialValue = !!this.value; + this.initialValue = this.value; this.render(); }