npm.io
0.0.2 • Published 9 years ago

graphql-type-validator

Licence
MIT
Version
0.0.2
Deps
1
Vulns
0
Weekly
0
Stars
2

graphql-type-validator

Custom validations for graphql scalars

Example:

import graphqlValidator from 'graphql-type-validator'

const GraphQLPrimitiveType = graphqlValidator({
	name: 'StringOrNumber',
	validate: function(value) {
		return typeof value === 'string' || typeof value === 'number'
	},
	error: 'Custom error message'
})