Skip to content

Commit 010f0ee

Browse files
committed
change card verification
1 parent 4b81384 commit 010f0ee

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/Services/DataService.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,11 @@ export default function DataService() {
6565
////////////////////////////////////////////////////////////
6666
function tryParce(str) {
6767
try {
68-
return JSON.parse(str, reviver);
68+
return JSON.parse(str);
6969
} catch (e) {
7070
return str;
7171
}
7272
}
73-
function reviver(key, value) {
74-
if (typeof value == 'string' && (Boolean(value) !== undefined)) {
75-
if (value === "false") return false;
76-
if (value === "true") return true;
77-
}
78-
return value;
79-
}
8073

8174
function checkData(data) {
8275
//console.log('start check data')

src/Shared/Card.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ const checkCard = (card) => {
1414
return (
1515
(typeof card.id === "number" || typeof card.id === "string") && !isNaN(card.id) &&
1616
typeof card.name === "string" &&
17-
typeof card.completed === "boolean" &&
17+
typeof card.color === "string" &&
1818
typeof card.text === "string" &&
1919
card instanceof Card
2020
)
2121
}
2222

2323
export class Card {
24-
constructor({ id, name, completed, text }) {
24+
constructor({ id, name, color, text }) {
2525
this.id = Number(id)
2626
this.name = String(name)
27-
this.completed = Boolean(completed)
27+
this.color = String(color)
2828
this.text = String(text)
2929
}
3030
}

0 commit comments

Comments
 (0)