Skip to content

Commit 25187e6

Browse files
$not on empty sequence should return empty sequence, like other functions
Signed-off-by: andrew-coleman <andrew_coleman@uk.ibm.com>
1 parent d5311ca commit 25187e6

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/functions.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,6 +1433,11 @@ const functions = (() => {
14331433
* @returns {boolean} - NOT arg
14341434
*/
14351435
function not(arg) {
1436+
// undefined inputs always return undefined
1437+
if (typeof arg === 'undefined') {
1438+
return undefined;
1439+
}
1440+
14361441
return !boolean(arg);
14371442
}
14381443

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"expr": "$not(nothing)",
3+
"data": {},
4+
"bindings": {},
5+
"undefinedResult": true
6+
}

test/test-suite/groups/function-signatures/case001.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"expr": "λ($arg)<b:b>{$not($arg)}(foo)",
33
"dataset": null,
44
"bindings": {},
5-
"result": true
6-
}
5+
"undefinedResult": true
6+
}

0 commit comments

Comments
 (0)