dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
15 lines (14 loc) • 660 B
JavaScript
import { DynamoDBToolboxError } from '../errors/dynamoDBToolboxError.js';
const returnValuesOnConditionFalseOptions = new Set([
'NONE',
'ALL_OLD'
]);
export const parseReturnValuesOnConditionFalseOption = (returnValues) => {
if (!returnValuesOnConditionFalseOptions.has(returnValues)) {
throw new DynamoDBToolboxError('options.invalidReturnValuesOnConditionFalseOption', {
message: `Invalid returnValues option: '${String(returnValues)}'. 'returnValuesOnConditionFalse' must be one of: ${[...returnValuesOnConditionFalseOptions].join(', ')}.`,
payload: { returnValues }
});
}
return returnValues;
};