form-payload 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-form-control-payload.d.ts","sourceRoot":"","sources":["../../../../src/packages/get-form-control-payload/get-form-control-payload.js"],"names":[],"mappings":"qCAcc,OAAO,2BAA2B,EAAE,sBAAsB;gDAC1D,OAAO,2BAA2B,EAAE,iCAAiC;AA+BnF;;;;;GAKG;AACH,sEAJW,iCAAiC,
|
|
1
|
+
{"version":3,"file":"get-form-control-payload.d.ts","sourceRoot":"","sources":["../../../../src/packages/get-form-control-payload/get-form-control-payload.js"],"names":[],"mappings":"qCAcc,OAAO,2BAA2B,EAAE,sBAAsB;gDAC1D,OAAO,2BAA2B,EAAE,iCAAiC;AA+BnF;;;;;GAKG;AACH,sEAJW,iCAAiC,KA6F3C;AA/HD,mGAAmG;AACnG,yHAAyH;AAEzH;;;;GAIG;AACH,8FAHc,sBAAsB,OAyBnC"}
|
|
@@ -51,6 +51,14 @@ const getFormControlsPayload = (...controlElements) => {
|
|
|
51
51
|
* @throws {FormPayloadError}
|
|
52
52
|
*/
|
|
53
53
|
const getFormControlPayload = (controlNode) => {
|
|
54
|
+
const hasType = 'type' in controlNode;
|
|
55
|
+
|
|
56
|
+
if (!hasType) {
|
|
57
|
+
throw new FormPayloadError({
|
|
58
|
+
message: 'Control element has no type attribute.',
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
54
62
|
switch (controlNode.type) {
|
|
55
63
|
case ControlType.TEXT:
|
|
56
64
|
case ControlType.PASSWORD:
|
|
@@ -129,7 +137,7 @@ const getFormControlPayload = (controlNode) => {
|
|
|
129
137
|
}
|
|
130
138
|
|
|
131
139
|
throw new FormPayloadError({
|
|
132
|
-
message: `Unsupported control type – ${controlNode.type}.`,
|
|
140
|
+
message: `Unsupported control element type – ${controlNode.type}.`,
|
|
133
141
|
});
|
|
134
142
|
};
|
|
135
143
|
|