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

reverse function removed from string (try to solve reverse functions problem) #407

Open Bhavesh-Parmar opened 2 years ago

Bhavesh-Parmar commented 2 years ago

reverse function removed form string because it's overwrite revers function of array in array reverse function is defined which is used for both string reverse and array reverse so we don't need string revers function because it make problem. it's overwrite array's revers function so when we use reverse function it always call string reverse function and it can't revers array. String's reverse function https://github.com/helpers/handlebars-helpers/blob/5d3405f178a9ec4c90df3c7dc07b4faf9a09dfd7/lib/string.js#L492 helpers.reverse = function(str) { if (!util.isString(str)) return ''; return str.split('').reverse().join(''); }; Array's reverse function https://github.com/helpers/handlebars-helpers/blob/5d3405f178a9ec4c90df3c7dc07b4faf9a09dfd7/lib/array.js#L473 helpers.reverse = function(val) { if (Array.isArray(val)) { val.reverse(); return val; } if (val && typeof val === 'string') { return val.split('').reverse().join(''); } };

HardikKaliyani commented 2 years ago

Yes we actually need to fix this problem

demius commented 2 years ago

Can this please be merged in? Is this repo still being maintained at all?

jonschlinkert commented 2 years ago

@demius, this is you, right?

image
VijaytParmar commented 2 years ago

This is actually create a problem... Need to merged this...