: https://stackoverflow.com/questions/16908476/object-property-name-as-number
isNaN(null) // false
isNaN(0) // false
isNaN() // true
function list() {
console.log("[list]");
const data = [
{
id: "order",
title: "카드1",
className: "w100",
sort: 1,
template: "order-template",
position: {},
},
{
id: "claim",
title: "카드2",
className: "w50",
sort: 2,
position: {},
template: "claim-template",
data: {
text: "abc",
url: "",
}
},
{
id: "card-3",
title: "카드3",
className: "w25",
sort: 3,
position: {},
},
{
id: "card-4",
title: "카드4",
className: "w25",
sort: 4,
position: {},
},
];
const layoutData = localStorage.getItem("layoutData");
if (typeof layoutData === "string") {
try {
console.log(layoutData);
return Promise.resolve(JSON.parse(layoutData));
} catch (error) {
return Promise.resolve(data);
}
} else {
return Promise.resolve(data);
}
}