_mercury
_mercury2y ago

✅ – _mercury – 21-51 Aug 29

why parseInt does not work here
groups.forEach((group) => {
return Object.keys(group).forEach((key) => {
if (key === 'attributes_count' || key === 'templates_count') {
parseInt(group[key]);
}
if (!group[key]) {
delete group[key];
}
});
});
groups.forEach((group) => {
return Object.keys(group).forEach((key) => {
if (key === 'attributes_count' || key === 'templates_count') {
parseInt(group[key]);
}
if (!group[key]) {
delete group[key];
}
});
});
20 Replies
_mercury
_mercury2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
_mercury
_mercury2y ago
so?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
_mercury
_mercury2y ago
yes the second if works why ?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
_mercury
_mercury2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
_mercury
_mercury2y ago
groups.forEach((group) => {
return Object.keys(group).forEach((key) => {
if (key === 'attributes_count' || key === 'templates_count') {
group[key] = parseInt(group[key]);
}
if (!group[key]) {
delete group[key];
}
});
});
groups.forEach((group) => {
return Object.keys(group).forEach((key) => {
if (key === 'attributes_count' || key === 'templates_count') {
group[key] = parseInt(group[key]);
}
if (!group[key]) {
delete group[key];
}
});
});
attributes_count + trmplates_count disappear
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
_mercury
_mercury2y ago
Ok i got that , thx .. but keys disppaear
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
_mercury
_mercury2y ago
group[key] = parseInt(group[key]) || 0; same issue
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
_mercury
_mercury2y ago
Aha
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
_mercury
_mercury2y ago
ok thanx
groups.forEach((group) => {
return Object.keys(group).forEach((key) => {
if (!group[key]) {
delete group[key];
}
if (key === 'attributes_count' || key === 'templates_count') {
group[key] = parseInt(group[key]) || 0;
}
});
});
groups.forEach((group) => {
return Object.keys(group).forEach((key) => {
if (!group[key]) {
delete group[key];
}
if (key === 'attributes_count' || key === 'templates_count') {
group[key] = parseInt(group[key]) || 0;
}
});
});
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
_mercury
_mercury2y ago
I raised the delete up and now it works thanx for smashing that
reactibot
reactibot2y ago
This question has an answer! Thank you for helping 😄 If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1013928854731112478 This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1013928854731112478