Skip to content

Commit

Permalink
Fix failure when using stdin(4)
Browse files Browse the repository at this point in the history
More precisely, when files without file-paths
are provided to mdast-validate-links.
  • Loading branch information
wooorm committed Nov 21, 2015
1 parent 407aa41 commit 40e1ced
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,10 @@ function completerFactory(project) {
exposed = gatherExposed.done();

set.valueOf().forEach(function (file) {
validate(exposed, file, project);
/* istanbul ignore else - stdin */
if (file.filePath()) {
validate(exposed, file, project);
}
});

done();
Expand Down Expand Up @@ -474,12 +477,20 @@ function transformerFactory(project, fileSet) {
* @param {File} file - Virtual file.
*/
function transformer(ast, file) {
var references = gatherReferences(file, project);
var links = [];
var current = getPathname(file.filePath());
var references;
var current;
var link;
var pathname;

/* istanbul ignore if - stdin */
if (!file.filePath()) {
return;
}

references = gatherReferences(file, project);
current = getPathname(file.filePath());

for (link in references) {
pathname = getPathname(link);

Expand Down

0 comments on commit 40e1ced

Please sign in to comment.