@env0/dynamo-easy
Version:
DynamoDB client for NodeJS and browser with a fluent api to build requests. We take care of the type mapping between JS and DynamoDB, customizable trough typescript decorators.
35 lines • 1.15 kB
JavaScript
import { isFunctionOperator } from './is-function-operator.function';
import { isNoParamFunctionOperator } from './is-no-param-function-operator.function';
/**
* Every expression condition operator has a predefined arity (amount) of function parameters, this method
* returns this value
*
* @returns {number} The amount of required method parameters when calling an operator function
* @hidden
*/
export function operatorParameterArity(operator) {
if (isFunctionOperator(operator) && isNoParamFunctionOperator(operator)) {
return 0;
}
else {
switch (operator) {
case '=':
case '>':
case '>=':
case '<':
case '<=':
case '<>':
case 'begins_with':
case 'attribute_type':
case 'contains':
case 'not_contains':
case 'IN':
return 1;
case 'BETWEEN':
return 2;
default:
throw new Error(`no parameter arity defined for operator ${operator}`);
}
}
}
//# sourceMappingURL=operator-parameter-arity.function.js.map