final-form-calculate
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -87,30 +87,32 @@ 'use strict'; | ||
var runUpdates = function runUpdates(field, updates) { | ||
var next = getIn(values, field); | ||
var previous = getIn(previousValues, field); | ||
if (next !== previous) { | ||
Object.keys(updates).forEach(function (destField) { | ||
var update = updates[destField]; | ||
form.change(destField, update(next, values)); | ||
}); | ||
} | ||
}; | ||
var fields = form.getRegisteredFields(); | ||
calculations.forEach(function (_ref2) { | ||
var field = _ref2.field, | ||
updates = _ref2.updates; | ||
form.batch(function () { | ||
var runUpdates = function runUpdates(field, updates) { | ||
var next = getIn(values, field); | ||
var previous = getIn(previousValues, field); | ||
if (next !== previous) { | ||
Object.keys(updates).forEach(function (destField) { | ||
var update = updates[destField]; | ||
form.change(destField, update(next, values)); | ||
}); | ||
} | ||
}; | ||
var fields = form.getRegisteredFields(); | ||
calculations.forEach(function (_ref2) { | ||
var field = _ref2.field, | ||
updates = _ref2.updates; | ||
if (typeof field === 'string') { | ||
runUpdates(field, updates); | ||
} else { | ||
// field is a regex | ||
var regex = field; | ||
fields.forEach(function (fieldName) { | ||
if (regex.test(fieldName)) { | ||
runUpdates(fieldName, updates); | ||
} | ||
}); | ||
} | ||
if (typeof field === 'string') { | ||
runUpdates(field, updates); | ||
} else { | ||
// field is a regex | ||
var regex = field; | ||
fields.forEach(function (fieldName) { | ||
if (regex.test(fieldName)) { | ||
runUpdates(fieldName, updates); | ||
} | ||
}); | ||
} | ||
}); | ||
previousValues = values; | ||
}); | ||
previousValues = values; | ||
}, { values: true }); | ||
@@ -117,0 +119,0 @@ return unsubscribe; |
@@ -85,30 +85,32 @@ // | ||
var runUpdates = function runUpdates(field, updates) { | ||
var next = getIn(values, field); | ||
var previous = getIn(previousValues, field); | ||
if (next !== previous) { | ||
Object.keys(updates).forEach(function (destField) { | ||
var update = updates[destField]; | ||
form.change(destField, update(next, values)); | ||
}); | ||
} | ||
}; | ||
var fields = form.getRegisteredFields(); | ||
calculations.forEach(function (_ref2) { | ||
var field = _ref2.field, | ||
updates = _ref2.updates; | ||
form.batch(function () { | ||
var runUpdates = function runUpdates(field, updates) { | ||
var next = getIn(values, field); | ||
var previous = getIn(previousValues, field); | ||
if (next !== previous) { | ||
Object.keys(updates).forEach(function (destField) { | ||
var update = updates[destField]; | ||
form.change(destField, update(next, values)); | ||
}); | ||
} | ||
}; | ||
var fields = form.getRegisteredFields(); | ||
calculations.forEach(function (_ref2) { | ||
var field = _ref2.field, | ||
updates = _ref2.updates; | ||
if (typeof field === 'string') { | ||
runUpdates(field, updates); | ||
} else { | ||
// field is a regex | ||
var regex = field; | ||
fields.forEach(function (fieldName) { | ||
if (regex.test(fieldName)) { | ||
runUpdates(fieldName, updates); | ||
} | ||
}); | ||
} | ||
if (typeof field === 'string') { | ||
runUpdates(field, updates); | ||
} else { | ||
// field is a regex | ||
var regex = field; | ||
fields.forEach(function (fieldName) { | ||
if (regex.test(fieldName)) { | ||
runUpdates(fieldName, updates); | ||
} | ||
}); | ||
} | ||
}); | ||
previousValues = values; | ||
}); | ||
previousValues = values; | ||
}, { values: true }); | ||
@@ -115,0 +117,0 @@ return unsubscribe; |
@@ -91,30 +91,32 @@ (function (global, factory) { | ||
var runUpdates = function runUpdates(field, updates) { | ||
var next = getIn(values, field); | ||
var previous = getIn(previousValues, field); | ||
if (next !== previous) { | ||
Object.keys(updates).forEach(function (destField) { | ||
var update = updates[destField]; | ||
form.change(destField, update(next, values)); | ||
}); | ||
} | ||
}; | ||
var fields = form.getRegisteredFields(); | ||
calculations.forEach(function (_ref2) { | ||
var field = _ref2.field, | ||
updates = _ref2.updates; | ||
form.batch(function () { | ||
var runUpdates = function runUpdates(field, updates) { | ||
var next = getIn(values, field); | ||
var previous = getIn(previousValues, field); | ||
if (next !== previous) { | ||
Object.keys(updates).forEach(function (destField) { | ||
var update = updates[destField]; | ||
form.change(destField, update(next, values)); | ||
}); | ||
} | ||
}; | ||
var fields = form.getRegisteredFields(); | ||
calculations.forEach(function (_ref2) { | ||
var field = _ref2.field, | ||
updates = _ref2.updates; | ||
if (typeof field === 'string') { | ||
runUpdates(field, updates); | ||
} else { | ||
// field is a regex | ||
var regex = field; | ||
fields.forEach(function (fieldName) { | ||
if (regex.test(fieldName)) { | ||
runUpdates(fieldName, updates); | ||
} | ||
}); | ||
} | ||
if (typeof field === 'string') { | ||
runUpdates(field, updates); | ||
} else { | ||
// field is a regex | ||
var regex = field; | ||
fields.forEach(function (fieldName) { | ||
if (regex.test(fieldName)) { | ||
runUpdates(fieldName, updates); | ||
} | ||
}); | ||
} | ||
}); | ||
previousValues = values; | ||
}); | ||
previousValues = values; | ||
}, { values: true }); | ||
@@ -121,0 +123,0 @@ return unsubscribe; |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t["final-form-calculate"]=e()}(this,function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e=function(e,r){var n=function(t){if(null===t||void 0===t)return[];if("string"!=typeof t)throw new Error("toPath() expects a string");return t.length?t.split(/[.[\]]+/).filter(Boolean):[]}(r),o=e,i=!0,f=!1,u=void 0;try{for(var a,c=n[Symbol.iterator]();!(i=(a=c.next()).done);i=!0){var l=a.value;if(void 0===o||null===o||"object"!==(void 0===o?"undefined":t(o))||Array.isArray(o)&&isNaN(l))return;o=o[l]}}catch(t){f=!0,u=t}finally{try{!i&&c.return&&c.return()}finally{if(f)throw u}}return o};return function(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++)r[n]=arguments[n];return function(t){var n={};return t.subscribe(function(o){var i=o.values,f=function(r,o){var f=e(i,r),u=e(n,r);f!==u&&Object.keys(o).forEach(function(e){var r=o[e];t.change(e,r(f,i))})},u=t.getRegisteredFields();r.forEach(function(t){var e=t.field,r=t.updates;if("string"==typeof e)f(e,r);else{var n=e;u.forEach(function(t){n.test(t)&&f(t,r)})}}),n=i},{values:!0})}}}); | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):t["final-form-calculate"]=r()}(this,function(){"use strict";var t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r=function(r,e){var n=function(t){if(null===t||void 0===t)return[];if("string"!=typeof t)throw new Error("toPath() expects a string");return t.length?t.split(/[.[\]]+/).filter(Boolean):[]}(e),o=r,i=!0,f=!1,u=void 0;try{for(var a,c=n[Symbol.iterator]();!(i=(a=c.next()).done);i=!0){var l=a.value;if(void 0===o||null===o||"object"!==(void 0===o?"undefined":t(o))||Array.isArray(o)&&isNaN(l))return;o=o[l]}}catch(t){f=!0,u=t}finally{try{!i&&c.return&&c.return()}finally{if(f)throw u}}return o};return function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(t){var n={};return t.subscribe(function(o){var i=o.values;t.batch(function(){var o=function(e,o){var f=r(i,e),u=r(n,e);f!==u&&Object.keys(o).forEach(function(r){var e=o[r];t.change(r,e(f,i))})},f=t.getRegisteredFields();e.forEach(function(t){var r=t.field,e=t.updates;if("string"==typeof r)o(r,e);else{var n=r;f.forEach(function(t){n.test(t)&&o(t,e)})}}),n=i})},{values:!0})}}}); | ||
//# sourceMappingURL=final-form-calculate.umd.min.js.map |
{ | ||
"name": "final-form-calculate", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": | ||
@@ -5,0 +5,0 @@ "Decorator for calculating field values based on other field values in 🏁 Final Form", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
17524
288