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

Feature request: support regexp capture group for rename #1403

Open
rokoroku opened this Issue Jan 18, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@rokoroku
Contributor

rokoroku commented Jan 18, 2018

Context

  • joi version: 13.1.0

What are you trying to achieve or the steps to reproduce ?

const schema = Joi.object().rename(/^someprefix-(\w+)$/g, '$1', { ignoreUndefined: true, multiple: true });
schema.validate({ 'someprefix-A': 1, 'someprefix-B': 2 }, { convert: true });

Which result you had ?

{ '$1': 1, 'someprefix-B': 2 }

renaming by capture group is not work.

What did you expect ?

from supports regexp, so why not add support capturing group to to parameter?

@DavidTPate

This comment has been minimized.

Contributor

DavidTPate commented Jan 20, 2018

@rokoroku We're always glad to work towards merging a PR if someone wants to take this on.

@DavidTPate DavidTPate added the request label Jan 20, 2018

@Marsup Marsup added the help wanted label Aug 13, 2018

@Marsup

This comment has been minimized.

Member

Marsup commented Aug 13, 2018

Any takers for this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment