From e3c342f6ec33fe2a36de04e143cc92bbbb31a332 Mon Sep 17 00:00:00 2001 From: Guy Vider Date: Thu, 13 Dec 2012 20:07:06 -0800 Subject: [PATCH] Return an associative array of link results Return an associative array of link results, rather than a simple parsed array. This would allow accessing .first, .last etc., rather than searching --- main.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.js b/main.js index 1b56767..34ca092 100644 --- a/main.js +++ b/main.js @@ -128,7 +128,12 @@ httpLink.parse = function(value) { if (pos < value.length) throw new Error('Unexpected token: ' + pos); - return links; + //return an associative array of {rel:href *} + var result = {}; + links.forEach(function(link){ + result[link.rel] = link.href; + }); + return result; }; })(exports || (htmlLink = {}));