-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
category:expressionsIssues about the expression parser, variable scoping etc.Issues about the expression parser, variable scoping etc.featureonlydust-waveContribute to awesome OSS repos during OnlyDust's open source weekContribute to awesome OSS repos during OnlyDust's open source week
Description
Describe the suggested feature
Currently x ?? 0 is a syntax error. It would be handy if this meant the nullish coalescing operator denoted by ?? in JavaScript. For example, one could then do object lookup with a fallback : {foo: 7, bar: 3}["baz"] ?? 0.
Current workaround
nullish(x, y) = (x == null or x == undefined) ? y : x; nullish(null, 0)
I am not aware of a short way to test for null or undefined unlike x == null in JavaScript which is true if x is either null or undefined; in mathjs expression language it is true when x is null and false when x is undefined.
Metadata
Metadata
Assignees
Labels
category:expressionsIssues about the expression parser, variable scoping etc.Issues about the expression parser, variable scoping etc.featureonlydust-waveContribute to awesome OSS repos during OnlyDust's open source weekContribute to awesome OSS repos during OnlyDust's open source week