Skip to content

Commit 8c83d6e

Browse files
committedJul 30, 2019
fix: hasOwnProperty syntax
1 parent 29643ad commit 8c83d6e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎lib/fs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ function readFile(path, options = {}, callback) {
304304
options = {};
305305
}
306306

307-
if (!Object.hasOwnProperty(options, 'encoding')) options.encoding = 'utf8';
307+
if (!Object.prototype.hasOwnProperty.call(options, 'encoding')) options.encoding = 'utf8';
308308

309309
return readFileAsync(path, options).then(content => {
310310
if (options.escape == null || options.escape) {
@@ -318,7 +318,7 @@ function readFile(path, options = {}, callback) {
318318
function readFileSync(path, options = {}) {
319319
if (!path) throw new TypeError('path is required!');
320320

321-
if (!Object.hasOwnProperty(options, 'encoding')) options.encoding = 'utf8';
321+
if (!Object.prototype.hasOwnProperty.call(options, 'encoding')) options.encoding = 'utf8';
322322

323323
const content = fs.readFileSync(path, options);
324324

0 commit comments

Comments
 (0)
Please sign in to comment.