Skip to content

Commit 06b56b0

Browse files
committed
feature(package) try-catch v2.0.0
1 parent 70392ba commit 06b56b0

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
language: node_js
22
node_js:
3-
- 5
43
- 4
4+
- 6
5+
- 8
56

67
script:
7-
- npm run codestyle
8+
- npm run lint
89
- npm run coverage && npm run report
910

1011
notifications:

lib/writejson.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

3-
var fs = require('fs'),
4-
tryCatch = require('try-catch');
3+
var fs = require('fs');
4+
var tryCatch = require('try-catch');
55

66
module.exports = function(name, json, options, callback) {
77
var str;
@@ -28,14 +28,11 @@ function sync(name, data, options) {
2828
}
2929

3030
module.exports.sync.try = function(name, data, options) {
31-
var error;
32-
3331
options = options || {};
3432
check(name, data, options);
3533

36-
error = tryCatch(function() {
37-
sync(name, data, options);
38-
});
34+
var result = tryCatch(sync, name, data, options);
35+
var error = result[0];
3936

4037
return error;
4138
};

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"scripts": {
1212
"jscs": "jscs --esnext lib test",
1313
"jshint": "jshint lib test",
14-
"codestyle": "redrun jshint jscs",
14+
"lint": "redrun jshint jscs",
1515
"test": "tape test/*.js",
1616
"coverage": "nyc npm test",
1717
"report": "nyc report --reporter=text-lcov | coveralls"
@@ -26,7 +26,7 @@
2626
"json"
2727
],
2828
"dependencies": {
29-
"try-catch": "~1.0.0"
29+
"try-catch": "^2.0.0"
3030
},
3131
"devDependencies": {
3232
"coveralls": "^3.0.0",

0 commit comments

Comments
 (0)