Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imported data from the FBTEE (French Book Trade in Enlightenment Europe) project #322

Closed
wants to merge 17 commits into from
Closed
3 changes: 1 addition & 2 deletions fbtee/C18thBookMarkets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2527,8 +2527,7 @@
"sovereign": "Prussia: Neuchâtel",
"C21_admin": "Neuchâtel",
"C21_country": "Switzerland",
"zone": "Helvetic",
"distance": 0
"zone": "Helvetic"
},
{
"name": "NEUFCHATEAU",
Expand Down
12 changes: 10 additions & 2 deletions stn.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,16 @@ function queryPromise (query) {
return new Promise (function (resolve, reject) {
connection.query (query, function (error, results, fields) {
if (error) throw error
// console.warn (JSON.stringify (results, null, 2))
resolve (results)
var cleanResults = results.map (function (row) {
var cleanRow = {}
Object.keys(row).forEach (function (key) {
var val = row[key]
if (val)
cleanRow[key] = (parseInt(val).toString() === val ? parseInt(val) : val)
})
return cleanRow
})
resolve (cleanResults)
})
})
}
Expand Down