aboutsummaryrefslogtreecommitdiff
path: root/utils/result/constructors.ts
blob: 6fec0f40c5be41f073c7dca913f0115dbb576d3e (plain)
1
2
3
4
5
6
7
8
9
import type { Err, Ok } from '@hollowdark/utils/result/types'

export function ok<T>(value: T): Ok<T> {
  return { ok: true, value }
}

export function err<E>(error: E): Err<E> {
  return { ok: false, error }
}