modularise line-parser

I'd like to build an IMAP server.  It will need to be able to parse IMAP line commands in pretty much exactly the same way that this IMAP client does.  It would be great if we can use this, which is currently just your module split out and with slight changes to match my preferred coding styles.

I've left your unit test in, since it still parses when tested against my version, but in the future it should probably be removed.

If it's OK with you I'd like to add you as an owner of the @hashmail organisation and we can continue to collaborate on this component?