TypeError in Locale initializer.
Closed this issue · 0 comments
jdreux commented
Getting the following exception in certain cases:
TypeError: Cannot read property '0' of null
at new Locale (/lexit/public-ws/node_modules/locale/lib/index.js:26:52)
at new Locales (/lexit/public-ws/node_modules/locale/lib/index.js:64:18)
Can't be more specific on the actual circumstances because this happen in a production server.
The problem seems to be around this code:
function Locale(str) {
var country, language, _ref;
if (!str) return;
--> _ref = str.match(/[a-z]+/gi), language = _ref[0], country = _ref[1];
this.language = language.toLowerCase();
if (country) this.country = country.toUpperCase();
}