You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks for creating this library. We are evaluating different solutions for serializing json in the URL and u is our preferred so far.
I have a small doubt about a case when a property may be optional. For example :
constcart={id : 123,giftCardId : undefined}
giftCardId is not always present. Is there an axiomatic method of modeling this case?
A workaround would be to model it as an array with maximum of one element. Other solution would be to add an 'optional' type which would permit null/undefined values.
What do you think?
Cheers,
Karol
The text was updated successfully, but these errors were encountered:
My memory is a bit hazy about this because it's been some time since I have written this library. I believe all the fields in an object are considered optional, we use one bit to encode that information https://github.com/ananthakumaran/u/blob/master/src/object.js#L13. So it should work without any issue.
Hello Anantha,
First of all, thanks for creating this library. We are evaluating different solutions for serializing json in the URL and u is our preferred so far.
I have a small doubt about a case when a property may be optional. For example :
giftCardId is not always present. Is there an axiomatic method of modeling this case?
A workaround would be to model it as an array with maximum of one element. Other solution would be to add an 'optional' type which would permit null/undefined values.
What do you think?
Cheers,
Karol
The text was updated successfully, but these errors were encountered: