Skip to content

Commit

Permalink
Merge pull request #161 from refractproject/kylef/empty-array
Browse files Browse the repository at this point in the history
Serialise empty arrays in 0.6
  • Loading branch information
kylef authored Dec 12, 2017
2 parents ceb1483 + 7aed154 commit adae793
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# 0.20.2

## Bug Fixes

- The JSON 0.6 serialiser will now serialise empty content arrays. A regression
caused in 0.20.1 because of the logic was applied to both Refract JSON 1.0
and 0.6 serialisers.

# 0.20.1

## Bug Fixes
Expand Down
4 changes: 0 additions & 4 deletions lib/serialisers/json-0.6.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,6 @@ module.exports = createClass({

return pair;
} else if (content && content.map) {
if (content.length === 0) {
return;
}

return content.map(this.serialise, this);
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "minim",
"version": "0.20.1",
"version": "0.20.2",
"description": "A library for interacting with JSON through Refract elements",
"main": "lib/minim.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions test/serialisers/json-0.6.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ describe('JSON 0.6 Serialiser', function() {

expect(object).to.deep.equal({
element: 'array',
content: []
});
});

Expand Down

0 comments on commit adae793

Please sign in to comment.