@atomic-ehr/fhirpath
Version:
A TypeScript implementation of FHIRPath
21 lines (19 loc) • 650 B
text/typescript
import type { OperatorDefinition } from '../types';
import { PRECEDENCE } from '../types';
import type { OperationEvaluator } from '../types';
import { box, unbox } from '../boxing';
export const evaluate: OperationEvaluator = async (input, context, operand) => {
// Unary plus returns the operand as-is
return { value: operand, context };
};
export const unaryPlusOperator: OperatorDefinition & { evaluate: OperationEvaluator } = {
symbol: '+',
name: 'unaryPlus',
category: ['arithmetic'],
precedence: PRECEDENCE.UNARY,
associativity: 'right',
description: 'Unary plus operator',
examples: ['+5'],
signatures: [],
evaluate
};