Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. export function isDeepEmpty(input) {
  2. // catch null or undefined object
  3. if (!input) return true
  4. if (typeof(input) === 'object') {
  5. for (const entry of Object.values(input)) {
  6. if (!isDeepEmpty(entry)) {
  7. return false
  8. }
  9. }
  10. return true
  11. }
  12. // if input is not an object return false
  13. return false
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement