dominictarr / split

MIT License
347 stars 39 forks source link

Split by char #16

Closed cyrilchapon closed 7 years ago

cyrilchapon commented 9 years ago

This test is a little to loose and should accept '' (empty string is not undefined) as a valid pattern to split by char.

The workaround seems to be /(?!$)/ but I haven't fully tested it.

dominictarr commented 9 years ago

I don't understand what the problem is here... are you trying to get a stream of individual characters?

cyrilchapon commented 9 years ago

I just meant that spliting with empty string could, indeed, stream individual characters (just like the regex does).

Edit: just like string.split does (see accepted answer).

dominictarr commented 9 years ago

So do you actually need to do that and are suggesting it as a feature? Or is this just a headsup? You need to include more context than this in an issue post, I can't tell if there is actually a problem or not.

cyrilchapon commented 9 years ago

@dominictarr

So do you actually need to do that

I did, but I already solved it using my regex. Thanks for trying to help me though =)

are suggesting it as a feature? Or is this just a headsup?

This is more like a headsup indeed. The docs states that "split takes the same arguments as string.split except it defaults to '/\r?\n/' instead of ',',". Though, when passed an empty string '' as an argument, string.split('') splits char by char; whereas the split('')function of your sweet module splits line by line.

You need to include more context than this in an issue post

Sorry I'm not very used to OpenSource. I search for a CONTRIBUTING.md or something but couldn't find. I didn' give any details since I don't realy have a problem. Just trying to help improving the module =)

I could be interested in fixing it, since it would be my first collaboration, and that looks a pretty simple one =). Just need time to dig in to check for side-effects and contributing rules (any unit test or something I wouldn't be familiar with)

cyrilchapon commented 9 years ago

@dominictarr Tried it. Tell me if that's ok

dominictarr commented 9 years ago

@cyrilchapon thanks! that is much better! Congratulations on your first pull request!

cyrilchapon commented 9 years ago

@dominictarr thanks, good experience here