This file contains 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
const fs = require("fs"); | |
const normalize = (data) => { | |
const isObject = (data) => | |
Object.prototype.toString.call(data) === "[object Object]"; | |
const isArray = (data) => | |
Object.prototype.toString.call(data) === "[object Array]"; | |
const flatten = (data) => { | |
if (!data.attributes) return data; |
This file contains 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
// use jquery in the webpage to fetch the text of each of the rows from the table. | |
$(temp).find('tr').each( function(index, element) { $(element).find('td').each(function(index2,element2){ console.log($(element))})}); | |
// Then using the following regex setup a text file for replace. | |
([a-z|A-Z|\-|\.|\s]+)([0-9|\-|\,|\s]+)([A-Z]{2})\s\/\s([A-Z]{3})(.*) | |
//the final output should be good enough for a csv file | |
' Afghanistan','93','AF','AFG' |