Require Node.js 10

This commit is contained in:
Sindre Sorhus 2020-04-02 15:56:21 +08:00
parent f0f4638a92
commit 61999a4e77
8 changed files with 32 additions and 26 deletions

View file

@ -17,7 +17,7 @@ const levelMapping = [
const styles = Object.create(null);
const applyOptions = (object, options = {}) => {
if (!Number.isInteger(options.level) || options.level > 3 || options.level < 0) {
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
throw new Error('The `level` option should be an integer from 0 to 3');
}
@ -28,6 +28,7 @@ const applyOptions = (object, options = {}) => {
class ChalkClass {
constructor(options) {
// eslint-disable-next-line no-constructor-return
return chalkFactory(options);
}
}