Skip to content

Commit

Permalink
#169 Plain domain file with conversion to JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
nalgeon committed Mar 26, 2019
1 parent 13e978a commit d729e44
Show file tree
Hide file tree
Showing 15 changed files with 19,775 additions and 144 deletions.
22 changes: 22 additions & 0 deletions lib/converter.js
@@ -0,0 +1,22 @@
'use strict';

var fs = require('fs');

function loadDomains (path) {
return fs
.readFileSync(path)
.toString()
.split('\n');
}

function saveDomains (domains, path) {
fs.writeFileSync(path, JSON.stringify([domains]));
}

function toJson (plainPath, jsonPath) {
var domains = loadDomains(plainPath);
saveDomains(domains, jsonPath);
return domains.length;
}

module.exports.toJson = toJson;
136 changes: 1 addition & 135 deletions list.json

Large diffs are not rendered by default.

0 comments on commit d729e44

Please sign in to comment.