Skip to content

Commit

Permalink
fix: clean script, remove dups
Browse files Browse the repository at this point in the history
  • Loading branch information
François-Guillaume Ribreau committed Mar 18, 2021
1 parent 05036d7 commit e736788
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
17 changes: 7 additions & 10 deletions lib/clean.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
'use strict';

var fs = require('fs');
var p = require('path');
var psl = require('psl');
const fs = require('fs');
const p = require('path');
const psl = require('psl');

var path = p.resolve(__dirname, '../list.txt');
var rawList = fs.readFileSync(path)
const path = p.resolve(__dirname, '../list.txt');
const rawList = [...new Set(fs.readFileSync(path)
.toString()
.trim()
.split("\n")
.split("\n"))]
.sort();

var cleanedList = rawList.filter(function(domain){
var parsed = psl.parse(domain);
return parsed.listed;
});
const cleanedList = rawList.filter((domain) => psl.parse(domain).listed);

fs.writeFileSync(path, cleanedList.join("\n"))
2 changes: 1 addition & 1 deletion platform/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e736788

Please sign in to comment.