【发布时间】:2019-05-11 13:16:54
【问题描述】:
我搞错了 在那些线上 (127 / 130 / 138) 我不知道代码到底有什么问题,但我想这是语法错误或类似的东西? 任何帮助 相同的代码在 react-script 1.1.0 中运行良好 ps 我正在使用 react-script 3.0.0
handleDBReponse(response) {
const appointments = response;
const today = moment().startOf("day"); //start of today 12 am
const initialSchedule = {};
initialSchedule[today.format("YYYY-DD-MM")] = true;
const schedule = !appointments.length
? initialSchedule
: appointments.reduce((currentSchedule, appointment) => {
const { slot_date, slot_time } = appointment;
const dateString = moment(slot_date, "YYYY-DD-MM").format(
"YYYY-DD-MM"
);
!currentSchedule[slot_date] //line 127
? (currentSchedule[dateString] = Array(8).fill(false))
: null;
Array.isArray(currentSchedule[dateString]) //line130
? (currentSchedule[dateString][slot_time] = true)
: null;
return currentSchedule;
}
, initialSchedule);
for (let day in schedule) {
let slots = schedule[day]; //138
slots.length
? slots.every(slot => slot === true)
? (schedule[day] = true)
: null
: null;
}
【问题讨论】:
-
可能这是 linting 错误,而不是编译错误。
-
@VikashSingh 那我该怎么办?
-
只需禁用 linting 或提高代码质量。
-
@VikashSingh 还是同样的问题:/
标签: javascript node.js reactjs