mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 00:54:03 +02:00
Return the empty string when calling toOSM() on entities with test IDs
This commit is contained in:
@@ -36,7 +36,11 @@ osmEntity.id.fromOSM = function(type, id) {
|
||||
|
||||
|
||||
osmEntity.id.toOSM = function(id) {
|
||||
return id.slice(1);
|
||||
var match = id.match(/^[cnwr](-?\d+)$/);
|
||||
if (match) {
|
||||
return match[1];
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
|
||||
@@ -129,7 +133,8 @@ osmEntity.prototype = {
|
||||
|
||||
|
||||
isNew: function() {
|
||||
return this.osmId() < 0;
|
||||
var osmId = osmEntity.id.toOSM(this.id);
|
||||
return osmId.length === 0 || osmId[0] === '-';
|
||||
},
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user