From 8f2c4638cb63e536897c0123752698b41f45f97b Mon Sep 17 00:00:00 2001 From: Eric Amodio Date: Sun, 18 Aug 2019 23:23:52 -0400 Subject: [PATCH] Renames `Promise.isPromise` to `is` --- src/system/decorators/gate.ts | 2 +- src/system/decorators/log.ts | 2 +- src/system/promise.ts | 2 +- src/views/nodes/compareNode.ts | 2 +- src/views/nodes/searchNode.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/system/decorators/gate.ts b/src/system/decorators/gate.ts index ced5e0e..76173ed 100644 --- a/src/system/decorators/gate.ts +++ b/src/system/decorators/gate.ts @@ -47,7 +47,7 @@ export function gate any>(resolver?: (...args: Parame let promise = this[prop]; if (promise === undefined) { const result = fn!.apply(this, args); - if (result == null || !Promises.isPromise(result)) { + if (result == null || !Promises.is(result)) { return result; } diff --git a/src/system/decorators/log.ts b/src/system/decorators/log.ts index 93601cf..76f49bf 100644 --- a/src/system/decorators/log.ts +++ b/src/system/decorators/log.ts @@ -288,7 +288,7 @@ export function log any>( } }; - if (result != null && Promises.isPromise(result)) { + if (result != null && Promises.is(result)) { const promise = result.then(logResult); promise.catch(logError); } diff --git a/src/system/promise.ts b/src/system/promise.ts index 3a09cf1..6ebf0a2 100644 --- a/src/system/promise.ts +++ b/src/system/promise.ts @@ -10,7 +10,7 @@ export namespace Promises { }); } - export function isPromise(obj: T | Promise): obj is Promise { + export function is(obj: T | Promise): obj is Promise { return obj && typeof (obj as Promise).then === 'function'; } diff --git a/src/views/nodes/compareNode.ts b/src/views/nodes/compareNode.ts index b07f327..045fe7e 100644 --- a/src/views/nodes/compareNode.ts +++ b/src/views/nodes/compareNode.ts @@ -120,7 +120,7 @@ export class CompareNode extends ViewNode { const promises: Promise[] = [ ...Iterables.filterMap(this._children, c => { const result = c.refresh === undefined ? false : c.refresh(); - return Promises.isPromise(result) ? result : undefined; + return Promises.is(result) ? result : undefined; }) ]; await Promise.all(promises); diff --git a/src/views/nodes/searchNode.ts b/src/views/nodes/searchNode.ts index e89db66..d627e96 100644 --- a/src/views/nodes/searchNode.ts +++ b/src/views/nodes/searchNode.ts @@ -139,7 +139,7 @@ export class SearchNode extends ViewNode { const promises: Promise[] = [ ...Iterables.filterMap(this._children, c => { const result = c.refresh === undefined ? false : c.refresh(); - return Promises.isPromise(result) ? result : undefined; + return Promises.is(result) ? result : undefined; }) ]; await Promise.all(promises);