alexarank

A simple node package to get Alexa traffic rank for a domain or URL
Log | Files | Refs | README | LICENSE

commit ef78db49a061a6b7cfc1833383647453dcd450e2
parent 950fae8be55fdcfb888c8ae5ddf11f23ce066d25
Author: Jannis R <mail@jannisr.de>
Date:   Sun, 23 Oct 2016 15:29:35 +0200

remote arrow functions

to support Node 0.10 & 0.12

Diffstat:
Mlib/alexarank.js | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/alexarank.js b/lib/alexarank.js @@ -19,8 +19,10 @@ var xml2js = require('xml2js'); module.exports = function(url, callback) { fetch('https://data.alexa.com/data?cli=10&url=' + encodeURIComponent(url)) - .then((res) => res.text()) - .then((body) => { + .then(function (res) { + return res.text(); + }) + .then(function (body) { xml2js.parseString(body, { normalizeTags: true, explicitArray: false @@ -42,7 +44,7 @@ module.exports = function(url, callback) { } }); }) - .catch((err) => { + .catch(function (err) { callback(err); }); };