fix(IF Node): bug when null isn't considerate empty in isEmpty and isNotEmpty comparison

This commit is contained in:
Michael Kret 2022-09-30 18:19:33 +03:00 committed by GitHub
parent 4810a4f58a
commit 0cdc2e9dc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -346,13 +346,13 @@ export class If implements INodeType {
notStartsWith: (value1: NodeParameterValue, value2: NodeParameterValue) =>
!(value1 as string).startsWith(value2 as string),
isEmpty: (value1: NodeParameterValue) =>
[undefined, null, ''].includes(value1 as string) ||
[undefined, null, '', NaN].includes(value1 as string) ||
(typeof value1 === 'object' && value1 !== null
? Object.entries(value1 as string).length === 0
: false),
isNotEmpty: (value1: NodeParameterValue) =>
!(
[undefined, null, ''].includes(value1 as string) ||
[undefined, null, '', NaN].includes(value1 as string) ||
(typeof value1 === 'object' && value1 !== null
? Object.entries(value1 as string).length === 0
: false)