@@ -27,7 +27,7 @@ function getNodes(xml: Document): Record<number, NodeObject> {
27
27
const result : Record < number , NodeObject > = { }
28
28
29
29
const nodes = xml . getElementsByTagName ( 'node' )
30
- for ( const i = 0 ; i < nodes . length ; i ++ ) {
30
+ for ( let i = 0 ; i < nodes . length ; i ++ ) {
31
31
const node = nodes [ i ] ,
32
32
id = node . getAttribute ( 'id' )
33
33
if ( node && id ) {
@@ -53,7 +53,7 @@ function getWays(
53
53
const result : WayObject [ ] = [ ]
54
54
55
55
const ways = xml . getElementsByTagName ( 'way' )
56
- for ( const i = 0 ; i < ways . length ; i ++ ) {
56
+ for ( let i = 0 ; i < ways . length ; i ++ ) {
57
57
const way = ways [ i ] ,
58
58
nds = [ ...way . getElementsByTagName ( 'nd' ) ]
59
59
const way_object : WayObject = {
@@ -79,7 +79,7 @@ function getRelations(
79
79
const result : RelationObject [ ] = [ ]
80
80
81
81
const rels = xml . getElementsByTagName ( 'relation' )
82
- for ( const i = 0 ; i < rels . length ; i ++ ) {
82
+ for ( let i = 0 ; i < rels . length ; i ++ ) {
83
83
const rel = rels [ i ] ,
84
84
members = [ ...rel . getElementsByTagName ( 'member' ) ]
85
85
const rel_object : RelationObject = {
@@ -104,7 +104,7 @@ function getTags(xml: Element): Record<string, string> {
104
104
105
105
const tags = xml . getElementsByTagName ( 'tag' )
106
106
if ( tags ) {
107
- for ( const j = 0 ; j < tags . length ; j ++ ) {
107
+ for ( let j = 0 ; j < tags . length ; j ++ ) {
108
108
const k = tags [ j ] . getAttribute ( 'k' )
109
109
const v = tags [ j ] . getAttribute ( 'v' )
110
110
if ( k !== null && v !== null ) {
@@ -150,7 +150,7 @@ export default function osm2geojson(xml: Document): GeoJSON.FeatureCollection {
150
150
type : 'FeatureCollection' ,
151
151
features : buildFeatures ( xml )
152
152
. map ( ( feature , index ) => {
153
- const geom : GeoJSON . Feature | undefined = undefined
153
+ let geom : GeoJSON . Feature | undefined = undefined
154
154
155
155
if ( feature . type === 'node' ) {
156
156
geom = {
@@ -161,7 +161,7 @@ export default function osm2geojson(xml: Document): GeoJSON.FeatureCollection {
161
161
} else if ( feature . type === 'way' ) {
162
162
const lngLats = new Array ( feature . nodes . length )
163
163
164
- for ( const j = 0 ; j < feature . nodes . length ; j ++ ) {
164
+ for ( let j = 0 ; j < feature . nodes . length ; j ++ ) {
165
165
lngLats [ j ] = feature . nodes [ j ] . lngLat
166
166
}
167
167
@@ -192,14 +192,15 @@ function buildFeatures(xml: Document): OsmObject[] {
192
192
ways = getWays ( xml , nodes ) ,
193
193
relations = getRelations ( xml , nodes , ways )
194
194
195
- for ( const node_id in nodes ) {
195
+ let node_id ;
196
+ for ( node_id in nodes ) {
196
197
const node = nodes [ node_id ]
197
198
if ( interestingNode ( node , ways , relations ) ) {
198
199
features . push ( node )
199
200
}
200
201
}
201
202
202
- for ( const i = 0 ; i < ways . length ; i ++ ) {
203
+ for ( let i = 0 ; i < ways . length ; i ++ ) {
203
204
const way = ways [ i ]
204
205
features . push ( way )
205
206
}
@@ -212,7 +213,8 @@ function isWayArea(way: WayObject): boolean {
212
213
return false
213
214
}
214
215
215
- for ( const key in way . tags ) {
216
+ let key
217
+ for ( key in way . tags ) {
216
218
if ( ~ options . areaTags . indexOf ( key ) ) {
217
219
return true
218
220
}
@@ -226,9 +228,9 @@ function interestingNode(
226
228
ways : WayObject [ ] ,
227
229
relations : RelationObject [ ]
228
230
) : boolean {
229
- const used = false
231
+ let used = false
230
232
231
- for ( const i = 0 ; i < ways . length ; i ++ ) {
233
+ for ( let i = 0 ; i < ways . length ; i ++ ) {
232
234
if ( ways [ i ] . nodes . indexOf ( node ) >= 0 ) {
233
235
used = true
234
236
break
@@ -239,11 +241,12 @@ function interestingNode(
239
241
return true
240
242
}
241
243
242
- for ( const i = 0 ; i < relations . length ; i ++ ) {
244
+ for ( let i = 0 ; i < relations . length ; i ++ ) {
243
245
if ( relations [ i ] . members . indexOf ( node ) >= 0 ) return true
244
246
}
245
247
246
- for ( const key in node . tags ) {
248
+ let key
249
+ for ( key in node . tags ) {
247
250
if ( options . uninterestingTags . indexOf ( key ) < 0 ) {
248
251
return true
249
252
}
0 commit comments