Open jneug opened 2 weeks ago
Not sure if this is intended, but currently coercions will panic if a value is none, which can happen with optional: true set.
optional: true
I think it would be more intuitive, if a coercion respected the optional setting and returned none, if the key was not present.
optional
none
For example, the array coercion would look like this:
array
#let array(self, it) = { if self.optional and it == none { return none } if (type(it) != type(())) { return (it,) } it }
Good catch! I'm hoping to be able to put some time into this package this weekend and get the next version published.
Not sure if this is intended, but currently coercions will panic if a value is none, which can happen with
optional: true
set.I think it would be more intuitive, if a coercion respected the
optional
setting and returnednone
, if the key was not present.For example, the
array
coercion would look like this: