function loadLocale(name) {
var oldLocale = null,
- aliasedRequire;
+ aliasedRequire,
+ localePath;
// TODO: Find a better way to register and load all the locales in Node
if (
locales[name] === undefined &&
try {
oldLocale = globalLocale._abbr;
aliasedRequire = require;
- aliasedRequire(
- (typeof __dirname !== undefined ? __dirname : '.') +
- '/locale/' +
- name
- );
+ localePath = (typeof __dirname !== 'undefined' ? __dirname : '.') +
+ '/locale/' +
+ name;
+ aliasedRequire(localePath);
getSetGlobalLocale(oldLocale);
} catch (e) {
// mark as not found to avoid repeating expensive file require call causing high CPU
proto.toDate = toDate;
proto.toISOString = toISOString;
proto.inspect = inspect;
-if (typeof Symbol !== undefined && Symbol.for != null) {
+if (typeof Symbol !== 'undefined' && Symbol.for != null) {
proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
return 'Moment<' + this.format() + '>';
};