UNPKG

rubico

Version:

[a]synchronous functional programming

24 lines (20 loc) 582 B
/** * rubico v2.6.2 * https://github.com/a-synchronous/rubico * (c) 2019-2024 Richard Tong * rubico may be freely distributed under the MIT license. */ const objectKeysLength = object => { let numKeys = 0 for (const _ in object) { numKeys += 1 } return numKeys } const isEmpty = value => typeof value == 'string' ? value.length == 0 : value == null ? true : typeof value.length == 'number' ? value.length == 0 : typeof value.size == 'number' ? value.size == 0 : value.constructor == Object ? objectKeysLength(value) == 0 : false export default isEmpty