1 |
|
2 | import { IGuidColorItem, IRGBColorItem, IColorItem } from "./interfaces";
|
3 | import { ApiExecutionResponseError } from "./execution/execute-afm";
|
4 |
|
5 | const isValidColorItem = (value: IColorItem | undefined | null): value is IColorItem =>
|
6 | !!(value && value.type && value.value !== undefined);
|
7 |
|
8 | export const isGuidColorItem = (color: IColorItem | undefined | null): color is IGuidColorItem =>
|
9 | isValidColorItem(color) && color.type === "guid";
|
10 | export const isRgbColorItem = (color: IColorItem | undefined | null): color is IRGBColorItem =>
|
11 | isValidColorItem(color) && color.type === "rgb";
|
12 |
|
13 | export function isApiExecutionResponseError(error: Error): error is ApiExecutionResponseError {
|
14 | return !!(error as ApiExecutionResponseError).executionResponse;
|
15 | }
|