Skip to content

Commit

Permalink
Merge pull request #825 from demisto/IsValueInArray
Browse files Browse the repository at this point in the history
IsValueInArray - check if a value is in an array
  • Loading branch information
dorsha authored Sep 7, 2017
2 parents 6f2d468 + ce4571d commit ef75bf9
Show file tree
Hide file tree
Showing 4 changed files with 421 additions and 39 deletions.
41 changes: 41 additions & 0 deletions Scripts/script-IsValueInArray.yml
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
39 changes: 0 additions & 39 deletions Scripts/script-IsValueInList.yml

This file was deleted.

Loading

0 comments on commit ef75bf9

Please sign in to comment.