24 lines
453 B
TypeScript
24 lines
453 B
TypeScript
|
import { result } from '../../common/result'
|
||
|
|
||
|
export type Wish = {
|
||
|
name: string
|
||
|
description?: string
|
||
|
link?: string
|
||
|
}
|
||
|
|
||
|
export const createWish = (
|
||
|
name: string,
|
||
|
description?: string,
|
||
|
link?: string
|
||
|
): result.Result<Wish, string> => {
|
||
|
if (typeof name !== 'undefined' && name.length > 0) {
|
||
|
return result.ok({
|
||
|
name,
|
||
|
description,
|
||
|
link,
|
||
|
} as Wish)
|
||
|
}
|
||
|
|
||
|
return result.err(`validation of wish failed via. createWish`)
|
||
|
}
|