File size: 386 Bytes
3f7a9b2
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import { decide } from '../../src/index.js'
import { input } from './input.js'

const result = await decide(input)
  .onSuccess((answers) => ({ ok: true as const, answers }))
  .onError({ type: 'invalid-input' }, (error) => ({ ok: false as const, error }))
  .onError({ type: 'input-too-long' }, (error) => ({ ok: false as const, error }))

console.log(JSON.stringify(result, null, 2))