language-javascript-jsx icon indicating copy to clipboard operation
language-javascript-jsx copied to clipboard

Code coloring problem with a RegExp ending with a / after an ||

Open erikras opened this issue 8 years ago • 0 comments

The javascript coloring is being thrown off by an escaped / at the end of a regular expression.

const addProtocol = (url: string): string =>
	(!url || /^https?:\/\//.test(url) ? url : `http://${url}`)

regexp

Interestingly, if you remove the !url || before the RegExp, it works fine. Something about the || is throwing it off.

More info: https://github.com/facebook/nuclide/issues/1121

erikras avatar Apr 27 '17 19:04 erikras