Skip to content

Commit

Permalink
fix(@angular-devkit/core): deprecate redundant isObservable function
Browse files Browse the repository at this point in the history
rxjs provides a canonical version of the helper function.  Internal usage has also been changed to use this version.
  • Loading branch information
clydin authored and Keen Yee Liau committed May 13, 2019
1 parent a38ed1f commit 9de206e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/angular_devkit/core/src/json/schema/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
*/
import * as ajv from 'ajv';
import * as http from 'http';
import { Observable, from, of, throwError } from 'rxjs';
import { Observable, from, isObservable, of, throwError } from 'rxjs';
import { concatMap, map, switchMap, tap } from 'rxjs/operators';
import * as Url from 'url';
import { BaseException } from '../../exception/exception';
import { PartiallyOrderedSet, deepCopy, isObservable } from '../../utils';
import { PartiallyOrderedSet, deepCopy } from '../../utils';
import { JsonArray, JsonObject, JsonValue, isJsonObject } from '../interface';
import {
JsonPointer,
Expand Down
11 changes: 3 additions & 8 deletions packages/angular_devkit/core/src/json/schema/visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
* 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
*/
import { Observable, concat, from, of as observableOf } from 'rxjs';
import { Observable, concat, from, isObservable, of as observableOf } from 'rxjs';
import { concatMap, ignoreElements, mergeMap, tap } from 'rxjs/operators';
import { isObservable } from '../../utils';
import { JsonArray, JsonObject, JsonValue } from '../interface';
import { JsonPointer, JsonSchemaVisitor, JsonVisitor } from './interface';
import { buildJsonPointer, joinJsonPointer } from './pointer';
import { JsonSchema } from './schema';


export interface ReferenceResolver<ContextT> {
(ref: string, context?: ContextT): { context?: ContextT, schema?: JsonObject };
}
Expand Down Expand Up @@ -70,11 +68,8 @@ function _visitJsonRecursive<ContextT>(

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

return (isObservable(value)
? value as Observable<JsonValue>
: observableOf(value as JsonValue)
).pipe(
concatMap((value: JsonValue) => {
return (isObservable<JsonValue>(value) ? value : observableOf(value)).pipe(
concatMap(value => {
if (Array.isArray(value)) {
return concat(
from(value).pipe(
Expand Down
1 change: 1 addition & 0 deletions packages/angular_devkit/core/src/utils/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function isPromise(obj: any): obj is Promise<any> {

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

0 comments on commit 9de206e

Please sign in to comment.