We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 26699fa commit 9b479bcCopy full SHA for 9b479bc
index.js
@@ -322,17 +322,22 @@ function decodeString(str) {
322
323
// look up json data
324
if (str.charAt(++i)) {
325
- try {
326
- p.data = json.parse(str.substr(i));
327
- } catch(e){
328
- return error();
329
- }
+ p = tryParse(p, str.substr(i));
330
}
331
332
debug('decoded %s as %j', str, p);
333
return p;
334
335
+function tryParse(p, str) {
+ try {
+ p.data = json.parse(str);
+ } catch(e){
336
+ return error();
337
+ }
338
+ return p;
339
+};
340
+
341
/**
342
* Deallocates a parser's resources
343
*
0 commit comments