Browse Source

Babel runtime doesn't like `{...null}`.

Herbert Vojčík 6 years ago
parent
commit
1f7a023196
2 changed files with 2 additions and 2 deletions
  1. 1 1
      lib/cow-value-model.js
  2. 1 1
      src/cow-value-model.js

+ 1 - 1
lib/cow-value-model.js

@@ -9,7 +9,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
 function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
 
 function copyWith(obj, key, value) {
-    var result = typeof key === 'number' ? [].concat(_toConsumableArray(obj)) : _extends({}, obj);
+    var result = typeof key === 'number' ? obj == null ? [] : [].concat(_toConsumableArray(obj)) : obj == null ? {} : _extends({}, obj);
     result[key] = value;
     return result;
 }

+ 1 - 1
src/cow-value-model.js

@@ -1,5 +1,5 @@
 function copyWith (obj, key, value) {
-    const result = typeof key === 'number' ? [...obj] : {...obj};
+    const result = typeof key === 'number' ? obj == null ? [] : [...obj] : obj == null ? {} : {...obj};
     result[key] = value;
     return result;
 }