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

[FEATURE REQUEST] To allow renaming field name #11

Open
motss opened this issue Nov 19, 2017 · 0 comments
Open

[FEATURE REQUEST] To allow renaming field name #11

motss opened this issue Nov 19, 2017 · 0 comments

Comments

@motss
Copy link

motss commented Nov 19, 2017

This feature request might be useful for folks who need it:

const wl = require('whitelister');

const schema = {
  type: 'object',
  attributes: {
    first_name: { type: 'string', as: 'firstName' },
    last_name: { type: 'string', as: 'lastName' },
    type: { type: 'string', as: 'userType' },
  },
};
const data = {
  first_name: 'John',
  last_name: 'Doe',
  type: 'VIP',
};
const results = await wl(schema, data);
/**
 * {
 *   firstName: 'John'
 *   lastName: 'Doe',
 *   userType: 'VIP',
 * }
 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants