Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
3.9 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 | export function stripPrefix(val, prefix) {
|
---|
9 | return val.startsWith(prefix) ? val.substring(prefix.length) : val;
|
---|
10 | }
|
---|
11 | export function deepEqual(a, b) {
|
---|
12 | if (a === b) {
|
---|
13 | return true;
|
---|
14 | }
|
---|
15 | else if (!a || !b) {
|
---|
16 | return false;
|
---|
17 | }
|
---|
18 | else {
|
---|
19 | try {
|
---|
20 | if ((a.prototype !== b.prototype) || (Array.isArray(a) && Array.isArray(b))) {
|
---|
21 | return false;
|
---|
22 | }
|
---|
23 | return JSON.stringify(a) === JSON.stringify(b);
|
---|
24 | }
|
---|
25 | catch (e) {
|
---|
26 | return false;
|
---|
27 | }
|
---|
28 | }
|
---|
29 | }
|
---|
30 | export function isAnchor(el) {
|
---|
31 | return el.href !== undefined;
|
---|
32 | }
|
---|
33 | export function isPromise(obj) {
|
---|
34 | // allow any Promise/A+ compliant thenable.
|
---|
35 | // It's up to the caller to ensure that obj.then conforms to the spec
|
---|
36 | return !!obj && typeof obj.then === 'function';
|
---|
37 | }
|
---|
38 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21tb24vdXBncmFkZS9zcmMvdXRpbHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBRUgsTUFBTSxVQUFVLFdBQVcsQ0FBQyxHQUFXLEVBQUUsTUFBYztJQ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G5leHBvcnQgZnVuY3Rpb24gaXNBbmNob3IoZWw6IChOb2RlJlBhcmVudE5vZGUpfEVsZW1lbnR8bnVsbCk6IGVsIGlzIEhUTUxBbmNob3JFbGVtZW50IHtcbiAgcmV0dXJuICg8SFRNTEFuY2hvckVsZW1lbnQ+ZWwpLmhyZWYgIT09IHVuZGVmaW5lZDtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIGlzUHJvbWlzZTxUID0gYW55PihvYmo6IGFueSk6IG9iaiBpcyBQcm9taXNlPFQ+IHtcbiAgLy8gYWxsb3cgYW55IFByb21pc2UvQSsgY29tcGxpYW50IHRoZW5hYmxlLlxuICAvLyBJdCdzIHVwIHRvIHRoZSBjYWxsZXIgdG8gZW5zdXJlIHRoYXQgb2JqLnRoZW4gY29uZm9ybXMgdG8gdGhlIHNwZWNcbiAgcmV0dXJuICEhb2JqICYmIHR5cGVvZiBvYmoudGhlbiA9PT0gJ2Z1bmN0aW9uJztcbn1cbiJdfQ== |
---|
Note:
See
TracBrowser
for help on using the repository browser.