Skip to content

Commit 290912d

Browse files
committed
Modernize dependencies
1 parent 656312b commit 290912d

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"browser": "browserify -t brfs test/index.js | testling"
1212
},
1313
"devDependencies": {
14-
"tape": "~2.4.2",
14+
"tape": "~2.12.3",
1515
"brfs": "~0.2.1"
1616
},
1717
"bin": {
@@ -44,8 +44,8 @@
4444
},
4545
"license": "BSD",
4646
"dependencies": {
47-
"optimist": "~0.3.5",
48-
"xmldom": "~0.1.16",
49-
"concat-stream": "~1.0.1"
47+
"xmldom": "~0.1.19",
48+
"concat-stream": "~1.4.5",
49+
"minimist": "0.0.8"
5050
}
5151
}

togeojson

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
11
#!/usr/bin/env node
22

33
var tj = require('./'),
4-
opt = require('optimist')
5-
.usage('Usage: $0 [-f format] FILE')
6-
.describe('f', 'file format. if not given, will be detected by filename')
7-
.default('f', 'kml'),
8-
argv = opt.argv,
4+
argv = require('minimist')(process.argv.slice(2)),
95
concat = require('concat-stream'),
106
fs = require('fs'),
117
xmldom = new (require('xmldom').DOMParser)();
128

13-
var filename = argv._[0] || '', f = (argv.f);
9+
var filename = argv._[0] || '',
10+
filetype = (argv.f || 'kml');
1411

15-
if (filename.match(/\.kml$/i)) f = 'kml';
16-
if (filename.match(/\.gpx$/i)) f = 'gpx';
12+
if (filename.match(/\.kml$/i)) filetype = 'kml';
13+
if (filename.match(/\.gpx$/i)) filetype = 'gpx';
1714

18-
if (process.stdin.isTTY && !argv._[0]) return opt.showHelp();
15+
if (!tj[filetype] || (process.stdin.isTTY && !argv._[0])) {
16+
return help();
17+
}
1918

2019
(argv._.length ? fs.createReadStream(argv._[0]) : process.stdin).pipe(concat(convert));
2120

2221
function convert(data) { process.stdout.write(
23-
JSON.stringify(tj[f](xmldom.parseFromString(data.toString())), null, 4));
22+
JSON.stringify(tj[filetype](xmldom.parseFromString(data.toString())), null, 4));
23+
}
24+
25+
function help() {
26+
console.error('Usage: togeojson [-f format] FILE\n' +
27+
'-f file format. if not given, will be detected by filename');
2428
}

0 commit comments

Comments
 (0)