mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-23 19:06:31 +00:00
Fix reducedObject when default property is undefined
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user