mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-02 21:21:37 +02:00
reduce use of parseFloat
as it silently strips non-numeric suffixes (e.g. a value of "123 foo" is transformed into a numeric value of 123 by `parseFloat`, which is typically not what we desire)
This commit is contained in:
@@ -523,7 +523,7 @@ export function validationCrossingWays(context) {
|
||||
|
||||
var crossedWay = graph.hasEntity(crossedWayID);
|
||||
// use the explicit width of the crossed feature as the structure length, if available
|
||||
var structLengthMeters = crossedWay && crossedWay.tags.width && parseFloat(crossedWay.tags.width);
|
||||
var structLengthMeters = crossedWay && isFinite(crossedWay.tags.width) && Number(crossedWay.tags.width);
|
||||
if (!structLengthMeters) {
|
||||
// if no explicit width is set, approximate the width based on the tags
|
||||
structLengthMeters = crossedWay && crossedWay.impliedLineWidthMeters();
|
||||
|
||||
@@ -56,7 +56,7 @@ export function validationUnsquareWay(context) {
|
||||
|
||||
// user-configurable square threshold
|
||||
var storedDegreeThreshold = prefs('validate-square-degrees');
|
||||
var degreeThreshold = isNaN(storedDegreeThreshold) ? DEFAULT_DEG_THRESHOLD : parseFloat(storedDegreeThreshold);
|
||||
var degreeThreshold = isFinite(storedDegreeThreshold) ? Number(storedDegreeThreshold) : DEFAULT_DEG_THRESHOLD;
|
||||
|
||||
var points = nodes.map(function(node) { return context.projection(node.loc); });
|
||||
if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon, degreeThreshold, true)) return [];
|
||||
|
||||
Reference in New Issue
Block a user