Permalink
Browse files

[dumper] Fix style choosing for empty collections. Closes #69

  • Loading branch information...
1 parent cde7e40 commit 1d706de308de910323c28f59605248cb497a2ee6 @dervus dervus committed Feb 25, 2013
View
@@ -1,3 +1,9 @@
+2.0.3 / 2013-02-26
+------------------
+
+* Fixed dumping of empty arrays ans objects. ([] and {} instead of null)
+
+
2.0.2 / 2013-02-15
------------------
View
@@ -399,13 +399,13 @@ function dump(input, options) {
}
if ('object' === kind) {
- if (block) {
+ if (block && (0 !== Object.keys(result).length)) {
writeBlockMapping(level, result, compact);
} else {
writeFlowMapping(level, result);
}
} else if ('array' === kind) {
- if (block) {
+ if (block && (0 !== result.length)) {
writeBlockSequence(level, result, compact);
} else {
writeFlowSequence(level, result);
@@ -0,0 +1,7 @@
+'use strict';
+
+
+module.exports = {
+ emptyArray: [],
+ emptyObject: {}
+};
@@ -0,0 +1,2 @@
+emptyArray: []
+emptyObject: {}

0 comments on commit 1d706de

Please sign in to comment.