Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve resistor-color-duo: detect string concat #55

Open
SleeplessByte opened this issue Sep 26, 2019 · 0 comments
Open

Improve resistor-color-duo: detect string concat #55

SleeplessByte opened this issue Sep 26, 2019 · 0 comments

Comments

@SleeplessByte
Copy link
Member

Describe the improvement:

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

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:

`${a}` + `${b}`
a + "" + b
a + '' + b
""  + a + b
''  + a + b
a.toString() + b
a.toString() + b.toString()
a.toString().concat(b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant