sc4
Version:
A command line utility for automating SimCity 4 modding tasks & modifying savegames
17 lines (16 loc) • 375 B
JavaScript
/**
* Determines whether the given key can serve as an exemplar property key.
*
* @{param} key {unknown}
*/
export function isKey(key) {
if (typeof key === 'number' || typeof key === 'string') {
return true;
}
else if (typeof key === 'object' && key !== null) {
return Symbol.toPrimitive in key;
}
else {
return false;
}
}