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 null, false, 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).
Why is
trueJSON but notfalse? Or5JSON but not0? Of all the falsey values, onlyundefinedcannot be stringified and is not valid JSON by any RFC/specification.true,5, and2.5may 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, and0.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
undefinedis most likely the clear winner, excludingnullis likely to produce breaking changes in Koa with meaningful impact).