Skip to content

Commit

Permalink
throw on reading undefined file path (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Nov 17, 2020
1 parent 993382a commit b2d0464
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ module.exports = function (file, opts) {
return sm;

function readFile(file, enc, cb) {
if (file === undefined) {
throw new Error('file is not resolvable');
}

if (typeof enc === "function") {
cb = enc;
enc = null;
Expand Down Expand Up @@ -93,6 +97,10 @@ module.exports = function (file, opts) {
}

function readFileSync(file, enc) {
if (file === undefined) {
throw new Error('file is not resolvable');
}

var isBuffer = false;
if (enc === null || enc === undefined) {
isBuffer = true;
Expand Down

0 comments on commit b2d0464

Please sign in to comment.