import { areEqualUsing , isMissing } from './util' ; import { Comparator , ParamDeserializer , ParamSerializer } from './types' ; param defaultValue export function createStringSerializer ( defaultValue = null ) { return model => isMissing ( model ) ? defaultValue : model ; } param defaultValue export function createStringDeserializer ( defaultValue = null ) { return value => isMissing ( value ) ? defaultValue : value ; } param defaultValue export function createNumberSerializer ( defaultValue = null ) { return model => isMissing ( model ) ? defaultValue : `${ model }` ; } param defaultValue export function createNumberDeserializer ( defaultValue = null ) { return value => isMissing ( value ) ? defaultValue : parseFloat ( value ) ; } param defaultValue export function createBooleanSerializer ( defaultValue = null ) { return model => isMissing ( model ) ? defaultValue : `${ model }` ; } param defaultValue export function createBooleanDeserializer ( defaultValue = null ) { return value => isMissing ( value ) ? defaultValue : ( value === 'true' || value === '1' ) ; } internal export const DEFAULT_STRING_SERIALIZER = createStringSerializer ( ) ; internal export const DEFAULT_STRING_DESERIALIZER = createStringDeserializer ( ) ; internal export const DEFAULT_NUMBER_SERIALIZER = createNumberSerializer ( ) ; internal export const DEFAULT_NUMBER_DESERIALIZER = createNumberDeserializer ( ) ; internal export const DEFAULT_BOOLEAN_SERIALIZER = createBooleanSerializer ( ) ; internal export const DEFAULT_BOOLEAN_DESERIALIZER = createBooleanDeserializer ( ) ;