Skip to content

Commit 32f8e5d

Browse files
committed
ES5
1 parent 98f24b2 commit 32f8e5d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Diff for: index.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ var D2R = 0.01745329251994329577;
22
import parser from './parser';
33
import {sExpr} from './process';
44

5-
5+
var knownTypes = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS', 'GEOCCS', 'PROJCS', 'LOCAL_CS', 'GEODCRS',
6+
'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];
67

78
function rename(obj, params) {
89
var outName = params[0];
@@ -21,24 +22,24 @@ function d2r(input) {
2122

2223
function cleanWKT(wkt) {
2324
var keys = Object.keys(wkt);
24-
keys.forEach(key => {
25+
for (var i = 0, ii = keys.length; i <ii; ++i) {
26+
var key = keys[i];
2527
// the followings are the crs defined in
2628
// https://github.com/proj4js/proj4js/blob/1da4ed0b865d0fcb51c136090569210cdcc9019e/lib/parseCode.js#L11
27-
if (['PROJECTEDCRS', 'PROJCRS', 'GEOGCS', 'GEOCCS', 'PROJCS', 'LOCAL_CS', 'GEODCRS',
28-
'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'].includes(key)) {
29-
setPropertiesFromWkt(wkt[key]);
30-
};
29+
if (knownTypes.indexOf(key) !== -1) {
30+
setPropertiesFromWkt(wkt[key]);
31+
}
3132
if (typeof wkt[key] === 'object') {
3233
cleanWKT(wkt[key]);
3334
}
34-
});
35+
}
3536
}
3637

3738
function setPropertiesFromWkt(wkt) {
3839
if (wkt.AUTHORITY) {
3940
var authority = Object.keys(wkt.AUTHORITY)[0];
4041
if (authority && authority in wkt.AUTHORITY) {
41-
wkt.title = `${authority}:${wkt.AUTHORITY[authority]}`;
42+
wkt.title = authority + ':' + wkt.AUTHORITY[authority];
4243
}
4344
}
4445
if (wkt.type === 'GEOGCS') {

0 commit comments

Comments
 (0)