Travis build: 734 [ci skip]

This commit is contained in:
Travis CI
2017-12-31 13:54:58 +00:00
parent c86cceed14
commit c46e247cf8
3 changed files with 52 additions and 3 deletions

View File

@ -6,11 +6,17 @@ Check if the object is not `null`, its `typeof` matches either `object` or `func
```js
const isPromiseLike = obj =>
obj !== null && (typeof obj === 'object' || typeof obj === 'function') && typeof obj.then === 'function';
obj !== null &&
(typeof obj === 'object' || typeof obj === 'function') &&
typeof obj.then === 'function';
```
```js
isPromiseLike({then:function () {return ''}}); // true
isPromiseLike({
then: function() {
return '';
}
}); // true
isPromiseLike(null); // false
isPromiseLike({}); // false
```