gs-port / node_modules /@reduxjs /toolkit /src /query /utils /countObjectKeys.ts
Scribbler310's picture
feat: enhance dashboard
c2b7eb3 verified
// Fast method for counting an object's keys
// without resorting to `Object.keys(obj).length
// Will this make a big difference in perf? Probably not
// But we can save a few allocations.
export function countObjectKeys(obj: Record<any, any>) {
let count = 0
for (const _key in obj) {
count++
}
return count
}