Skip to main content
Module

x/rambda/isEmpty.js

Faster and smaller alternative to Ramda
Go to Latest
File
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}