install/freeipa-webui/node_modules/@reduxjs/toolkit/src/query/utils/countObjectKeys.ts
raw| 1 | // Fast method for counting an object's keys |
| 2 | // without resorting to `Object.keys(obj).length |
| 3 | // Will this make a big difference in perf? Probably not |
| 4 | // But we can save a few allocations. |
| 5 | |
| 6 | export function countObjectKeys(obj: Record<any, any>) { |
| 7 | let count = 0 |
| 8 | |
| 9 | for (const _key in obj) { |
| 10 | count++ |
| 11 | } |
| 12 | |
| 13 | return count |
| 14 | } |