From 310d655a0c151e37c47589ab311898b59b84d8dd Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Mon, 18 May 2026 03:21:23 +0000 Subject: [PATCH] [Sync Iteration] typescript/resistor-color/1 --- .../resistor-color/1/resistor-color.ts | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 solutions/typescript/resistor-color/1/resistor-color.ts diff --git a/solutions/typescript/resistor-color/1/resistor-color.ts b/solutions/typescript/resistor-color/1/resistor-color.ts new file mode 100644 index 0000000..cdc1683 --- /dev/null +++ b/solutions/typescript/resistor-color/1/resistor-color.ts @@ -0,0 +1,28 @@ +type Color = + | "black" + | "brown" + | "red" + | "orange" + | "yellow" + | "green" + | "blue" + | "violet" + | "grey" + | "white"; + +export const COLORS = [ + "black", + "brown", + "red", + "orange", + "yellow", + "green", + "blue", + "violet", + "grey", + "white", +]; + +export const colorCode = (color: Color): number => { + return COLORS.indexOf(color.toLowerCase()); +};