Remove Item class and its associated methods
This commit is contained in:
parent
c5741c2fc1
commit
ecade0cd3e
28
src/item.js
28
src/item.js
@ -1,28 +0,0 @@
|
|||||||
class Item {
|
|
||||||
static get TYPES() {
|
|
||||||
return ["text", "radio", "checkbox", "scale"];
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor({type, title, optTexts, optValues = null}) {
|
|
||||||
this._title = title;
|
|
||||||
this._type = type;
|
|
||||||
this._texts = optTexts;
|
|
||||||
this._values = optValues;
|
|
||||||
this._response = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
static isValid({type, title, optTexts, optValues = null}) {
|
|
||||||
if (!title || !Item.TYPES.includes(type)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (type === "text") {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (optTexts && optValues && optTexts.length !== optValues.length) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Item;
|
|
Loading…
Reference in New Issue
Block a user