Added some drawing methods

This commit is contained in:
2023-12-15 22:13:22 +02:00
parent 04dd6c079d
commit cad9fdbb40
11 changed files with 189 additions and 9 deletions

View File

@ -69,6 +69,15 @@ export function arrayOfObjectsToObjectWithArrays<T extends Record<string, any>>(
);
}
export function maybeAtomic<T>(value: T): T | T[] {
/*
* Returns first value of array if array of length 1, otherwise returns value
* @param {any} value - Value to check
* @returns {any} Value or array
*/
return Array.isArray(value) && value.length === 1 ? value[0] : value;
}
export function filterObject(
obj: Record<string, any>,
filter: string[],