Skip to content

Instantly share code, notes, and snippets.

@dtothefp
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save dtothefp/794a2862dd0a2733396b to your computer and use it in GitHub Desktop.

Select an option

Save dtothefp/794a2862dd0a2733396b to your computer and use it in GitHub Desktop.
//input type => Array
var exInput = [
{
name: 'first_name',
type: 'text',
value: 'burritos',
validation: {
customType: 'email',
conditions: /stuff/
}
},
//.....
];
//output type => Object
var exOutput = {
[/* name of the input */]: {
type: 'text',
value: 'burritos',
error: `${value} is not an ${validation.customType}`
},
[/* name of another input */]: //.......
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment