Last active
March 18, 2018 10:59
-
-
Save Willian-Zhang/7e5d365be44319afc9aadbe0ff04aadf to your computer and use it in GitHub Desktop.
Extract React Form Data
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
$('.reactable-data').find('tr').toArray() | |
.map(tr=> | |
$(tr).find('td').toArray() | |
.map(td=> | |
[$(td).attr('label').replace(',[object Object]',''), | |
$(td).attr('value') && $(td).attr('value').match('[object Object]') ? $(td).text() : $(td).attr('value') | |
] | |
) | |
.reduce((map, tuple) => { | |
if(tuple[0] != ' '){ | |
// ignore " " | |
map[tuple[0]] = tuple[1]; | |
} | |
return map; | |
}, {}) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment