exercism / exercism/javascript-analyzer

Improve resistor-color-duo: detect string concat

未关闭
#55 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
16
派生
21
平均合并
6 小时 53 分钟
30 天内合并 PR
2

描述

**Describe the improvement**:

When the following main method is provided, the analyzer bails early:

```javascript
export const value = arr => {
return +(COLORS.indexOf(arr[0]) + "" + COLORS.indexOf(arr[1]));
};
```

Instead, it should be caught by `hasDigitsString`, and produce the same comment.

**Which exercise**

`resistor-color-duo`

**Additional context**

The `ResistorColorDuoSolution` has a method that checks if an exercise _has a constructed string_. It currently only detects a string template literal that looks like `${a}${b}`, but we want to also capture the following:

```javascript
`${a}` + `${b}`
a + "" + b
a + '' + b
"" + a + b
'' + a + b
a.toString() + b
a.toString() + b.toString()
a.toString().concat(b)
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。