Skip to content

Commit

Permalink
Change params to args instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fionn Kelleher committed Dec 1, 2013
1 parent affff63 commit 9420ff6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions lib/message.coffee
Expand Up @@ -9,7 +9,7 @@ class Message
@tags = {}
@prefix = ""
@command = ""
@params = []
@args = []
position = 0
nextspace = 0

Expand Down Expand Up @@ -48,17 +48,17 @@ class Message
while position < line.length
nextspace = line.indexOf " ", position
if line.charAt(position) is ":"
@params.push line.substring position + 1
@args.push line.substring position + 1
break

if nextspace isnt -1
@params.push line.substring position, nextspace
@args.push line.substring position, nextspace
position = nextspace + 1
position++ while line.charAt(position) is " "
continue

if nextspace is -1
@params.push line.substring position
@args.push line.substring position
break
return

Expand All @@ -78,12 +78,12 @@ class Message
if @command.length isnt 0
string += "#{@command} "

if @params.length isnt 0
for param in @params
if param.indexOf " " isnt -1
string += "#{param} "
if @args.length isnt 0
for arg in @args
if arg.indexOf " " isnt -1
string += "#{arg} "
else
string += ":#{param} "
string += ":#{arg} "

string = string.slice 0, -1
return string
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "irc-message",
"version": "0.1.0",
"version": "0.1.1",
"description": "A blazing fast parser for IRC messages.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 9420ff6

Please sign in to comment.