Repository URL to install this package:
|
Version:
6.0.4 ▾
|
import { ExtendedTypeOfSimple } from '../_typings'
// @@next
// import isArray from '../is/array'
// import isNull from '../is/null'
const isArray = Array.isArray
const isNull = (x: any): x is null => x === null
/* prettier-ignore */
/**
* @desc when Array -> 'array'
* when null -> 'null'
* else `typeof x`
*
* @memberOf util
* @since 4.0.0
*
* @param {any} x value for type
* @return {string} type
*
* @example
*
* simpleKindOf([]) //=> 'array'
* simpleKindOf(null) //=> 'null'
* simpleKindOf({}) //=> 'object'
*
*/
export default (x: any): string => {
return isArray(x)
? 'array'
: isNull(x)
? 'null'
: typeof x
}