exercism / exercism/javascript-analyzer

Improve resistor-color-duo: detect string concat

Đang mở
#55 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
16
Fork
21
Merge trung bình
6 giờ 53 phút
Pull request đã merge (30 ngày)
2

Mô tả

**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)
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.