Commit c915f90b authored by Aurélien Vermylen's avatar Aurélien Vermylen Committed by Romain Courteaud

Fix util.stringify for null objects.

jIO.util.stringify({y: null}) used to error. Now it behaves similarly
to JSON.stringify, returning '{"y":null}'.

/reviewed-on nexedi/jio!80
parent 81cb08dd
......@@ -132,6 +132,9 @@
if (obj === undefined) {
return undefined;
}
if (obj === null) {
return 'null';
}
if (obj.constructor === Object) {
key_list = Object.keys(obj).sort();
result_list = [];
......
......@@ -24,6 +24,8 @@
equal(str(Object.create(null, { x: { value: 'x', enumerable: false },
y: { value: 'y', enumerable: true } })),
'{"y":"y"}');
equal(str({y: "y", testnull: null}),
'{"testnull":null,"y":"y"}');
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment