Skip to content

Commit e106291

Browse files
committed
Use isPromise module
This offers more robust checks and is unit tested separately.
1 parent 72f1265 commit e106291

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

lib/index.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const difference = require('lodash.difference');
88
const encapsulationPlugins = require('./encapsulation');
99
const fs = require('fs');
1010
const isEmpty = require('lodash.isempty');
11+
const isPromise = require('is-promise');
1112
const pify = require('pify');
1213
const postcssEasyImport = require('postcss-easy-import');
1314
const reporter = require('postcss-reporter');
@@ -178,10 +179,6 @@ function lintFile(css, options, filename) {
178179
return processor.process(css, options.postcss);
179180
}
180181

181-
function isPromise(obj) {
182-
return typeof obj.then === 'function';
183-
}
184-
185182
function noop() {}
186183

187184
function getFileContent(filename) {

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"commander": "~2.9.0",
1818
"cssnano": "^3.3.2",
1919
"fs-extra": "^2.1.2",
20+
"is-promise": "^2.1.0",
2021
"lodash.difference": "^4.0.2",
2122
"lodash.isempty": "^4.1.1",
2223
"object-assign-deep": "0.0.4",

yarn.lock

+4
Original file line numberDiff line numberDiff line change
@@ -2146,6 +2146,10 @@ is-primitive@^2.0.0:
21462146
version "2.0.0"
21472147
resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575"
21482148

2149+
is-promise@^2.1.0:
2150+
version "2.1.0"
2151+
resolved "https://registry.yarnpkg.com/is-promise/-/is-promise-2.1.0.tgz#79a2a9ece7f096e80f36d2b2f3bc16c1ff4bf3fa"
2152+
21492153
is-property@^1.0.0:
21502154
version "1.0.2"
21512155
resolved "https://registry.yarnpkg.com/is-property/-/is-property-1.0.2.tgz#57fe1c4e48474edd65b09911f26b1cd4095dda84"

0 commit comments

Comments
 (0)