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

When replacestream is used replace function is passed array of matches #30

Closed
nlundquist opened this issue Dec 23, 2014 · 10 comments
Closed

Comments

@nlundquist
Copy link

As per the replacestream docs (https://github.com/eugeneware/replacestream) the replacement function is passed an array of matches rather than being called with the matches as parameters, the behaviour of String.replace.

Gulp-replace implies in its documentation that the String.replace behaviour should be expected despite this being false when replacestream is used. This can't be expected by the user. When using replacestream gulp-replace should wrap the replacement function so that the array is converted into parameters for the wrapped function.

@mehtaphysical
Copy link

Maybe this is something i should change with replacestream. I think it is easier if everything is consistent with String.replace

@lazd
Copy link
Owner

lazd commented Jan 9, 2015

Hmm, I agree we should definitely be consistent between a regex match on a stream and on a buffer.

@mehtaphysical @eugeneware, what do you think?

@mehtaphysical
Copy link

I'm willing to make that change. I wonder what @eugeneware thinks. I created an issue eugeneware/replacestream#15

@eugeneware
Copy link

It's ok by me. Consistency and ease of use should trump compatibility. 👍

@lazd
Copy link
Owner

lazd commented Jan 16, 2015

@eugeneware @mehtaphysical any timeline on getting this made consistent? I'm thinking a temporary workaround as suggested by @nlundquist is in order until it's changed in replacestream.

@mehtaphysical
Copy link

@lazd it's a pretty easy change. I'll write it this weekend and let @eugeneware review it.

@lazd
Copy link
Owner

lazd commented Jan 16, 2015

Sounds great, thanks!

@eugeneware
Copy link

Sounds like a plan! :-)

@mehtaphysical
Copy link

@lazd done :)

@lazd lazd closed this as completed in 5f2361a Jan 21, 2015
@lazd
Copy link
Owner

lazd commented Jan 21, 2015

Released as [email protected].

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

No branches or pull requests

4 participants