DynamoDB expression utility.
npm i dynamodb-expr -S
Build a projection expression.
attributes
- An array of names of attributes to be projected.
ExpressionAttributeNames
- An object that adds mappings of attributes that are replaced with placeholders during expression construction.
The return value is a string of the projection expression that reserved words in it are replaced with placeholders.
Example:
const { buildProjectionExpression } = require('dynamodb-expr');
const ExpressionAttributeNames = {};
const ProjectionExpression = buildProjectionExpression(['index', `foo'], ExpressionAttributeNames);
// Result:
// ProjectionExpression: '#index,foo'
// ExpressionAttributeNames: { '#index': 'index' }
Return a boolean value that indicates whether the word is reserved.
An array of reserved keywords.
MIT