Add isEmptyRecord
function
#356
aleclarson
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Using TypeScript's definition of "Record" (see the
Record<K, V>
generic type).This checks if a plain object has 0 “own keys” inside. Inherited keys (e.g. prototype) are not checked. It does this in the most efficient way possible (
for…in
with early return).Steps:
Object.prototype.hasOwnProperty.call
Beta Was this translation helpful? Give feedback.
All reactions