diff --git a/lib/fs.js b/lib/fs.js index b897ba4..dcbc76b 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -304,7 +304,7 @@ function readFile(path, options = {}, callback) { options = {}; } - if (!options.hasOwnProperty('encoding')) options.encoding = 'utf8'; + if (!Object.prototype.hasOwnProperty.call(options, 'encoding')) options.encoding = 'utf8'; return readFileAsync(path, options).then(content => { if (options.escape == null || options.escape) { @@ -318,7 +318,7 @@ function readFile(path, options = {}, callback) { function readFileSync(path, options = {}) { if (!path) throw new TypeError('path is required!'); - if (!options.hasOwnProperty('encoding')) options.encoding = 'utf8'; + if (!Object.prototype.hasOwnProperty.call(options, 'encoding')) options.encoding = 'utf8'; const content = fs.readFileSync(path, options); diff --git a/package.json b/package.json index 968fc6b..401183b 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ }, "devDependencies": { "chai": "^4.1.2", - "eslint": "^5.16.0", + "eslint": "^6.0.1", "eslint-config-hexo": "^3.0.0", "iferr": "^1.0.2", "istanbul": "^0.4.5",