Schema-Inspector is a JavaScript library for sanitizing and validating JS objects, supporting both synchronous and asynchronous operations. The current stable version is 2.1.0, released with security fixes for email validation regex in 2.0.0 and 2.0.3. It is designed for client-side and server-side use, offering a simple schema definition format distinct from JSON Schema, with built-in sanitization rules like trimming and case conversion. It is maintained with an active GitHub repository and CI workflows.
npm install schema-inspectorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to sanitize (trim, title-case, lowercase) and validate data using schema-inspector.
Use custom validation function for email if you need the old behavior.
Clone the data before sanitizing: const sanitizedData = JSON.parse(JSON.stringify(originalData));
Switch to npm or import via script tag from CDN.
Use ajv, joi, or zod if you need JSON Schema compatibility.
Test email validation thoroughly and consider using custom pattern if needed.
Ensure sanitization/validation schema has proper structure with 'type' and 'properties'.
Check documentation for supported rules: 'trim', 'title', 'lower', 'upper', etc.
Use pattern: 'email' or provide a custom regex string.
Run 'npm install schema-inspector' and use correct import: 'schema-inspector' (not 'schema/Inspector' or similar).
No dependency data recorded yet.