345 label: t(item.attribute.tsKey, { ns: item.attribute.tsNs }),
346 value: item.attribute.id,
347 })
348 return349 }
350 return {
351 label: t(item.attribute.tsKey, { ns: item.attribute.tsNs }),
284 label: t(item.attribute.tsKey, { ns: item.attribute.tsNs }),
285 value: item.attribute.id,
286 })
287 return288 }
289
290 return {
101 </Text>
102 <Text variant={variants.Text.utility4darkGray} pb={12}>
103 Available at:{' '}
104 {locations.map((name, i, arr) => {105 if (arr.length > i + 1)
106 return `${(<u key={`${id}-${i}`}>{name}</u>)}, `
107 if (arr.length === i + 1) {
173 },
174 }
175 }
176 return177 })
178 )
179 if (updated.length) {
156 const originalRecord = data?.results.find(
157 (original) => orgId === original.orgId && locationId === original.locationId
158 )
159 if (!originalRecord) return160
161 return {
162 id: locationId,
Array
has several methods for filtering, mapping, and folding.
If we forget to write return statement in a callback of those, it's probably a mistake.
If you don't want to use a return
or don't need the returned results, consider using .forEach
instead.
const indexMap = myArray.reduce(function(memo, item, index) {
memo[item] = index;
}, {});
const foo = Array.from(nodes, function(node) {
if (node.tagName === "DIV") {
return true;
}
});
const bar = foo.filter(function(x) {
if (x) {
return true;
} else {
return;
}
});
const indexMap = myArray.reduce(function(memo, item, index) {
memo[item] = index;
return memo;
}, {});
const foo = Array.from(nodes, function(node) {
if (node.tagName === "DIV") {
return true;
}
return false;
});
const bar = foo.map(node => node.getAttribute("id"));