summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSoreine <nicolas@gitbook.com>2016-07-11 15:14:29 +0200
committerSoreine <nicolas@gitbook.com>2016-07-11 15:18:35 +0200
commit2a116dfdb0d85d10a4dc4c426c0cd3cce0a785af (patch)
tree150242f41dd8f54ae63c1e3ce07740da12f6ec6c /lib
parent0349f54f3c70b6f71b6d619f618129913cfc0b4f (diff)
downloadgitbook-2a116dfdb0d85d10a4dc4c426c0cd3cce0a785af.zip
gitbook-2a116dfdb0d85d10a4dc4c426c0cd3cce0a785af.tar.gz
gitbook-2a116dfdb0d85d10a4dc4c426c0cd3cce0a785af.tar.bz2
Fix reducedObject when default property is undefined
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/reducedObject.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/utils/reducedObject.js b/lib/utils/reducedObject.js
index fa5d32c..7bcfd5b 100644
--- a/lib/utils/reducedObject.js
+++ b/lib/utils/reducedObject.js
@@ -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);