Browse Source

Meta tweaks

master
Sindre Sorhus 6 years ago
parent
commit
dc1466a22d
  1. 3
      .gitattributes
  2. 1
      .gitignore
  3. 13
      index.js
  4. 2
      readme.md
  5. 2
      test.js

3
.gitattributes

@ -1,2 +1 @@
* text=auto
*.js text eol=lf
* text=auto eol=lf

1
.gitignore

@ -1 +1,2 @@
node_modules
yarn.lock

13
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'
)
);

2
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
```

2
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()));

Loading…
Cancel
Save