UNPKG

rambdax

Version:

Extended version of Rambda - a lightweight, faster alternative to Ramda

19 lines (14 loc) 368 B
import { type } from './type' export function isEmpty(input){ const inputType = type(input) if ([ 'Undefined', 'NaN', 'Number', 'Null' ].includes(inputType)) return false if (!input) return true if (inputType === 'Object'){ return Object.keys(input).length === 0 } if (inputType === 'Array'){ return input.length === 0 } return false }