Skip to content

Instantly share code, notes, and snippets.

@ealush
Last active February 21, 2018 08:58
Show Gist options
  • Select an option

  • Save ealush/34cd418a334ecb70cbc45c4b7c9f008f to your computer and use it in GitHub Desktop.

Select an option

Save ealush/34cd418a334ecb70cbc45c4b7c9f008f to your computer and use it in GitHub Desktop.
passable-example
import passable, { enforce } from passable;
passable('new_user_form', (test) => {
test('username', 'Must be between 5 and 20 chars', () => {
enforce(username).allOf({
largerThan: 4,
smallerThan: 20
});
});
test('age', 'You must be over 13 to register', () => {
enforce(age).isNumber().largerThan(13);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment