Skip to content

Commit

Permalink
Fix eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
Aetf committed Apr 13, 2021
1 parent d90c387 commit f5cce4e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
coverage/
coverage/
.nyc_output
10 changes: 5 additions & 5 deletions lib/dom-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const CSSselect = require('css-select');
class Filter {
constructor(hexo, excludes) {
this.hexo = hexo;
this.selectors = excludes.map(this._compile);
this.selectors = excludes.map(this._compile.bind(this));
}

_compile = selector => {
_compile(selector) {
try {
return CSSselect.compile(selector);
} catch (err) {
Expand All @@ -18,18 +18,18 @@ class Filter {
}
}

match = node => {
match(node) {
// not match any
return !this.selectors.some(s => s(node));
}

filter = nodes => {
filter(nodes) {
// remove inner nodes that doesn't match
domutils.filter(n => !this.match(n), nodes)
.forEach(node => domutils.removeElement(node));

// only keep top level nodes that match
return nodes.filter(this.match);
return nodes.filter(this.match.bind(this));
}
}

Expand Down

0 comments on commit f5cce4e

Please sign in to comment.