Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

error messages

  • Loading branch information...
commit 6a637f922dd964aac20913907c186c6b11305f14 1 parent 08764d7
@chjj chjj authored
Showing with 5 additions and 6 deletions.
  1. +5 −6 lib/json.js
View
11 lib/json.js
@@ -125,6 +125,9 @@ Parser.prototype._parse = function(data) {
}
break;
case ':':
+ if (!this.value) {
+ return this._unexpected(ch);
+ }
this.emit('object key', this.value);
this.value = '';
break;
@@ -140,9 +143,7 @@ Parser.prototype._parse = function(data) {
case '8':
case '9':
if (this.value) {
- return this._error(this.value
- + ' in buffer before literal.'
- );
+ return this._unexpected(ch);
}
this.state = 'number';
this.value += ch;
@@ -151,9 +152,7 @@ Parser.prototype._parse = function(data) {
case 'n':
case 't':
if (this.value) {
- return this._error(this.value
- + ' in buffer before literal.'
- );
+ return this._unexpected(ch);
}
this.state = ch;
break;
Please sign in to comment.
Something went wrong with that request. Please try again.