helpers / handlebars-helpers

188 handlebars helpers in ~20 categories. Can be used with Assemble, Ghost, YUI, express.js etc.
http://assemble.io/helpers/
MIT License
2.22k stars 365 forks source link

String helper `split` doesn't split by empty string. #414

Open mbehzad opened 1 year ago

mbehzad commented 1 year ago

Hi, split helper will ignore the empty string ("") as the separator and fall back to comma (,) which is a different behavior compared to the JS's String.prototype.split method. e.g.: {{split "text" ""}} -> ["text"] but "text".split("") -> ["t", "e", "x", "t"]

The issue with util.isString and it returning false for the empty string was previously discussed in issue #273 . but i think for this helper it makes sense to have different logic.

I can provide a PR if you are open to it.