UNPKG

1.19 kBJavaScriptView Raw
1var globalScope;
2if (typeof window === 'undefined') {
3 if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
4 // TODO: Replace any with WorkerGlobalScope from lib.webworker.d.ts #3492
5 globalScope = self;
6 }
7 else {
8 globalScope = global;
9 }
10}
11else {
12 globalScope = window;
13}
14// Need to declare a new variable for global here since TypeScript
15// exports the original value of the symbol.
16var _global = globalScope;
17export { _global as global };
18export function isPresent(obj) {
19 return obj != null;
20}
21export function stringify(token) {
22 if (typeof token === 'string') {
23 return token;
24 }
25 if (token == null) {
26 return '' + token;
27 }
28 if (token.overriddenName) {
29 return "" + token.overriddenName;
30 }
31 if (token.name) {
32 return "" + token.name;
33 }
34 var res = token.toString();
35 var newLineIndex = res.indexOf('\n');
36 return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
37}
38var DebugContext = /** @class */ (function () {
39 function DebugContext() {
40 }
41 return DebugContext;
42}());
43export { DebugContext };
44//# sourceMappingURL=lang.js.map
\No newline at end of file