(obj)
| 5 | export const deepEqual = require('./deepEqual'); |
| 6 | |
| 7 | export function isEmpty (obj) { |
| 8 | // null and undefined are "empty" |
| 9 | if (obj === null || obj === undefined) { |
| 10 | return true; |
| 11 | } |
| 12 | |
| 13 | if (typeof obj === 'number' && isNaN(obj)) { |
| 14 | return true; |
| 15 | } |
| 16 | |
| 17 | if (obj.length !== undefined) { |
| 18 | return obj.length === 0; |
| 19 | } |
| 20 | |
| 21 | if (obj instanceof Date) { |
| 22 | return false; |
| 23 | } |
| 24 | |
| 25 | if (typeof obj === 'object') { |
| 26 | return Object.keys(obj).length === 0; |
| 27 | } |
| 28 | |
| 29 | return false; |
| 30 | } |
| 31 | |
| 32 | export function forEach (obj, fn, context) { |
| 33 | Object.keys(obj).forEach((key) => fn.call(context, obj[key], key)); |
no outgoing calls
no test coverage detected
searching dependent graphs…