(value: unknown)
| 70 | } |
| 71 | |
| 72 | export function stringifyTaskListGroupValue(value: unknown): string { |
| 73 | if (value === null || value === undefined) { |
| 74 | return "None"; |
| 75 | } |
| 76 | |
| 77 | if (typeof value === "object" && value !== null && typeof value.toString === "function") { |
| 78 | const basesValue = value as BasesDisplayValue; |
| 79 | if ( |
| 80 | basesValue.constructor?.name === "NullValue" || |
| 81 | (basesValue.isTruthy && !basesValue.isTruthy()) |
| 82 | ) { |
| 83 | return "None"; |
| 84 | } |
| 85 | |
| 86 | if (basesValue.constructor?.name === "ListValue" || Array.isArray(basesValue.value)) { |
| 87 | const arr = basesValue.value || []; |
| 88 | return arr.length > 0 |
| 89 | ? arr.map((item) => stringifyTaskListGroupValue(item)).join(", ") |
| 90 | : "None"; |
| 91 | } |
| 92 | |
| 93 | return basesValue.toString() || "None"; |
| 94 | } |
| 95 | |
| 96 | if (typeof value === "string") { |
| 97 | return value || "None"; |
| 98 | } |
| 99 | |
| 100 | if (typeof value === "number") { |
| 101 | return String(value); |
| 102 | } |
| 103 | |
| 104 | if (typeof value === "boolean") { |
| 105 | return value ? "True" : "False"; |
| 106 | } |
| 107 | |
| 108 | if (Array.isArray(value)) { |
| 109 | return value.length > 0 |
| 110 | ? value.map((item) => stringifyTaskListGroupValue(item)).join(", ") |
| 111 | : "None"; |
| 112 | } |
| 113 | |
| 114 | return stringifyUnknown(value) || "None"; |
| 115 | } |
| 116 | |
| 117 | export function groupTasksByTaskListSubProperty( |
| 118 | tasks: readonly TaskInfo[], |
no test coverage detected