Skip to content
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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bhavesh-Parmar
Copy link

@Bhavesh-Parmar Bhavesh-Parmar commented Mar 26, 2022

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

helpers.reverse = function(str) {

helpers.reverse = function(str) { if (!util.isString(str)) return ''; return str.split('').reverse().join(''); };
Array's reverse function
helpers.reverse = function(val) {

helpers.reverse = function(val) { if (Array.isArray(val)) { val.reverse(); return val; } if (val && typeof val === 'string') { return val.split('').reverse().join(''); } };

@HardikKaliyani
Copy link

Yes we actually need to fix this problem

@Bhavesh-Parmar Bhavesh-Parmar changed the title revers function removed from string reverse function removed from string (try to solve reverse functions problem) Mar 28, 2022
@demius
Copy link

demius commented Apr 1, 2022

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

@jonschlinkert
Copy link
Member

@demius, this is you, right?

image

@VijaytParmar
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants