Skip to content

Commit

Permalink
Fix reducedObject when default property is undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
Soreine committed Jul 11, 2016
1 parent 0349f54 commit 2a116df
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/utils/reducedObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ var Immutable = require('immutable');
* Reduce the difference between a map and its default version
* @param {Map} defaultVersion
* @param {Map} currentVersion
* @return {Map} The properties of currentVersion that differs from defaultVersion
*/
function reducedObject(defaultVersion, currentVersion) {
if(defaultVersion === undefined) {
return currentVersion;
}

return currentVersion.reduce(function(result, value, key) {
var defaultValue = defaultVersion.get(key);

Expand Down

0 comments on commit 2a116df

Please sign in to comment.