export type Kind =
  | 'null'
  | 'undefined'
  | 'boolean'
  | 'number'
  | 'string'
  | 'symbol'
  | 'bigint'
  | 'function'
  | 'array'
  | 'object'

export const typeOf = (value: unknown): Kind => {
  const type = typeof value
  if (type === 'object') {
    return !value ? 'null' : Array.isArray(value) ? 'array' : type
  } else {
    return type
  }
}
