Skip to content

Commit

Permalink
feat(refactor): don't strip mandatory properties
Browse files Browse the repository at this point in the history
  • Loading branch information
missinglink committed Jul 7, 2017
1 parent 70086c9 commit 682c81d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 0 additions & 3 deletions Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,8 @@ Document.prototype.toESDocument = function() {
};

// remove empty properties
if( _.isEmpty( doc.name ) ){ delete doc.name; }
if( _.isEmpty( doc.phrase ) ){ delete doc.phrase; }
if( _.isEmpty( doc.parent ) ){ delete doc.parent; }
if( _.isEmpty( doc.address_parts ) ){ delete doc.address_parts; }
if( _.isEmpty( this.center_point ) ){ delete doc.center_point; }
if( _.isEmpty( this.category ) ){ delete doc.category; }

return {
Expand Down
3 changes: 3 additions & 0 deletions test/document/toESDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ module.exports.tests.toESDocument = function(test) {
_type: 'mylayer',
_id: 'myid',
data: {
center_point: {},
layer: 'mylayer',
name: {},
phrase: {},
source: 'mysource',
source_id: 'myid'
}
Expand Down

0 comments on commit 682c81d

Please sign in to comment.