bevry-archive / bal-util

Utility functions for JavaScript and Node.js used and maintained by Benjamin Lupton

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

getLocaleCode() null error

Limfocit opened this issue · comments

After updating docpad to v 6.24.2 I startedd getting error, that null object doesn't have replace() method. This error pointed on file modules.js in this module, line 69 code:

localeCode = balUtilModules.getLocaleCode(localeCode);
countryCode = localeCode.replace(/^([a-z]+)_-$/i, '$2').toLowerCase() || null;

So I changed getLocaleCode() method like this(replaced null):

localeCode = lang.replace(/..+/, '').replace('-', '_').toLowerCase() || "";

Maybe this need to be included in code?

Should be fixed with v1.16.11, can you confirm?

Yes! Thats great)