You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.markdown
+4-8Lines changed: 4 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,7 +78,7 @@ options are:
78
78
*`opts.readPackage(readFile, pkgfile, cb)` - function to asynchronously read and parse a package.json file
79
79
* readFile - the passed `opts.readFile` or `fs.readFile` if not specified
80
80
* pkgfile - path to package.json
81
-
* cb - callback
81
+
* cb - callback. a SyntaxError error argument will be ignored, all other error arguments will be treated as an error.
82
82
83
83
*`opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field
84
84
* pkg - package data
@@ -152,7 +152,7 @@ default `opts` values:
152
152
var pkg =JSON.parse(body);
153
153
cb(null, pkg);
154
154
} catch (jsonErr) {
155
-
cb(null);
155
+
cb(jsonErr);
156
156
}
157
157
}
158
158
});
@@ -183,7 +183,7 @@ options are:
183
183
184
184
* opts.realpathSync - function to synchronously resolve a potential symlink to its real path
185
185
186
-
*`opts.readPackageSync(readFileSync, pkgfile)` - function to synchronously read and parse a package.json file
186
+
*`opts.readPackageSync(readFileSync, pkgfile)` - function to synchronously read and parse a package.json file. a thrown SyntaxError will be ignored, all other exceptions will propagate.
187
187
* readFileSync - the passed `opts.readFileSync` or `fs.readFileSync` if not specified
0 commit comments