From a82276cc2c7592a308fcbf36d9fcc55a7326ed51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20L=C3=B6fgren?= <516549+ulken@users.noreply.github.com> Date: Wed, 22 Feb 2023 00:17:26 +0100 Subject: [PATCH] case-insensitive checks --- packages/core/src/prompts/select-key.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/src/prompts/select-key.ts b/packages/core/src/prompts/select-key.ts index 1de8d0d..b9b1a2b 100644 --- a/packages/core/src/prompts/select-key.ts +++ b/packages/core/src/prompts/select-key.ts @@ -11,12 +11,12 @@ export default class SelectKeyPrompt extends Prompt { super(opts, false); this.options = opts.options; - const keys = this.options.map(({ value: [initial] }) => initial); + const keys = this.options.map(({ value: [initial] }) => initial?.toLowerCase()); this.cursor = Math.max(keys.indexOf(opts.initialValue), 0); this.on('key', (key) => { if (!keys.includes(key)) return; - const value = this.options.find(({ value: [initial] }) => initial === key); + const value = this.options.find(({ value: [initial] }) => initial?.toLowerCase() === key); if (value) { this.value = value.value; this.state = 'submit'; -- 2.51.2