exercism / exercism/javascript-analyzer

Improve resistor-color-duo: detect string concat

Offen
#55 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
16
Forks
21
Ø Merge
6 Std. 53 Min.
Gemergte PRs (30 T.)
2

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.