about summary refs log tree commit diff
path: root/src/state/lib/type-guards.ts
blob: 4ae31f3ac1b2fc2af4c4d83c0d8c29b1d5b621f1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
export function isObj(v: unknown): v is Record<string, unknown> {
  return !!v && typeof v === 'object'
}

export function hasProp<K extends PropertyKey>(
  data: object,
  prop: K,
): data is Record<K, unknown> {
  return prop in data
}