@storm-stack/types
Version:
⚡ The storm-stack monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.
15 lines (14 loc) • 353 B
JavaScript
const IS_UNSIGNED_INTEGER = /^(?:0|[1-9]\d*)$/;
export function isObjectIndex(value) {
switch (typeof value) {
case "number": {
return Number.isInteger(value) && value >= 0 && value < Number.MAX_SAFE_INTEGER;
}
case "symbol": {
return false;
}
case "string": {
return IS_UNSIGNED_INTEGER.test(value);
}
}
}