RobTrew/prelude-jxa

Evaluation of `typeName(null)` gives an error.

unlocked2412 opened this issue · 4 comments

prelude-jxa/jsPrelude.js

Lines 4888 to 4912 in 3532094

const typeName = v => {
const t = typeof v;
return "object" === t ? (
Array.isArray(v) ? (
"List"
) : "Date" === v.constructor.name ? (
"Date"
) : null !== v ? (() => {
const ct = v.type;
return Boolean(ct) ? (
(/Tuple\d+/u).test(ct) ? (
"TupleN"
) : ct
) : "Dict";
})() : "Bottom"
) : {
"boolean": "Bool",
"date": "Date",
"number": "Num",
"string": "String",
"function": "(a -> b)"
} [t] || "Bottom";
};

Do you think would be good to check for null earlier ?

Good catch – I've just pushed a change. Let me know if that doesn't seem to fix it.

The issue persists. You latest commit didn't reach the repository, I think.

Thanks ! Should be there now, I think :-)