Skip to content

Latest commit

 

History

History
14 lines (9 loc) · 257 Bytes

File metadata and controls

14 lines (9 loc) · 257 Bytes

isEmpty()

Overview

Checks if an object or array is empty.

Code

A screenshot of the titular code snippet

const isEmpty = (obj) =>
  Array.isArray(obj) ? obj.length === 0 : Object.keys(obj).length === 0;