[JS] A way to get enumeration names?
I use this small function to convert ID's enumerations to a displayable string:
function enumToText (val)
{
var result = "";
while (val > 0)
{
result = result+String.fromCharCode(val % 256);
val = Math.floor( val/256 );
}
return result;
}
which returns, e.g., 'barb' instead of the intimidating constant 1650553442 (for an ArrowHead type). It works, because all InDesign enumerated constants are defined as sequences of 4 ASCII characters. 'none', for example, is often used, and that says a lot more than 1852796517.
My Javascript help files lists both the number and its associated 4 letter word (and they are all suitable for minors!), but it means I have to browse the Help.
Four letters are clearer than the 10 digit code, granted, but could it be possible in Javascript to get the actual name "ArrowHead.BARBED_ARROW_HEAD", when fed the constant? Other than using a dumb list of all constants?
Edit
If you were thinking, "a list doesn't sound too bad', I still have the one for CS3 on my site: http://www.jongware.com/cs3enums.html
It's a boring read, but worse: it's several thousand entries long! Imagine inserting that into every script.

