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

Parameters
Name Required Type Description

list

Yes

Collection of Boolean

List of boolean

Returns

Boolean

Examples
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

Parameters
Name Required Type Description

list

Yes

Collection of Boolean

List of boolean

Returns

Boolean

Examples
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

Parameters
Name Required Type Description

list

Yes

collectionOfAny

List of comparable items

Returns

Number

Examples
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

Parameters
Name Required Type Description

list

Yes

collectionOfAny

List of comparable items

Returns

Any

Examples
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

Parameters
Name Required Type Description

list

Yes

Collection of Number

List of numbers

Returns

Number

Examples
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

Parameters
Name Required Type Description

list

Yes

Collection of Number

List of numbers

Returns

Number

Examples
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

Parameters
Name Required Type Description

list

Yes

collectionOfAny

List of comparable items

Returns

Any

Examples
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

Parameters
Name Required Type Description

list

Yes

Collection of Number

List of numbers

Returns

Collection of Number

Examples
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

Parameters
Name Required Type Description

list

Yes

Collection of Number

List of numbers

Returns

Number

Examples
nn.stddev([2, 4, 7, 5]) => 2.0816659994661

nn.stddev([2, 4, 7, 5, null]) => 2.0816659994661

nn.stddev([]) => "null"

sum(list)

Returns sum of all non null numbers from list

Parameters
Name Required Type Description

list

Yes

Collection of Number

List of numbers

Returns

Number

Examples
nn.sum([1, null, 2]) => 3

nn.sum([1, 2, 3]) => 6