Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
chain-able-deps / src / util / simpleKindOf.ts
Size: Mime:
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
}