Replace .map() with .forEach() where return value is unused
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -401,7 +401,7 @@ export default {
|
||||
};
|
||||
|
||||
mapData.edges = [];
|
||||
this[mapType].edges.map(edge => {
|
||||
this[mapType].edges.forEach(edge => {
|
||||
mapData.edges.push({
|
||||
data: {
|
||||
source: edge.tail,
|
||||
@@ -444,7 +444,7 @@ export default {
|
||||
// 找出 type activity's node
|
||||
const activityNodeArray = nodes.filter(node => node.data.type === 'activity');
|
||||
// 找出除了 start, end 以外所有的 node 的 option value
|
||||
activityNodeArray.map(node => nodeOptionArr.push(node.data[this.dataLayerType][this.dataLayerOption]));
|
||||
activityNodeArray.forEach(node => nodeOptionArr.push(node.data[this.dataLayerType][this.dataLayerOption]));
|
||||
// 將node的option值從小到大排序(映對色階淺到深)
|
||||
nodeOptionArr = nodeOptionArr.sort((a, b) => a - b);
|
||||
for (let i = 0; i < ImgCapsules.length; i++) {
|
||||
@@ -453,10 +453,10 @@ export default {
|
||||
leveledGroups.push(nodeOptionArr.slice(startIdx, endIdx));
|
||||
}
|
||||
for (let level = 0; level < leveledGroups.length; level++) {
|
||||
leveledGroups[level].map(option => {
|
||||
leveledGroups[level].forEach(option => {
|
||||
// 考慮可能有名次一樣的情形
|
||||
const curNodes = activityNodeArray.filter(activityNode => activityNode.data[this.dataLayerType][this.dataLayerOption] === option);
|
||||
curNodes.map(curNode => {
|
||||
curNodes.forEach(curNode => {
|
||||
curNode.data = {
|
||||
...curNode.data,
|
||||
nodeImageUrl: ImgCapsules[level],
|
||||
|
||||
Reference in New Issue
Block a user