Skip to content

Commit

Permalink
Merge pull request moment#2865 from ichernev:fix-undefined-checks
Browse files Browse the repository at this point in the history
Use typeof checks for undefined for global variables
  • Loading branch information
ichernev committed Jan 9, 2016
2 parents 74141ae + 66bb2d9 commit 5925ade
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 5925ade

Please sign in to comment.