"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class DateMapper {
    fromDb(attributeValue) {
        if (attributeValue.N) {
            return new Date(parseInt(attributeValue.N, 10));
        }
        else {
            throw new Error('there is no N(umber) value defiend on given attribute value');
        }
    }
    toDb(modelValue) {
        if (modelValue && modelValue instanceof Date) {
            return { N: `${modelValue.getTime()}` };
        }
        else {
            throw new Error('the given model value must be an instance of Date');
        }
    }
}
exports.DateMapper = DateMapper;
//# sourceMappingURL=date.mapper.js.map