sjsonnet icon indicating copy to clipboard operation
sjsonnet copied to clipboard

Add `??` with nullsafe or default value.

Open He-Pin opened this issue 8 months ago • 3 comments

Motivation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing

We need to something like maybeNullObj?['someField'] ?? 'defaultValue'

refs: https://github.com/databricks/sjsonnet/issues/327

or we can just implement mvel:

person?.address?.city?: "Unknown City"

He-Pin avatar Apr 27 '25 09:04 He-Pin