A configurable custom input number scalar type for GraphQL with built-in sanitization and validation for integer and float values. Current stable version 0.0.10. Provides factory functions GraphQLInputInt and GraphQLInputFloat that generate GraphQL scalar types with configurable min/max, sanitize, test, parse, and error handling. Differentiators: lightweight, no other dependencies beyond graphql peer, simple API for defining numeric constraints directly in schema.
npm install graphql-input-numberNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a custom PositiveInt scalar that validates integer >= 0 and uses it in a GraphQL schema.
Always provide a unique 'name' string that matches GraphQL type naming rules.
Test with your graphql version; consider alternatives like graphql-scalars.
Ensure sanitize returns a number, or handle the converted value in validation/test.
Provide a name: GraphQLInputInt({ name: 'MyInt', min: 1 })Check min/max constraints; ensure value is a number.
Ensure input is a valid number. The package only validates numbers, not converts strings.