Skip to content

Instantly share code, notes, and snippets.

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;
// 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'