-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (27 loc) · 804 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const { AttAddressFromStores } = require('./AttAddressFromStores');
const { msg } = require('./msg');
const { writer } = require('./writer');
(async () => {
// const att = await new ATTScrape().start();
// await att.do();
const stores = new AttAddressFromStores().do();
// msg.die('done');
})();
function removeDuplicates(file = 'multi-stores.json') {
const ns = {};
let ls = writer.read(file);
const l_done = ls.filter(s => s.done === 1);
msg.error(`l_done.length ${l_done.length}`);
const l_notdone = ls.filter(s => s.done === 0);
msg.error(`l_notdone.length ${l_notdone.length}`);
l_done.forEach(s => {
ns[s.name] = s;
});
l_notdone.forEach(s => {
if (!(s.name in ns)) {
ns[s.name] = s;
}
});
writer.write(file, Object.values(ns));
msg.die(Object.keys(ns).length);
}