dynamodb-doc-client-utils.js
function updateProjectionExpression(opts, expressions) {
  if (!expressions || !Array.isArray(expressions) || expressions.length <= 0) return opts;
  if (!opts) opts = {};

  const projectionExpressions = opts.ProjectionExpression ?
    opts.ProjectionExpression.split(',').filter(isNotBlank).map(trim) : [];

  expressions.forEach(expression => {
    if (isNotBlank(expression) && projectionExpressions.indexOf(expression) === -1) {
      projectionExpressions.push(trim(expression));
    }
  });

  const projectionExpression = projectionExpressions.length > 0 ? projectionExpressions.join(',') : undefined;
  opts.ProjectionExpression = isNotBlank(projectionExpression) ? projectionExpression : undefined;
  return opts;
}
function updateProjectionExpression(opts, expressions) {
  if (!expressions || !Array.isArray(expressions) || expressions.length <= 0) return opts;
  if (!opts) opts = {};

  const projectionExpressions = opts.ProjectionExpression ?
    opts.ProjectionExpression.split(',').filter(isNotBlank).map(trim) : [];

  expressions.forEach(expression => {
    if (isNotBlank(expression) && projectionExpressions.indexOf(expression) === -1) {
      projectionExpressions.push(trim(expression));
    }
  });

  const projectionExpression = projectionExpressions.length > 0 ? projectionExpressions.join(',') : undefined;
  opts.ProjectionExpression = isNotBlank(projectionExpression) ? projectionExpression : undefined;
  return opts;
}
function updateProjectionExpression ( opts , expressions ) { if ( ! expressions || ! Array . isArray ( expressions ) || expressions . length <= 0 ) return opts ; if ( ! opts ) opts = { } ; const projectionExpressions = opts . ProjectionExpression ? opts . ProjectionExpression . split ( ',' ) . filter ( isNotBlank ) . map ( trim ) : [ ] ; expressions . forEach ( expression => { if ( isNotBlank ( expression ) && projectionExpressions . indexOf ( expression ) === - 1 ) { projectionExpressions . push ( trim ( expression ) ) ; } } ) ; const projectionExpression = projectionExpressions . length > 0 ? projectionExpressions . join ( ',' ) : undefined ; opts . ProjectionExpression = isNotBlank ( projectionExpression ) ? projectionExpression : undefined ; return opts ; }
Updates the ProjectionExpression property of the given opts with the given extra expressions.
@param {DynamoGetOpts|DynamoQueryOpts|Object|undefined} opts - the options to update
@param {string[]} expressions - the expressions to add
@return {DynamoGetOpts|DynamoQueryOpts|Object} the updated options
Updates the ProjectionExpression property of the given opts with the given extra expressions .