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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 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 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 6x 1x | import { AmaliaFunctionCategory, AmaliaFunctionKeys, type AmaliaFormula } from '@amalia/amalia-lang/formula/types';
import { FormatsEnum } from '@amalia/data-capture/fields/types';
import { AmaliaFunctionDefault } from '../../AmaliaFunction';
export const arrayIn = new AmaliaFunctionDefault<[(number | string)[], number | string], boolean>({
name: AmaliaFunctionKeys.IN,
category: AmaliaFunctionCategory.ARRAY,
nbParamsRequired: 2,
description: 'Return true if a given value is found in a given array',
params: [
{ name: 'array', description: 'Array', validFormats: [FormatsEnum.table] },
{ name: 'searchValue', description: 'Value to look for' },
],
examples: [
{
desc: 'Returns true if the team members array contains the ID of the user.',
formula: 'IN(team.members, user.externalId)' as AmaliaFormula,
},
{
desc: 'Returns true',
formula: 'IN(["a","b","c"], "b")' as AmaliaFormula,
result: true,
},
{
desc: 'Returns false',
formula: 'IN([12,13,14], 1)' as AmaliaFormula,
result: false,
},
],
/**
* Check that array contains exactly an other text.
* @param sourceStringArray
* @param searchString
*/
exec: (sourceStringArray, searchString) =>
sourceStringArray.some((element) => element.toString() === searchString.toString()),
});
|