source: imaps-frontend/node_modules/es-abstract/2016/IsPromise.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 480 bytes
RevLine 
[d565449]1'use strict';
2
[79a0317]3var callBound = require('call-bound');
[d565449]4
5var $PromiseThen = callBound('Promise.prototype.then', true);
6
[79a0317]7var isObject = require('../helpers/isObject');
[d565449]8
9// https://262.ecma-international.org/6.0/#sec-ispromise
10
11module.exports = function IsPromise(x) {
[79a0317]12 if (!isObject(x)) {
[d565449]13 return false;
14 }
15 if (!$PromiseThen) { // Promises are not supported
16 return false;
17 }
18 try {
19 $PromiseThen(x); // throws if not a promise
20 } catch (e) {
21 return false;
22 }
23 return true;
24};
Note: See TracBrowser for help on using the repository browser.