openexchangerates / accounting.js

A lightweight JavaScript library for number, money and currency formatting - fully localisable, zero dependencies.
http://openexchangerates.github.io/accounting.js
MIT License
4.95k stars 528 forks source link

Regex flags #185

Open ibrahimbutt opened 6 years ago

ibrahimbutt commented 6 years ago

As per the ECMAScript, the flags in RegExp should simply be strings. The fact that the code still works is because RegExp applies toString on the flags. When there is only one element in the array, it works fine, but if there is another flag, e.g ["g", "i"], it will result in "g,i", which throws a SyntaxError.