import { IParseHandler , IParseProps , DinoModel } from '../../../../index' ; import { User } from '../controllers/user' ; export const toNumberTen = ( props ) => { return 10 ; } ; export const toNumber = ( props ) => { return parseInt ( props . value ) ; } ; export const toJPG = ( props ) => { return `${ props . value }.jpg` ; } ; export const toUser = ( props ) => { return null ; } ; export const toUserAdd = ( props ) => { const dino = props . value ; return `hello ${ dino . name }` ; } ; export const throwException = ( props ) => { throw Error ( 'TestError' ) ; } ; export const convertToProvidedData = ( props ) => { return props . data . name ; } ; export const returnProps = ( props ) => { return { controllerName : props . controller . constructor . name , properties : props } ; } ; export const numValidation = ( props , model ) => { model . isValid = false ; model . values . push ( { key : props . key , value : props . value } ) ; model . errors . push ( { key : props . key , value : [ 'Should be Number' , 'Max is 10' ] } ) ; return props . value ; } ; export const boolValidation = ( props , model ) => { model . isValid = false ; model . values . push ( { key : props . key , value : props . value } ) ; model . errors . push ( { key : props . key , value : [ 'Should be boolean' , 'Only true is allowed' ] } ) ; return props . value ; } ;