exercism / exercism/javascript-analyzer

Incorrect Analysis: JavaScript analyzer makes little sense when a object literal is used

オープン
#127 コメント 19 件 リアクション 0 件 担当者 1 名 @Steffe-Dev が担当を希望しています GitHub で見る
good first issue help wanted x:action/improve x:knowledge/elementary x:module/analyzer x:size/small x:type/coding
主要言語
TypeScript
スター
16
フォーク
21
平均マージ
6時間 53分
マージ済み PR(30日)
2

説明

**Describe the incorrectness**

I don't think the analyzers advice makes any sense here:

> Using a helper method is good practice, because it replaces a cryptic "member call" with a named call that can be documented individually.

The advice *assumes* a student is using an array - in which case there is complexity to hide and I agree a function as a named abstraction is useful, but in this case a well-named lookup table is serving the same purpose as a function, so the advice makes little sense.

**Which exercise**

Resistor Duo

**Source file(s)**

```js
export const decodedValue = (colors) => {
const resistorBands = {
black: 0,
brown: 1,
// ...
grey: 8,
white: 9
}
return resistorBands[colors[0]]*10 + resistorBands[colors[1]];

};
```

**Expected analysis**

None. (well at least not on this point)

- You could recommend destructuring of the arguments of course - which I would as a mentor.
- Hoisting the constant to a global.

**Additional context**

None.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。