[Javascript] Check Promise is Promise

const isPromise = obj => Boolean(obj) && typeof obj.then === 'function';

 

This can be a tool save into your toolbox.

 

posted @ 2019-11-13 21:40  Zhentiw  阅读(319)  评论(0编辑  收藏  举报