Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle existing newlines, fixes #10 #15

Closed
wants to merge 1 commit into from

Conversation

kasbah
Copy link

@kasbah kasbah commented Sep 23, 2016

No description provided.

@kasbah
Copy link
Author

kasbah commented Sep 23, 2016

Not sure how to handle special case wrap('a\n b') which currently still comes out as: ' a\n \n b'.
If I remove the end of line check ($) from the regex it comes out as ' a \n b' which is still not quite right.

@kasbah
Copy link
Author

kasbah commented Sep 23, 2016

Seems like this could also be handled by ''.trim() instead of a regex but that seems to mess up everything.

@@ -35,6 +35,9 @@ module.exports = function(str, options) {
}

var lines = str.match(re) || [];
//strip any remaining newline characters at the end of the lines, these could
//be there due to newline characters in the input text
lines = lines.map(function (line) {return line.replace(/(\r\n|\n|\r)$/gm,'')});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the really late reply, I missed this pr somehow. This probably isn't the best solution. I'm not sure what is though, I'll have to try some things out and report back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants