UNPKG

dynamodb-toolbox

Version:

Lightweight and type-safe query builder for DynamoDB and TypeScript.

19 lines (18 loc) 694 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDefaultsDTO = void 0; const isFunction_js_1 = require("../../../../utils/validation/isFunction.js"); const getDefaultsDTO = (schema) => { const defaultsDTO = {}; for (const mode of ['keyDefault', 'putDefault', 'updateDefault']) { const modeDefault = schema.props[mode]; if (modeDefault === undefined) { continue; } defaultsDTO[mode] = (0, isFunction_js_1.isFunction)(modeDefault) ? { defaulterId: 'custom' } : { defaulterId: 'value', value: modeDefault }; } return defaultsDTO; }; exports.getDefaultsDTO = getDefaultsDTO;