diff --git a/.gitattributes b/.gitattributes index 391f0a4..6313b56 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1 @@ -* text=auto -*.js text eol=lf +* text=auto eol=lf diff --git a/.gitignore b/.gitignore index 3c3629e..239ecff 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules +yarn.lock diff --git a/index.js b/index.js index ba41e4e..bad4359 100644 --- a/index.js +++ b/index.js @@ -1,11 +1,12 @@ 'use strict'; -const isPromise = x => ( - x instanceof Promise || + +const isPromise = input => ( + input instanceof Promise || ( - x !== null && - typeof x === 'object' && - typeof x.then === 'function' && - typeof x.catch === 'function' + input !== null && + typeof input === 'object' && + typeof input.then === 'function' && + typeof input.catch === 'function' ) ); diff --git a/readme.md b/readme.md index 15edbf2..0e0e481 100644 --- a/readme.md +++ b/readme.md @@ -12,7 +12,7 @@ Can be useful if you need to create a fast path for a synchronous operation. ## Install ``` -$ npm install --save p-is-promise +$ npm install p-is-promise ``` diff --git a/test.js b/test.js index 42c7b5a..3690ff6 100644 --- a/test.js +++ b/test.js @@ -2,7 +2,7 @@ import test from 'ava'; import Bluebird from 'bluebird'; import isPromise from '.'; -test(t => { +test('main', t => { t.true(isPromise(Promise.resolve())); t.true(isPromise(global.Promise.resolve())); t.true(isPromise(Bluebird.resolve()));