module import { hasType , PropertyMetadata } from '../../decorator/metadata/property-metadata.model' ; import { fromDb , toDb } from '../mapper' ; import { Attributes , MapAttribute } from '../type/attribute.type' ; import { MapperForType } from './base.mapper' ; function objectFromDb ( val , propertyMetadata ? ) { if ( hasType ( propertyMetadata ) ) { return fromDb ( val . M , propertyMetadata . typeInfo . type ) ; } else { return fromDb ( val . M ) ; } } function objectToDb ( modelValue , propertyMetadata ? ) { let value ; if ( hasType ( propertyMetadata ) ) { value = toDb ( modelValue , propertyMetadata . typeInfo . type ) ; } else { value = toDb ( modelValue ) ; } return { M : value } ; } export const ObjectMapper = { fromDb : objectFromDb , toDb : objectToDb , } ;