Skip to content

Commit 9de206e

Browse files
clydinKeen Yee Liau
authored and
Keen Yee Liau
committed
fix(@angular-devkit/core): deprecate redundant isObservable function
rxjs provides a canonical version of the helper function. Internal usage has also been changed to use this version.
1 parent a38ed1f commit 9de206e

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

packages/angular_devkit/core/src/json/schema/registry.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
*/
88
import * as ajv from 'ajv';
99
import * as http from 'http';
10-
import { Observable, from, of, throwError } from 'rxjs';
10+
import { Observable, from, isObservable, of, throwError } from 'rxjs';
1111
import { concatMap, map, switchMap, tap } from 'rxjs/operators';
1212
import * as Url from 'url';
1313
import { BaseException } from '../../exception/exception';
14-
import { PartiallyOrderedSet, deepCopy, isObservable } from '../../utils';
14+
import { PartiallyOrderedSet, deepCopy } from '../../utils';
1515
import { JsonArray, JsonObject, JsonValue, isJsonObject } from '../interface';
1616
import {
1717
JsonPointer,

packages/angular_devkit/core/src/json/schema/visitor.ts

+3-8
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8-
import { Observable, concat, from, of as observableOf } from 'rxjs';
8+
import { Observable, concat, from, isObservable, of as observableOf } from 'rxjs';
99
import { concatMap, ignoreElements, mergeMap, tap } from 'rxjs/operators';
10-
import { isObservable } from '../../utils';
1110
import { JsonArray, JsonObject, JsonValue } from '../interface';
1211
import { JsonPointer, JsonSchemaVisitor, JsonVisitor } from './interface';
1312
import { buildJsonPointer, joinJsonPointer } from './pointer';
1413
import { JsonSchema } from './schema';
1514

16-
1715
export interface ReferenceResolver<ContextT> {
1816
(ref: string, context?: ContextT): { context?: ContextT, schema?: JsonObject };
1917
}
@@ -70,11 +68,8 @@ function _visitJsonRecursive<ContextT>(
7068

7169
const value = visitor(json, ptr, schema, root);
7270

73-
return (isObservable(value)
74-
? value as Observable<JsonValue>
75-
: observableOf(value as JsonValue)
76-
).pipe(
77-
concatMap((value: JsonValue) => {
71+
return (isObservable<JsonValue>(value) ? value : observableOf(value)).pipe(
72+
concatMap(value => {
7873
if (Array.isArray(value)) {
7974
return concat(
8075
from(value).pipe(

packages/angular_devkit/core/src/utils/lang.ts

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export function isPromise(obj: any): obj is Promise<any> {
2020

2121
/**
2222
* Determine if the argument is an Observable
23+
* @deprecated as of 8.0; use rxjs' built-in version
2324
*/
2425
// tslint:disable-next-line:no-any
2526
export function isObservable(obj: any | Observable<any>): obj is Observable<any> {

0 commit comments

Comments
 (0)