Occurences-example-request
const Occurences = require("occurences");
const request = require('request');
const url = "http://faker.hook.io/?property=lorem.sentences";
request({
url: url,
json: true
}, function (error, response, data) {
if (!error && response.statusCode === 200) {
let instance = new Occurences(data, {biggerThan: 4});
console.log('ALL STATS:')
console.log(instance.stats);
console.log('LONGEST WORD(S):');
console.log(instance.longest);
}
else {
console.log("It seems an error occured when requesting ", url);
}
});
no comments