-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #825 from demisto/IsValueInArray
IsValueInArray - check if a value is in an array
- Loading branch information
Showing
4 changed files
with
421 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
commonfields: | ||
id: IsValueInArray | ||
version: -1 | ||
name: IsValueInArray | ||
script: |- | ||
var array = args.array; | ||
var value = args.value; | ||
if (!array || !value) { | ||
return 'no'; | ||
} | ||
if (!Array.isArray(array)) { | ||
return (array === value) ? 'yes' : 'no'; | ||
} | ||
var res = 'no'; | ||
array.forEach(function(item){ | ||
if (item === value) { | ||
res = 'yes'; | ||
} | ||
}); | ||
return res; | ||
type: javascript | ||
tags: | ||
- Condition | ||
comment: Look for value in an array | ||
enabled: true | ||
args: | ||
- name: array | ||
description: Array to look for the value | ||
isArray: true | ||
- name: value | ||
description: Value to look for in the array | ||
outputs: | ||
- contextPath: "yes" | ||
description: The list contains the value | ||
- contextPath: "no" | ||
description: The list does not contain the value | ||
scripttarget: 0 |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.