-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Why is true JSON but not false? Or 5 JSON but not 0? Of all the falsey values, only undefined cannot be stringified and is not valid JSON by any RFC/specification. true, 5, and 2.5 may or may not be valid JSON depending on what authority you cite, but I cannot conceive of a justifcation for including them while excluding , nullfalse, 0, and 0.0.
The inconsistency seems problematic due to the use of this package within KOA itself. The behavior is wrong, yet deviation in custom middleware could cause as many bugs as it fixes.
(Update: I should acknowledge that there does need to be one value which indicates that there is no value, and that while undefined is most likely the clear winner, excluding null is likely to produce breaking changes in Koa with meaningful impact).