|
@@ -6,7 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
|
|
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
|
|
|
|
-function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
|
+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);
|
|
|
+ result[key] = value;
|
|
|
+ return result;
|
|
|
+}
|
|
|
|
|
|
var cowValueModel = exports.cowValueModel = function cowValueModel(key) {
|
|
|
var keys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : key.split('.');
|
|
@@ -20,7 +26,7 @@ var cowValueModel = exports.cowValueModel = function cowValueModel(key) {
|
|
|
var key = keys[index],
|
|
|
value = x[key],
|
|
|
modified = setField(value, index + 1, val);
|
|
|
- return value === modified ? x : _extends({}, x, _defineProperty({}, key, modified));
|
|
|
+ return value === modified ? x : copyWith(x, key, modified);
|
|
|
}
|
|
|
|
|
|
var GET_SENTINEL = {};
|