handlebars-helpers icon indicating copy to clipboard operation
handlebars-helpers copied to clipboard

Unable to join with an empty string separator

Open sambrenner opened this issue 7 years ago • 1 comments

The join helper checks to make sure that the supplied separator is a string using isString in the handlebars-utils repo. Because isString also makes sure the supplied string is non-empty, this means that I am unable to use an empty string separator in a join block.

i.e. I would expect that this handlebars

{{join myArray ""}}

would produce

item1item2item3

when in fact it produces

item1, item2, item3

Source for this repo: https://github.com/helpers/handlebars-helpers/blob/master/lib/array.js#L297 Source for utils repo: https://github.com/helpers/handlebars-utils/blob/master/index.js#L490

Personally I think a function called isString shouldn't care whether the string is empty or not, but since this is the documented behavior of the function in handlebars-utils library, I've opened the issue here.

sambrenner avatar Oct 05 '17 18:10 sambrenner

Hmm, I think we should check for an empty string, instead of undefined (assuming this is what it's checking for now) and do what you're describing. thanks for the issue

jonschlinkert avatar Nov 17 '17 03:11 jonschlinkert