This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// Tight coupling from A to B => A needs B to be defined, callable and adhere to an interface | |
// No coupling from B to A => B does not need A in any way (pure fn) | |
function a() { | |
b() | |
} | |
function b() {} | |
} | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { interval, isObservable } from 'rxjs' | |
import { tap } from 'rxjs/operators' | |
const type = { | |
isThenable: obj => !!(obj && typeof obj.then === 'function'), | |
isObservable: obj => !!(obj && isObservable(obj)), | |
isError: obj => obj instanceof Error, | |
isObject: obj => obj != null && typeof obj === 'object' | |
} |