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
+added 'partition', and 'repartition' #5
base: master
Are you sure you want to change the base?
Conversation
I don't know why github considers some files to be changed entirely (Encoding or EOL sign change?) Can you still work with this? |
|
||
// Partitions a string and subsequently joins all parts | ||
slang.repartition = function repartition(input, nblock, concat) { | ||
return input.split(RegExp("(.{"+nblock+"})","gm")).filter(Boolean).join(concat); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can rely on filter
being available cross browser. Maybe try input.match(RegExp(".{1," + n + "}", "gm")
instead to avoid empty strings all together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried hard yet could not find a way to make split avoid empty results. m.buettner comes to the same conclusion here. I will just filter using a for-loop
instead...
Thanks for the pull request! I've added several comments inline. One more: is there any reason why the documentation HTML page generated by docco was moved to Thanks again! I'll merge after these few small issues are fixed. |
The |
Hi there. Please review... |
|
||
|
||
// Test **slang.repartition** | ||
assert.equal('Hel@lo @wor@ld!', slang.repartition('Hello world!')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do the @'s come from in this? Is this missing some arguments?
Added a few more small things inline. Is it possible for you to revert the docs changes and minified JS changes on this PR so there aren't so many files? I will regenerate the docs and minified version after merging. So if possible, just include the code changes, test changes, and README changes. If it's easier, you could open a new PR. Thanks! |
Were you going to finish this or shall I close it? Right now the tests don't pass. |
a great lib.