1.1.1 • Published 5 years ago

validator-factory v1.1.1

Weekly downloads
2
License
ISC
Repository
github
Last release
5 years ago

@ryanburnette/validator-factory

npm version

Description

An implementation of Validate.js as a factory for creating JavaScript object validators.

Usage

var validatorFactory = require('validator-factory');
<script src="https://unpkg.com/validator-factory@1.1.0/dist/index.min.js"></script>
var validate = createValidator({
  foo: {
    presence: true,
    length: {
      minimum: 3
    }
  },
  email: {
    presence: true,
    email: true
  }
})

validate({
  email: 'lois.griffin'
})
// => { body: { email: 'lois.griffin' },validation: { foo: [ "can't be blank" ], email: [ 'is not a valid email' ] } }

validate({
  foo: 'abc',
  email: 'lois.griffin@gmail.com'
})
// => { body: { foo: 'abc', email: 'lois.griffin@gmail.com' }, validation: false } 
1.1.1

5 years ago

1.1.0

5 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago