(arr: unknown[])
| 114 | return type; |
| 115 | } |
| 116 | #doGetTypeOfArray(arr: unknown[]): ArrayType { |
| 117 | if (!arr.length) { |
| 118 | // any type should be fine |
| 119 | return "ONLY_PRIMITIVE"; |
| 120 | } |
| 121 | |
| 122 | const onlyPrimitive = this.#isPrimitive(arr[0]); |
| 123 | if (arr[0] instanceof Array) { |
| 124 | return "MIXED"; |
| 125 | } |
| 126 | for (let i = 1; i < arr.length; i++) { |
| 127 | if ( |
| 128 | onlyPrimitive !== this.#isPrimitive(arr[i]) || arr[i] instanceof Array |
| 129 | ) { |
| 130 | return "MIXED"; |
| 131 | } |
| 132 | } |
| 133 | return onlyPrimitive ? "ONLY_PRIMITIVE" : "ONLY_OBJECT_EXCLUDING_ARRAY"; |
| 134 | } |
| 135 | #printAsInlineValue(value: unknown): string | number { |
| 136 | if (value instanceof Date) { |
| 137 | return `"${this.#printDate(value)}"`; |
no test coverage detected