From 64d7dc61eed2b987bc50534b7883bcfaafaa1878 Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Thu, 24 Jun 2021 01:12:32 +0200 Subject: [PATCH] - make options optional --- src/Utils/index.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Utils/index.ts b/src/Utils/index.ts index 8911b49..17c969f 100644 --- a/src/Utils/index.ts +++ b/src/Utils/index.ts @@ -7,22 +7,22 @@ const countDecimals = (value) => { const generateColorShades = ( colors: { [key: string]: string }, - options: { + options?: { keyList?: string[]; opacities?: number[]; outputType: "obj" | "cssVars"; } ) => { - const colorKeys = options.keyList - ? Object.keys(colors) - : Object.keys(colors).filter((key) => options.keyList?.includes(key)); + const colorKeys = options?.keyList + ? Object.keys(colors).filter((key) => options.keyList?.includes(key)) + : Object.keys(colors); const generatedColorShadesArr: object[] = []; colorKeys.forEach((key) => { const colorString = colors[key]; - const opacities = options.opacities + const opacities = options?.opacities ? options.opacities : [0.1, 0.25, 0.5, 0.75];