Promise.js

  1. /**
  2. * @namespace Promise
  3. */
  4. /**
  5. * Returns verdict if given subject is Promise or not
  6. *
  7. * @memberof Promise
  8. * @param {*} subject Subject of examination
  9. * @returns {boolean} Verdict
  10. */
  11. function isPromise(subject) {
  12. return Object.isObject(subject) && (subject instanceof Promise || typeof subject.then === 'function');
  13. }
  14. export default {
  15. static: {
  16. isPromise
  17. }
  18. };