Skip to content

Commit

Permalink
Added parser.string
Browse files Browse the repository at this point in the history
  • Loading branch information
jutaz committed Dec 16, 2013
1 parent 89bd28a commit 9e197da
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions lib/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,21 @@ parser.chunk = function(connection, chunk, callback) {
}
}

parser.hook = function() {

}

parser.unHook = function() {

parser.string = function(str, callback) {
parsed = {
type: '',
data: '',
original: str,
valid: false
}
if(!str.indexOf(':') < 0) {
callback(null, parsed);
return;
}
index = str.indexOf(':');
parsed.type = str.slice(0, index);
parsed.data = str.slice(index);
callback(null, parsed);
}

module.exports = parser;

0 comments on commit 9e197da

Please sign in to comment.