feat: Simplify
This commit is contained in:
parent
d57ad3573d
commit
815b3fc030
|
@ -1,6 +1,7 @@
|
|||
import { fileURLToPath } from 'url';
|
||||
import fs from 'fs';
|
||||
import path, { dirname } from 'path';
|
||||
import nhp from 'node-html-parser';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
@ -26,3 +27,7 @@ export const extensionFilter = (filenames, extension) => {
|
|||
export const getContent = (filename) => {
|
||||
return fs.readFileSync(filename).toString()
|
||||
}
|
||||
|
||||
export const getTitle = (html) => {
|
||||
return nhp.parse(html).querySelector('title').toString();
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
import nhp from 'node-html-parser';
|
||||
|
||||
export const getTitle = (html) => {
|
||||
return nhp.parse(html).querySelector('title').toString();
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
import Rule from './Rule.js'
|
||||
import { extensionFilter, getContent } from '../helpers.js'
|
||||
import { getTitle } from '../parser.js'
|
||||
import { extensionFilter, getContent, getTitle } from '../helpers.js'
|
||||
|
||||
export default class TitleLength extends Rule {
|
||||
initialize() {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import Rule from './Rule.js'
|
||||
import { extensionFilter, getContent } from '../helpers.js'
|
||||
import { getTitle } from '../parser.js'
|
||||
import { extensionFilter, getContent, getTitle } from '../helpers.js'
|
||||
|
||||
export default class TitleUnique extends Rule {
|
||||
initialize() {
|
||||
|
|
Loading…
Reference in New Issue