/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var /** @type {?} */ globalScope; if (typeof window === 'undefined') { if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) { // TODO: Replace any with WorkerGlobalScope from lib.webworker.d.ts #3492 globalScope = (self); } else { globalScope = (global); } } else { globalScope = (window); } /** * @param {?} fn * @return {?} */ export function scheduleMicroTask(fn) { Zone.current.scheduleMicroTask('scheduleMicrotask', fn); } // Need to declare a new variable for global here since TypeScript // exports the original value of the symbol. var /** @type {?} */ _global = globalScope; export { _global as global }; /** * @param {?} type * @return {?} */ export function getTypeNameForDebugging(type) { return type['name'] || typeof type; } // TODO: remove calls to assert in production environment // Note: Can't just export this and import in in other files // as `assert` is a reserved keyword in Dart _global.assert = function assert(condition) { // TODO: to be fixed properly via #2830, noop for now }; /** * @param {?} obj * @return {?} */ export function isPresent(obj) { return obj != null; } /** * @param {?} obj * @return {?} */ export function isBlank(obj) { return obj == null; } var /** @type {?} */ STRING_MAP_PROTO = Object.getPrototypeOf({}); /** * @param {?} obj * @return {?} */ export function isStrictStringMap(obj) { return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO; } /** * @param {?} obj * @return {?} */ export function isDate(obj) { return obj instanceof Date && !isNaN(obj.valueOf()); } /** * @param {?} token * @return {?} */ export function stringify(token) { if (typeof token === 'string') { return token; } if (token == null) { return '' + token; } if (token.overriddenName) { return "" + token.overriddenName; } if (token.name) { return "" + token.name; } var /** @type {?} */ res = token.toString(); var /** @type {?} */ newLineIndex = res.indexOf('\n'); return newLineIndex === -1 ? res : res.substring(0, newLineIndex); } export var NumberWrapper = (function () { function NumberWrapper() { } /** * @param {?} text * @return {?} */ NumberWrapper.parseIntAutoRadix = function (text) { var /** @type {?} */ result = parseInt(text); if (isNaN(result)) { throw new Error('Invalid integer literal when parsing ' + text); } return result; }; /** * @param {?} value * @return {?} */ NumberWrapper.isNumeric = function (value) { return !isNaN(value - parseFloat(value)); }; return NumberWrapper; }()); /** * @param {?} a * @param {?} b * @return {?} */ export function looseIdentical(a, b) { return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b); } /** * @param {?} o * @return {?} */ export function isJsObject(o) { return o !== null && (typeof o === 'function' || typeof o === 'object'); } /** * @param {?} obj * @return {?} */ export function print(obj) { // tslint:disable-next-line:no-console console.log(obj); } /** * @param {?} obj * @return {?} */ export function warn(obj) { console.warn(obj); } /** * @param {?} global * @param {?} path * @param {?} value * @return {?} */ export function setValueOnPath(global, path, value) { var /** @type {?} */ parts = path.split('.'); var /** @type {?} */ obj = global; while (parts.length > 1) { var /** @type {?} */ name_1 = parts.shift(); if (obj.hasOwnProperty(name_1) && obj[name_1] != null) { obj = obj[name_1]; } else { obj = obj[name_1] = {}; } } if (obj === undefined || obj === null) { obj = {}; } obj[parts.shift()] = value; } var /** @type {?} */ _symbolIterator = null; /** * @return {?} */ export function getSymbolIterator() { if (!_symbolIterator) { if (((globalScope)).Symbol && Symbol.iterator) { _symbolIterator = Symbol.iterator; } else { // es6-shim specific logic var /** @type {?} */ keys = Object.getOwnPropertyNames(Map.prototype); for (var /** @type {?} */ i = 0; i < keys.length; ++i) { var /** @type {?} */ key = keys[i]; if (key !== 'entries' && key !== 'size' && ((Map)).prototype[key] === Map.prototype['entries']) { _symbolIterator = key; } } } } return _symbolIterator; } /** * @param {?} obj * @return {?} */ export function isPrimitive(obj) { return !isJsObject(obj); } /** * @param {?} s * @return {?} */ export function escapeRegExp(s) { return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); } //# sourceMappingURL=lang.js.map