Properly check if level is an integer

This commit is contained in:
Richie Bendall 2020-03-31 22:25:33 +13:00 committed by GitHub
parent 797461ee32
commit 08d9c740f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,7 @@ const levelMapping = [
const styles = Object.create(null);
const applyOptions = (object, options = {}) => {
if (options.level > 3 || options.level < 0) {
if (Number.isInteger(options.level) && (options.level > 3 || options.level < 0)) {
throw new Error('The `level` option should be an integer from 0 to 3');
}