import { Cond , Conditional } from './types' ; import { Maybe , Nothing } from '@typed/maybe' ; import { List } from '../types' ; import { curry2 } from '@typed/functions' ; name export const cond = curry2 ( __cond ) ; function __cond < A , B > ( conditionals , value ) { const itemCount = conditionals . length ; for ( let i = 0 ; i < itemCount ; ++ i ) { const [ predicate , f ] = conditionals [ i ] ; if ( predicate ( value ) ) return Maybe . of ( f ( value ) ) ; } return Nothing ; }