| 209 | * @returns {boolean} True if value is an empty object, otherwise false |
| 210 | */ |
| 211 | const isEmptyObject = (val) => { |
| 212 | // Early return for non-objects or Buffers to prevent RangeError |
| 213 | if (!isObject(val) || isBuffer(val)) { |
| 214 | return false; |
| 215 | } |
| 216 | |
| 217 | try { |
| 218 | return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype; |
| 219 | } catch (e) { |
| 220 | // Fallback for any other objects that might cause RangeError with Object.keys() |
| 221 | return false; |
| 222 | } |
| 223 | }; |
| 224 | |
| 225 | /** |
| 226 | * Determine if a value is a Date |