rambdax
Version:
Extended version of Rambda - a lightweight, faster alternative to Ramda
13 lines (11 loc) • 324 B
JavaScript
export function type(input){
if (input === null){
return 'Null'
} else if (input === undefined){
return 'Undefined'
} else if (Number.isNaN(input)){
return 'NaN'
}
const typeResult = Object.prototype.toString.call(input).slice(8, -1)
return typeResult === 'AsyncFunction' ? 'Promise' : typeResult
}