From b0a8ecdc2bb3539c9c3da0ef2ade2625bf4a9d55 Mon Sep 17 00:00:00 2001 From: borulday Date: Wed, 11 Jul 2018 00:34:11 +0300 Subject: [PATCH] Fix matched suggestions --- src/index.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/index.js b/src/index.js index 88a2cf4..0b7bdd6 100644 --- a/src/index.js +++ b/src/index.js @@ -57,28 +57,28 @@ function alternateColor(projectType, color) { const alternateColorName = alternateColor.name + (color.a == 1 ? "" : color.a * 100); let suggestion = ""; - if ( alternateColorName.toLowerCase() == color.name.toLowerCase() ) { - suggestion = messageKingdom[Math.floor(Math.random() * messageKingdom.length)]; - } else { - switch (projectType) { - case "ios": - case "osx": - suggestion = changeCase.camelCase(alternateColorName); - break; + switch (projectType) { + case "ios": + case "osx": + suggestion = changeCase.camelCase(alternateColorName); + break; - case "web": - suggestion = changeCase.paramCase(alternateColorName); - break; + case "web": + suggestion = changeCase.paramCase(alternateColorName); + break; - case "android": - suggestion = changeCase.snakeCase(alternateColorName); - break; + case "android": + suggestion = changeCase.snakeCase(alternateColorName); + break; - default: - suggestion = ""; - } + default: + suggestion = ""; } + if (suggestion == color.name) { + suggestion = messageKingdom[Math.floor(Math.random() * messageKingdom.length)]; + } + return { current: color.name, suggestion: suggestion