Non null
Functions to handle list with null values
all(list)
Returns false if any item is false, else true if all non null items are true or there is no non null items, else null
Name | Required | Type | Description |
---|---|---|---|
list |
Yes |
Collection of Boolean |
List of boolean |
Boolean |
nn.all([null, true]) => true
nn.all([2=2, 5<11]) => true
nn.all([true, true, false, true]) => false
any(list)
Returns true if any item is true, else false if all non null items are false or there is no non null items, else null
Name | Required | Type | Description |
---|---|---|---|
list |
Yes |
Collection of Boolean |
List of boolean |
Boolean |
nn.any([5>=11, 2=3, false]) => false
nn.any([null, false]) => false
nn.any([true, true, false, true]) => true
count(list)
Returns the number of non null elements in the list
Name | Required | Type | Description |
---|---|---|---|
list |
Yes |
collectionOfAny |
List of comparable items |
Number |
nn.count([1, null, 3]) => 2
nn.count(["Trisotech", "DMN"]) => 2
nn.count([1, 2, 3]) => 3
max(list)
Returns maximum non null item. Items must be comparable
Name | Required | Type | Description |
---|---|---|---|
list |
Yes |
collectionOfAny |
List of comparable items |
Any |
nn.max([1, null, 2]) => 2
nn.max(["a", "b", "c"]) => "c"
nn.max([1, 2, 3]) => 3
mean(list)
Returns arithmetic mean(average) of non null numbers
Name | Required | Type | Description |
---|---|---|---|
list |
Yes |
Collection of Number |
List of numbers |
Number |
nn.mean([1, 2, 3]) => 2
nn.mean([2, 4, null]) => 3
median(list)
Returns the median element of the list of non null numbers. I.e. after removing null items and sorting the list, if the list has an odd number of elements, it returns the middle element. If the list has an even number of elements, returns the average of the two middle elements. If the list is empty, returns null
Name | Required | Type | Description |
---|---|---|---|
list |
Yes |
Collection of Number |
List of numbers |
Number |
nn.median([8, 2, 5, 3, 4]) => 4
nn.median([8, null, 2, 5, null, 3, 4]) => 4
nn.median([6, 1, 2, 3]) => 2.5
min(list)
Returns minimum non null item
Name | Required | Type | Description |
---|---|---|---|
list |
Yes |
collectionOfAny |
List of comparable items |
Any |
nn.min(["DMN", "BPMN", "CMMN"]) => "BPMN"
nn.min([1, 2, 3]) => 1
nn.min([2, null, 3]) => 2
mode(list)
Returns the mode of the list of numbers ignoring nulls. If the result contains multiple elements, they are returned in ascending order. If the list is empty, an empty list is returned
Name | Required | Type | Description |
---|---|---|---|
list |
Yes |
Collection of Number |
List of numbers |
Collection of Number |
nn.mode([6, 1, 9, 6, 1]) => "[1, 6]"
nn.mode([1, 3, 1, 2, null]) => "[1]"
nn.mode([]) => "null"
nn.mode([6, 3, 9, 6, 6]) => "[6]"
stddev(list)
Returns the standard deviation of the list of numbers ignoring nulls. If the list is empty, returns null
Name | Required | Type | Description |
---|---|---|---|
list |
Yes |
Collection of Number |
List of numbers |
Number |
nn.stddev([2, 4, 7, 5]) => 2.0816659994661
nn.stddev([2, 4, 7, 5, null]) => 2.0816659994661
nn.stddev([]) => "null"