Skip to content

Commit

Permalink
Fixes #67. Ignores produce wrong console log
Browse files Browse the repository at this point in the history
  • Loading branch information
zrrrzzt committed Aug 15, 2017
1 parent 51173cb commit 308dd5d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
15 changes: 12 additions & 3 deletions lib/filter-data.js
Expand Up @@ -3,7 +3,16 @@
module.exports = (data, ignore) => {
const list = data.split('\n')
const filters = Array.isArray(ignore) ? ignore : [ignore]
const doIgnore = (item) => filters.indexOf(item) === -1

return list.filter(doIgnore).join('\n')
let errors = false
let results = []
list.forEach((line, index) => {
if (line.startsWith('Error') && filters.indexOf(line) === -1) {
results.push(line)
results.push(list[index + 1])
errors = true
} else if (line.startsWith('The')) {
results.push(line)
}
})
return errors === true ? results.join('\n') : 'The document validates according to the specified schema(s).'
}
8 changes: 4 additions & 4 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "html-validator",
"version": "2.2.2",
"version": "2.2.3",
"description": "Validate html using validator.w3.org/nu",
"license": "MIT",
"author": {
Expand All @@ -10,7 +10,7 @@
},
"main": "index.js",
"engines": {
"node": ">=4.8.3"
"node": ">=4.8.4"
},
"scripts": {
"setup": "npm install",
Expand Down Expand Up @@ -38,7 +38,7 @@
"devDependencies": {
"coveralls": "2.13.1",
"nsp": "2.7.0",
"standard": "10.0.2",
"tap": "10.7.1"
"standard": "10.0.3",
"tap": "10.7.2"
}
}

0 comments on commit 308dd5d

Please sign in to comment.