Skip to content

Commit

Permalink
fix(core): guard reading of global ngDevMode for undefined. (#36055)
Browse files Browse the repository at this point in the history
When reading globals such as `ngDevMode` the read should be guarded by `typeof ngDevMode` otherwise it will throw if not
defined in `"use strict"` mode.

PR Close #36055
  • Loading branch information
mcalmus authored and AndrewKushnir committed Oct 16, 2020
1 parent a3812c6 commit 4610093
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/util/ng_dev_mode.ts
Expand Up @@ -115,7 +115,7 @@ export function initNgDevMode(): boolean {
if (typeof ngDevMode !== 'object') {
ngDevModeResetPerfCounters();
}
return !!ngDevMode;
return typeof ngDevMode !== 'undefined' && !!ngDevMode;
}
return false;
}

0 comments on commit 4610093

Please sign in to comment.