Created
February 11, 2016 11:16
-
-
Save hughrawlinson/6ad6c42d7c64aed47993 to your computer and use it in GitHub Desktop.
I love functional Javascript and the chrome developer tools.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a=Array.prototype.map.bind(document.querySelectorAll('.row>.col-lg-3'))(function(a){ | |
return [ | |
a.children[0].innerText, | |
Array.prototype.map.bind(a.children[1].children)(function(b){ | |
var anchor = b.children[0]; | |
return {name:anchor.innerText,href:anchor.href}; | |
}) | |
]; | |
}).reduce(function(acc,el){ | |
acc[el[0]] = el[1]; | |
return acc; | |
},{}); | |
console.table(Object.keys(a).reduce(function(acc,el){ | |
a[el].map(function(e){ | |
acc.push([el,e.name,e.href]); | |
}); | |
return acc; | |
},[]),[0,1,2]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment