All files / libs/amalia-lang/formula/evaluate/shared/src/functions/string/exact index.ts

100% Statements 28/28
100% Branches 1/1
100% Functions 1/1
100% Lines 28/28

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 291x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
import { AmaliaFunctionCategory, AmaliaFunctionKeys, type AmaliaFormula } from '@amalia/amalia-lang/formula/types';
 
import { AmaliaFunctionDefault } from '../../AmaliaFunction';
 
export const stringExact = new AmaliaFunctionDefault<[string, string], boolean>({
  name: AmaliaFunctionKeys.EXACT,
  category: AmaliaFunctionCategory.STRING,
  nbParamsRequired: 2,
  description: 'Return true if a string exactly matches another string',
 
  exec: (text1, text2) => text1 === text2,
 
  params: [
    { name: 'string1', description: 'String to compare: variables, fields, properties, string' },
    { name: 'string2', description: 'String to compare: variables, fields, properties, string' },
  ],
 
  examples: [
    {
      desc: 'Returns true if Opportunity type is Renewal.',
      formula: 'EXACT(opportunity.type, "Renewal")' as AmaliaFormula,
    },
    {
      desc: 'Returns false since the two strings are not exactly the same.',
      formula: 'EXACT("Jean", "Jean Dupont")' as AmaliaFormula,
    },
  ],
});