- make options optional

This commit is contained in:
enricobuehler 2021-06-24 01:12:32 +02:00
parent 4007bd3352
commit 64d7dc61ee

View File

@ -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];