-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.js
17 lines (14 loc) · 697 Bytes
/
run.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
var request = require('request');
const trie = require('./src/script');
const iniatedAt = new Date;
request.get('https://raw.githubusercontent.com/dwyl/english-words/master/words_alpha.txt', (error, response, body) => {
const start = new Date();
console.log('Word possibilities fetched in ',(start - iniatedAt)/1000, 'seconds. This time depends on internet speed.');
if (!error && response.statusCode == 200) {
const data = trie(body.replace( /\r/g, "" ).split("\n"));
data.getAnagrams(['cat', 'dog', 'museam', 'photosyntesis', 'typewriter']);
} else {
console.log(error)
}
console.log('Algorithm completed in ', (new Date - start)/1000, 'seconds');
});