lifeomic / graphql-resolvers-xray-tracing

A GraphQL middleware to enable X-Ray tracing subsegments for GraphQL resolvers
MIT License
68 stars 16 forks source link

Remove is-promise dependency? #9

Closed jplock closed 6 years ago

jplock commented 6 years ago

Why not remove an external dependency on is-promise and implement:

function isPromise(obj) {
  return !!obj && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
}

in index.js itself.

mdlavin commented 6 years ago

I didn't want to try duplicating the logic of Promise detection if some other project provided the logic already. I don't want to keep up with the most appropriate way to detect a Promise as things change. If there is a better dependency to use I'm up for switching.