palkan / view_component-contrib

A collection of extension and developer tools for ViewComponent
MIT License
369 stars 22 forks source link

Update readme to make js controller identifier identical to ruby one #6

Closed muriloime closed 3 years ago

muriloime commented 3 years ago

Hi @palkan

Js replace method replaces only the first occurrence. In order to reflect the definition in ruby code we need to use replaceAll.

Cheers

Spone commented 3 years ago

Hi! With older versions of node (< 15.0.0), this will trigger a TypeError: replaceAll is not a function (source).

I would suggest this fix instead, to preserve compatibility:

- .replace(/\//, '--');
+ .replace(/\//g, '--');

What do you think? Do you want me to I open a PR for this?

palkan commented 3 years ago

@Spone Thanks for pointing to this 👍

Do you want me to I open a PR for this?

Yes, please)