Skip to content

Commit

Permalink
refactor: enhance internal zurk objects detectors
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Sep 20, 2024
1 parent e379da6 commit bcba34d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/ts/x.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface TShellOptionsExtra {

export interface TShellResponseExtra<T = any> {
pipe(shell: T): T
pipe(steam: Writable): Writable
pipe(stream: Writable): Writable
pipe(pieces: TemplateStringsArray, ...args: any[]): T
kill(signal?: NodeJS.Signals | null): Promise<void>
abort(): void
Expand Down
6 changes: 3 additions & 3 deletions src/main/ts/zurk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ export const getError = (data: TSpawnResult) => {
return null
}

export const isZurk = (o: any): o is TZurk => o?.[ZURK] === ZURK
export const isZurkPromise = (o: any): o is TZurkPromise => o?.[ZURK] === ZURK && o instanceof Promise
export const isZurkAny = (o: any): o is TZurk | TZurkPromise => isZurk(o) || isZurkPromise(o)
export const isZurkAny = (o: any): o is TZurk | TZurkPromise => o?.[ZURK] === ZURK
export const isZurk = (o: any): o is TZurk => isZurkAny(o) && !(o instanceof Promise)
export const isZurkPromise = (o: any): o is TZurkPromise => isZurkAny(o) && o instanceof Promise
export const isZurkProxy = (value: any): boolean => value?.[ZURKPROXY] === ZURKPROXY

export const zurkFactory = <C extends TSpawnCtxNormalized>(ctx: C): TZurk => new Zurk(ctx)
Expand Down

0 comments on commit bcba34d

Please sign in to comment.