Null-safe Array.isArray equivalent. ast-transpiler emits `(X instanceof List) || (X.getClass().isArray())` for `Array.isArray(X)`, which NPEs when X is null (e.g. test.sharedMethods entryKeyVal coming from safeValue() that returned undefined). JS Array.isArray(null) is false; mirror that here. Used
(Object a)
| 243 | * 150+ call sites become null-safe in one place. |
| 244 | */ |
| 245 | public static boolean isArrayJs(Object a) { |
| 246 | if (a == null) return false; |
| 247 | if (a instanceof List<?>) return true; |
| 248 | return a.getClass().isArray(); |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Direct emit target for ast-transpiler PR #48: `Array.isArray(x)` now |