3.0.5 • Published 2 years ago

ts-is-record v3.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
2 years ago

ts-is-record

npm build publish Libraries.io dependency status for latest release Bundlephobia npm

Typescript utilities

import invariant from 'ts-tiny-invariant'

type Key = string | number | symbol

export function isRecord(value: unknown): value is Record<Key, unknown> {
  return (
    value !== null &&
    (typeof value === 'object' || typeof value === 'function') &&
    !Array.isArray(value)
  )
}

export function assertRecord(
  value: unknown,
  message: string
): asserts value is Record<Key, unknown> {
  invariant(isRecord(value), message)
}
3.0.5

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

2.0.3

2 years ago

2.0.2

2 years ago

2.0.1

3 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago