source: trip-planner-front/node_modules/@angular/compiler/src/util.js@ fa375fe

Last change on this file since fa375fe was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 29.5 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8(function (factory) {
9 if (typeof module === "object" && typeof module.exports === "object") {
10 var v = factory(require, exports);
11 if (v !== undefined) module.exports = v;
12 }
13 else if (typeof define === "function" && define.amd) {
14 define("@angular/compiler/src/util", ["require", "exports", "tslib"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.partitionArray = exports.newArray = exports.global = exports.Version = exports.isPromise = exports.resolveForwardRef = exports.stringify = exports.utf8Encode = exports.escapeRegExp = exports.error = exports.SyncAsync = exports.ValueTransformer = exports.noUndefined = exports.isDefined = exports.visitValue = exports.splitAtPeriod = exports.splitAtColon = exports.dashCaseToCamelCase = void 0;
20 var tslib_1 = require("tslib");
21 var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
22 function dashCaseToCamelCase(input) {
23 return input.replace(DASH_CASE_REGEXP, function () {
24 var m = [];
25 for (var _i = 0; _i < arguments.length; _i++) {
26 m[_i] = arguments[_i];
27 }
28 return m[1].toUpperCase();
29 });
30 }
31 exports.dashCaseToCamelCase = dashCaseToCamelCase;
32 function splitAtColon(input, defaultValues) {
33 return _splitAt(input, ':', defaultValues);
34 }
35 exports.splitAtColon = splitAtColon;
36 function splitAtPeriod(input, defaultValues) {
37 return _splitAt(input, '.', defaultValues);
38 }
39 exports.splitAtPeriod = splitAtPeriod;
40 function _splitAt(input, character, defaultValues) {
41 var characterIndex = input.indexOf(character);
42 if (characterIndex == -1)
43 return defaultValues;
44 return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
45 }
46 function visitValue(value, visitor, context) {
47 if (Array.isArray(value)) {
48 return visitor.visitArray(value, context);
49 }
50 if (isStrictStringMap(value)) {
51 return visitor.visitStringMap(value, context);
52 }
53 if (value == null || typeof value == 'string' || typeof value == 'number' ||
54 typeof value == 'boolean') {
55 return visitor.visitPrimitive(value, context);
56 }
57 return visitor.visitOther(value, context);
58 }
59 exports.visitValue = visitValue;
60 function isDefined(val) {
61 return val !== null && val !== undefined;
62 }
63 exports.isDefined = isDefined;
64 function noUndefined(val) {
65 return val === undefined ? null : val;
66 }
67 exports.noUndefined = noUndefined;
68 var ValueTransformer = /** @class */ (function () {
69 function ValueTransformer() {
70 }
71 ValueTransformer.prototype.visitArray = function (arr, context) {
72 var _this = this;
73 return arr.map(function (value) { return visitValue(value, _this, context); });
74 };
75 ValueTransformer.prototype.visitStringMap = function (map, context) {
76 var _this = this;
77 var result = {};
78 Object.keys(map).forEach(function (key) {
79 result[key] = visitValue(map[key], _this, context);
80 });
81 return result;
82 };
83 ValueTransformer.prototype.visitPrimitive = function (value, context) {
84 return value;
85 };
86 ValueTransformer.prototype.visitOther = function (value, context) {
87 return value;
88 };
89 return ValueTransformer;
90 }());
91 exports.ValueTransformer = ValueTransformer;
92 exports.SyncAsync = {
93 assertSync: function (value) {
94 if (isPromise(value)) {
95 throw new Error("Illegal state: value cannot be a promise");
96 }
97 return value;
98 },
99 then: function (value, cb) {
100 return isPromise(value) ? value.then(cb) : cb(value);
101 },
102 all: function (syncAsyncValues) {
103 return syncAsyncValues.some(isPromise) ? Promise.all(syncAsyncValues) : syncAsyncValues;
104 }
105 };
106 function error(msg) {
107 throw new Error("Internal Error: " + msg);
108 }
109 exports.error = error;
110 // Escape characters that have a special meaning in Regular Expressions
111 function escapeRegExp(s) {
112 return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
113 }
114 exports.escapeRegExp = escapeRegExp;
115 var STRING_MAP_PROTO = Object.getPrototypeOf({});
116 function isStrictStringMap(obj) {
117 return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
118 }
119 function utf8Encode(str) {
120 var encoded = [];
121 for (var index = 0; index < str.length; index++) {
122 var codePoint = str.charCodeAt(index);
123 // decode surrogate
124 // see https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
125 if (codePoint >= 0xd800 && codePoint <= 0xdbff && str.length > (index + 1)) {
126 var low = str.charCodeAt(index + 1);
127 if (low >= 0xdc00 && low <= 0xdfff) {
128 index++;
129 codePoint = ((codePoint - 0xd800) << 10) + low - 0xdc00 + 0x10000;
130 }
131 }
132 if (codePoint <= 0x7f) {
133 encoded.push(codePoint);
134 }
135 else if (codePoint <= 0x7ff) {
136 encoded.push(((codePoint >> 6) & 0x1F) | 0xc0, (codePoint & 0x3f) | 0x80);
137 }
138 else if (codePoint <= 0xffff) {
139 encoded.push((codePoint >> 12) | 0xe0, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
140 }
141 else if (codePoint <= 0x1fffff) {
142 encoded.push(((codePoint >> 18) & 0x07) | 0xf0, ((codePoint >> 12) & 0x3f) | 0x80, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
143 }
144 }
145 return encoded;
146 }
147 exports.utf8Encode = utf8Encode;
148 function stringify(token) {
149 if (typeof token === 'string') {
150 return token;
151 }
152 if (Array.isArray(token)) {
153 return '[' + token.map(stringify).join(', ') + ']';
154 }
155 if (token == null) {
156 return '' + token;
157 }
158 if (token.overriddenName) {
159 return "" + token.overriddenName;
160 }
161 if (token.name) {
162 return "" + token.name;
163 }
164 if (!token.toString) {
165 return 'object';
166 }
167 // WARNING: do not try to `JSON.stringify(token)` here
168 // see https://github.com/angular/angular/issues/23440
169 var res = token.toString();
170 if (res == null) {
171 return '' + res;
172 }
173 var newLineIndex = res.indexOf('\n');
174 return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
175 }
176 exports.stringify = stringify;
177 /**
178 * Lazily retrieves the reference value from a forwardRef.
179 */
180 function resolveForwardRef(type) {
181 if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__')) {
182 return type();
183 }
184 else {
185 return type;
186 }
187 }
188 exports.resolveForwardRef = resolveForwardRef;
189 /**
190 * Determine if the argument is shaped like a Promise
191 */
192 function isPromise(obj) {
193 // allow any Promise/A+ compliant thenable.
194 // It's up to the caller to ensure that obj.then conforms to the spec
195 return !!obj && typeof obj.then === 'function';
196 }
197 exports.isPromise = isPromise;
198 var Version = /** @class */ (function () {
199 function Version(full) {
200 this.full = full;
201 var splits = full.split('.');
202 this.major = splits[0];
203 this.minor = splits[1];
204 this.patch = splits.slice(2).join('.');
205 }
206 return Version;
207 }());
208 exports.Version = Version;
209 var __window = typeof window !== 'undefined' && window;
210 var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
211 self instanceof WorkerGlobalScope && self;
212 var __global = typeof global !== 'undefined' && global;
213 // Check __global first, because in Node tests both __global and __window may be defined and _global
214 // should be __global in that case.
215 var _global = __global || __window || __self;
216 exports.global = _global;
217 function newArray(size, value) {
218 var list = [];
219 for (var i = 0; i < size; i++) {
220 list.push(value);
221 }
222 return list;
223 }
224 exports.newArray = newArray;
225 /**
226 * Partitions a given array into 2 arrays, based on a boolean value returned by the condition
227 * function.
228 *
229 * @param arr Input array that should be partitioned
230 * @param conditionFn Condition function that is called for each item in a given array and returns a
231 * boolean value.
232 */
233 function partitionArray(arr, conditionFn) {
234 var e_1, _a;
235 var truthy = [];
236 var falsy = [];
237 try {
238 for (var arr_1 = tslib_1.__values(arr), arr_1_1 = arr_1.next(); !arr_1_1.done; arr_1_1 = arr_1.next()) {
239 var item = arr_1_1.value;
240 (conditionFn(item) ? truthy : falsy).push(item);
241 }
242 }
243 catch (e_1_1) { e_1 = { error: e_1_1 }; }
244 finally {
245 try {
246 if (arr_1_1 && !arr_1_1.done && (_a = arr_1.return)) _a.call(arr_1);
247 }
248 finally { if (e_1) throw e_1.error; }
249 }
250 return [truthy, falsy];
251 }
252 exports.partitionArray = partitionArray;
253});
254//#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N5KS5wdXNoKGl0ZW0gYXMgYW55KTtcbiAgfVxuICByZXR1cm4gW3RydXRoeSwgZmFsc3ldO1xufVxuIl19
Note: See TracBrowser for help on using the repository browser.