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 45 46 47 48 49 50 51 52 | 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 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { AmaliaFunctionCategory, AmaliaFunctionKeys, type AmaliaFormula } from '@amalia/amalia-lang/formula/types';
import { type ComputeEngineResult } from '@amalia/payout-calculation/types';
import { AmaliaFunctionDefault } from '../../AmaliaFunction';
export const miscIsNull = new AmaliaFunctionDefault<[ComputeEngineResult], boolean>({
name: AmaliaFunctionKeys.isNull,
category: AmaliaFunctionCategory.MISC,
// Do not put 1 here because execution will crash if null,
// which is going against the purpose of this function.
nbParamsRequired: 0,
description: 'Check if parameter is null',
exec: (evaluate) => evaluate === null || evaluate === undefined || evaluate === Infinity || evaluate === -Infinity,
params: [
{ name: 'parameter', description: 'Variables, Fields, Properties, Links etc. to check.', defaultValue: null },
],
examples: [
{
desc: 'Returns true if cancelled date does not exist.',
formula: 'isNull(opportunity.cancelledDate)' as AmaliaFormula,
},
{
desc: 'Returns false since the parameter (0) is not null.',
formula: 'isNull(0)' as AmaliaFormula,
result: false,
},
{
desc: 'Returns true if the link to previous opportunity does not exist.',
formula: 'isNull(opportunity.previousOpportunity)' as AmaliaFormula,
},
{
desc: 'Returns true since the parameter is null.',
formula: 'isNull(null)' as AmaliaFormula,
result: true,
},
{
desc: 'Returns true since the parameter is undefined.',
formula: 'isNull(undefined)' as AmaliaFormula,
result: true,
},
{
desc: 'Returns false since the parameter is defined.',
formula: "isNull('test')" as AmaliaFormula,
result: false,
},
],
});
|