module import { NullAttribute } from '../type/attribute.type' ; import { MapperForType } from './base.mapper' ; function nullFromDb ( attributeValue ) { if ( attributeValue . NULL ) { return null ; } else { throw new Error ( `there is no NULL value defined on given attribute value: ${ JSON . stringify ( attributeValue ) }` ) ; } } function nullToDb ( value ) { if ( value !== null ) { throw new Error ( `null mapper only supports null value, got ${ JSON . stringify ( value ) }` ) ; } return { NULL : true } ; } export const NullMapper = { fromDb : nullFromDb , toDb : nullToDb , } ;