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

feat(scully): Add replaceFirstRouteParamWithVal util #123

Merged
merged 2 commits into from
Jan 3, 2020

Conversation

aaronfrost
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

I have added a util function for plugin authors who need to replace the first parameterized value in a route with a provided value. It is simple, but could go wrong.

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Other... Please describe:

What is the current behavior?

this will make life easier for plugin authors who will be doing this often.

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Often people will need to replace the first route param
with a value. To prevent them from recreating the split
logic and join logic and break logic, this function is
a reusable util that people can use.
@claassistantio
Copy link

claassistantio commented Dec 31, 2019

CLA assistant check
All committers have signed the CLA.

@aaronfrost aaronfrost changed the title Frosty/replace first param with val feat(scully): Add replaceFirstRouteParamWithVal util Dec 31, 2019
@SanderElias
Copy link
Contributor

@aaronfrost I think this functionality should be merged with the routeSplit utility.
That util function returns all parameters as an object, as well as a function that will recreate the url with the options in positional order.

Perhaps we should extend that function to include the partial replacements you are doing?

@aaronfrost
Copy link
Contributor Author

Yeah. I agree. I was not sure where we should put this. Since the utils were all in their own file, I wasn't sure if I should add it in or put it in it's own file.

What do you think we should do?

Copy link
Contributor

@SanderElias SanderElias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@SanderElias SanderElias merged commit c4b8a28 into master Jan 3, 2020
@SanderElias SanderElias deleted the frosty/replaceFirstParamWithVal branch January 3, 2020 14:26
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.

3 participants