]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
Use typeof checks for undefined for global variables
authorIskren Chernev <iskren.chernev@gmail.com>
Tue, 5 Jan 2016 19:15:46 +0000 (21:15 +0200)
committerIskren Chernev <iskren.chernev@gmail.com>
Sat, 9 Jan 2016 09:38:04 +0000 (11:38 +0200)
src/lib/locale/locales.js
src/lib/utils/deprecate.js

index cf2c3292e03d01880c77ac3cadccbdac45ac0e98..9929f3285b435b93b075e002351224e45e95baff 100644 (file)
@@ -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;
index 1b7813177c664a23fe71cbd11b117d0b264a26c0..7fa8bf7c3e5c7bef3e159614d4146ee3f36f4310 100644 (file)
@@ -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);
     }
 }