From: Iskren Chernev Date: Tue, 5 Jan 2016 19:15:46 +0000 (+0200) Subject: Use typeof checks for undefined for global variables X-Git-Tag: 2.11.1~9^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ccbb6c2a0340a4109a274998ac64fd14eeae833a;p=thirdparty%2Fmoment.git Use typeof checks for undefined for global variables --- diff --git a/src/lib/locale/locales.js b/src/lib/locale/locales.js index cf2c3292e..9929f3285 100644 --- a/src/lib/locale/locales.js +++ b/src/lib/locale/locales.js @@ -41,7 +41,7 @@ function chooseLocale(names) { function loadLocale(name) { var oldLocale = null; // TODO: Find a better way to register and load all the locales in Node - if (!locales[name] && !isUndefined(module) && + if (!locales[name] && (typeof module !== "undefined") && module && module.exports) { try { oldLocale = globalLocale._abbr; diff --git a/src/lib/utils/deprecate.js b/src/lib/utils/deprecate.js index 1b7813177..7fa8bf7c3 100644 --- a/src/lib/utils/deprecate.js +++ b/src/lib/utils/deprecate.js @@ -3,7 +3,8 @@ import { hooks } from './hooks'; import isUndefined from './is-undefined'; function warn(msg) { - if (hooks.suppressDeprecationWarnings === false && !isUndefined(console) && console.warn) { + if (hooks.suppressDeprecationWarnings === false && + (typeof console !== "undefined") && console.warn) { console.warn('Deprecation warning: ' + msg); } }