Skip to content

Commit

Permalink
Use typeof checks for undefined for global variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ichernev committed Jan 9, 2016
1 parent 74141ae commit ccbb6c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/lib/locale/locales.js
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/lib/utils/deprecate.js
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit ccbb6c2

Please sign in to comment.