check-if
Input validation for Apollo Server.
Details
A collection of functions to validate the input received in Apollo GraphQL Server. When a validation fails the function throw one of Apollo Server's exceptions which are appropriately processed by Apollo Server. For more details on the errors see https://www.apollographql.com/docs/apollo-server/v2/features/errors.html.
Usage
Install module
npm install --save check-if
Sample
const checkIf = require('check-if')
checkIf.isValidDateInMs(value, argumentName)
Functions
Functions | Description | Exception |
---|
isValidDateInMs(value, argumentName) | Validates that: - value is not Nil - typeof value is number - value can be parsed by new Date(value) | UserInputError |