Exists

Check if a given value exists in the context. Will return 'no' for empty empty arrays. To be used mostly with DQ and selectors.

javascript · Common Scripts

Details

IDExists
Languagejavascript
From Version5.0.0
TagsUtility Condition

README

Checks if a given value exists in the context. The script will return “no” for an empty arrays. This script should be used mostly with DQ and selectors.

Script Data


Name Description
Script Type javascript
Tags Utility, Condition

Inputs


Argument Name Description
value The value to check if it exists. It can handle arrays as well.

Outputs


Path Description Type
True Whether the given value exists in context. Unknown
False Whether the given value does not exist in context. Unknown
if (args.value) {
    if (Array.isArray(args.value)) {
        return args.value.length > 0 ? 'yes' : 'no';
    }
    return 'yes';
}
return 'no';