This commit is contained in:
2020-12-22 15:35:24 +00:00
parent 295cf4c0c4
commit 1ad5246fba
4 changed files with 33 additions and 12 deletions

View File

@@ -607,6 +607,18 @@ export default {
return obj === true || obj === false || typeof variable === "boolean";
},
///////////////////////////////////////////////
// parse to number or null if not a number
// used because route params can turn into strings
// on their own
//
stringToIntOrNull: function(n) {
const ret = Number.parseInt(n, 10);
if (Number.isNaN(ret)) {
return null;
}
return ret;
},
///////////////////////////////////////////////
// Use geolocation api to attempt to get current location
// try high accuracy first and downgrade if unavailable
//https://www.openstreetmap.org/?mlat=48.3911&mlon=-124.7353#map=12/48.3910/-124.7353