Skip to content

Instantly share code, notes, and snippets.

@sofish
Created November 23, 2013 09:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sofish/7612557 to your computer and use it in GitHub Desktop.
Save sofish/7612557 to your computer and use it in GitHub Desktop.
people.js
var names = [], emails = [], result = [];
var value = function(nodeList, target){
[].slice.call(nodeList).forEach(function(item){
target.push(item.textContent);
});
return target.slice(1);
};
var select = function(selector){
return document.querySelectorAll(selector);
};
names = value(select('.yui-dt-col-name'), names);
emails = value(select('.yui-dt-col-email'), emails);
names.forEach(function(item, i){
result.push({
name: item,
email: emails[i]
})
});
console.log(JSON.stringify(result));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment