Changing `promise.then()` & `promise.resolve()` to use a generic test in lieu of the `instanceof` operator