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

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

initial commit

  • Property mode set to 100644
File size: 26.1 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 */
8const DASH_CASE_REGEXP = /-+([a-z0-9])/g;
9export function dashCaseToCamelCase(input) {
10 return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
11}
12export function splitAtColon(input, defaultValues) {
13 return _splitAt(input, ':', defaultValues);
14}
15export function splitAtPeriod(input, defaultValues) {
16 return _splitAt(input, '.', defaultValues);
17}
18function _splitAt(input, character, defaultValues) {
19 const characterIndex = input.indexOf(character);
20 if (characterIndex == -1)
21 return defaultValues;
22 return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
23}
24export function visitValue(value, visitor, context) {
25 if (Array.isArray(value)) {
26 return visitor.visitArray(value, context);
27 }
28 if (isStrictStringMap(value)) {
29 return visitor.visitStringMap(value, context);
30 }
31 if (value == null || typeof value == 'string' || typeof value == 'number' ||
32 typeof value == 'boolean') {
33 return visitor.visitPrimitive(value, context);
34 }
35 return visitor.visitOther(value, context);
36}
37export function isDefined(val) {
38 return val !== null && val !== undefined;
39}
40export function noUndefined(val) {
41 return val === undefined ? null : val;
42}
43export class ValueTransformer {
44 visitArray(arr, context) {
45 return arr.map(value => visitValue(value, this, context));
46 }
47 visitStringMap(map, context) {
48 const result = {};
49 Object.keys(map).forEach(key => {
50 result[key] = visitValue(map[key], this, context);
51 });
52 return result;
53 }
54 visitPrimitive(value, context) {
55 return value;
56 }
57 visitOther(value, context) {
58 return value;
59 }
60}
61export const SyncAsync = {
62 assertSync: (value) => {
63 if (isPromise(value)) {
64 throw new Error(`Illegal state: value cannot be a promise`);
65 }
66 return value;
67 },
68 then: (value, cb) => {
69 return isPromise(value) ? value.then(cb) : cb(value);
70 },
71 all: (syncAsyncValues) => {
72 return syncAsyncValues.some(isPromise) ? Promise.all(syncAsyncValues) : syncAsyncValues;
73 }
74};
75export function error(msg) {
76 throw new Error(`Internal Error: ${msg}`);
77}
78// Escape characters that have a special meaning in Regular Expressions
79export function escapeRegExp(s) {
80 return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
81}
82const STRING_MAP_PROTO = Object.getPrototypeOf({});
83function isStrictStringMap(obj) {
84 return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
85}
86export function utf8Encode(str) {
87 let encoded = [];
88 for (let index = 0; index < str.length; index++) {
89 let codePoint = str.charCodeAt(index);
90 // decode surrogate
91 // see https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
92 if (codePoint >= 0xd800 && codePoint <= 0xdbff && str.length > (index + 1)) {
93 const low = str.charCodeAt(index + 1);
94 if (low >= 0xdc00 && low <= 0xdfff) {
95 index++;
96 codePoint = ((codePoint - 0xd800) << 10) + low - 0xdc00 + 0x10000;
97 }
98 }
99 if (codePoint <= 0x7f) {
100 encoded.push(codePoint);
101 }
102 else if (codePoint <= 0x7ff) {
103 encoded.push(((codePoint >> 6) & 0x1F) | 0xc0, (codePoint & 0x3f) | 0x80);
104 }
105 else if (codePoint <= 0xffff) {
106 encoded.push((codePoint >> 12) | 0xe0, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
107 }
108 else if (codePoint <= 0x1fffff) {
109 encoded.push(((codePoint >> 18) & 0x07) | 0xf0, ((codePoint >> 12) & 0x3f) | 0x80, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
110 }
111 }
112 return encoded;
113}
114export function stringify(token) {
115 if (typeof token === 'string') {
116 return token;
117 }
118 if (Array.isArray(token)) {
119 return '[' + token.map(stringify).join(', ') + ']';
120 }
121 if (token == null) {
122 return '' + token;
123 }
124 if (token.overriddenName) {
125 return `${token.overriddenName}`;
126 }
127 if (token.name) {
128 return `${token.name}`;
129 }
130 if (!token.toString) {
131 return 'object';
132 }
133 // WARNING: do not try to `JSON.stringify(token)` here
134 // see https://github.com/angular/angular/issues/23440
135 const res = token.toString();
136 if (res == null) {
137 return '' + res;
138 }
139 const newLineIndex = res.indexOf('\n');
140 return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
141}
142/**
143 * Lazily retrieves the reference value from a forwardRef.
144 */
145export function resolveForwardRef(type) {
146 if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__')) {
147 return type();
148 }
149 else {
150 return type;
151 }
152}
153/**
154 * Determine if the argument is shaped like a Promise
155 */
156export function isPromise(obj) {
157 // allow any Promise/A+ compliant thenable.
158 // It's up to the caller to ensure that obj.then conforms to the spec
159 return !!obj && typeof obj.then === 'function';
160}
161export class Version {
162 constructor(full) {
163 this.full = full;
164 const splits = full.split('.');
165 this.major = splits[0];
166 this.minor = splits[1];
167 this.patch = splits.slice(2).join('.');
168 }
169}
170const __window = typeof window !== 'undefined' && window;
171const __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
172 self instanceof WorkerGlobalScope && self;
173const __global = typeof global !== 'undefined' && global;
174// Check __global first, because in Node tests both __global and __window may be defined and _global
175// should be __global in that case.
176const _global = __global || __window || __self;
177export { _global as global };
178export function newArray(size, value) {
179 const list = [];
180 for (let i = 0; i < size; i++) {
181 list.push(value);
182 }
183 return list;
184}
185/**
186 * Partitions a given array into 2 arrays, based on a boolean value returned by the condition
187 * function.
188 *
189 * @param arr Input array that should be partitioned
190 * @param conditionFn Condition function that is called for each item in a given array and returns a
191 * boolean value.
192 */
193export function partitionArray(arr, conditionFn) {
194 const truthy = [];
195 const falsy = [];
196 for (const item of arr) {
197 (conditionFn(item) ? truthy : falsy).push(item);
198 }
199 return [truthy, falsy];
200}
201//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3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BhcnJheXMsIGJhc2VkIG9uIGEgYm9vbGVhbiB2YWx1ZSByZXR1cm5lZCBieSB0aGUgY29uZGl0aW9uXG4gKiBmdW5jdGlvbi5cbiAqXG4gKiBAcGFyYW0gYXJyIElucHV0IGFycmF5IHRoYXQgc2hvdWxkIGJlIHBhcnRpdGlvbmVkXG4gKiBAcGFyYW0gY29uZGl0aW9uRm4gQ29uZGl0aW9uIGZ1bmN0aW9uIHRoYXQgaXMgY2FsbGVkIGZvciBlYWNoIGl0ZW0gaW4gYSBnaXZlbiBhcnJheSBhbmQgcmV0dXJucyBhXG4gKiBib29sZWFuIHZhbHVlLlxuICovXG5leHBvcnQgZnVuY3Rpb24gcGFydGl0aW9uQXJyYXk8VCwgRiA9IFQ+KFxuICAgIGFycjogKFR8RilbXSwgY29uZGl0aW9uRm46ICh2YWx1ZTogVHxGKSA9PiBib29sZWFuKTogW1RbXSwgRltdXSB7XG4gIGNvbnN0IHRydXRoeTogVFtdID0gW107XG4gIGNvbnN0IGZhbHN5OiBGW10gPSBbXTtcbiAgZm9yIChjb25zdCBpdGVtIG9mIGFycikge1xuICAgIChjb25kaXRpb25GbihpdGVtKSA/IHRydXRoeSA6IGZhbHN5KS5wdXNoKGl0ZW0gYXMgYW55KTtcbiAgfVxuICByZXR1cm4gW3RydXRoeSwgZmFsc3ldO1xufVxuIl19
Note: See TracBrowser for help on using the repository browser.