@commodo/fields
Advanced tools
Comparing version 1.0.3-next.1 to 1.0.3-next.7
@@ -27,3 +27,3 @@ "use strict"; | ||
rest = (0, _objectWithoutProperties2.default)(_ref, ["list"]); | ||
const field = (0, _createField.default)(_objectSpread({}, rest, { | ||
const field = (0, _createField.default)(_objectSpread(_objectSpread({}, rest), {}, { | ||
list, | ||
@@ -30,0 +30,0 @@ type: "boolean" |
@@ -94,3 +94,3 @@ "use strict"; | ||
if (typeof this.validation === "function") { | ||
await this.validation((await this.getValue())); | ||
await this.validation(await this.getValue()); | ||
} | ||
@@ -97,0 +97,0 @@ }; |
@@ -62,3 +62,3 @@ "use strict"; | ||
const field = (0, _createField.default)(_objectSpread({}, rest, { | ||
const field = (0, _createField.default)(_objectSpread(_objectSpread({}, rest), {}, { | ||
list, | ||
@@ -65,0 +65,0 @@ type: "fields" |
@@ -27,3 +27,3 @@ "use strict"; | ||
rest = (0, _objectWithoutProperties2.default)(_ref, ["list"]); | ||
const field = (0, _createField.default)(_objectSpread({}, rest, { | ||
const field = (0, _createField.default)(_objectSpread(_objectSpread({}, rest), {}, { | ||
list, | ||
@@ -30,0 +30,0 @@ type: "number" |
@@ -27,3 +27,3 @@ "use strict"; | ||
rest = (0, _objectWithoutProperties2.default)(_ref, ["list"]); | ||
let field = (0, _createField.default)(_objectSpread({}, rest, { | ||
let field = (0, _createField.default)(_objectSpread(_objectSpread({}, rest), {}, { | ||
list, | ||
@@ -30,0 +30,0 @@ type: "string" |
12
onSet.js
@@ -10,2 +10,6 @@ "use strict"; | ||
function isPromise(value) { | ||
return Boolean(value && typeof value.then === "function"); | ||
} | ||
const onSet = callback => { | ||
@@ -18,3 +22,9 @@ return (0, _repropose.withProps)(props => { | ||
setValue(value) { | ||
return setValue.call(this, callback(value)); | ||
const newValue = callback(value); | ||
if (isPromise(newValue)) { | ||
throw new Error(`A promise was returned from the "onSet" callback (applied on the "${props.name}" field). Provided callbacks cannot perform async operations.`); | ||
} | ||
return setValue.call(this, newValue); | ||
} | ||
@@ -21,0 +31,0 @@ |
{ | ||
"name": "@commodo/fields", | ||
"version": "1.0.3-next.1", | ||
"version": "1.0.3-next.7", | ||
"main": "index.js", | ||
@@ -28,3 +28,3 @@ "repository": { | ||
}, | ||
"gitHead": "b1f1826e2285e793fe5ea47a26b429e1e3c54001" | ||
"gitHead": "6046b882b2d50608a7e970fc052ee67dd8718073" | ||
} |
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
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
70982
753