A zero-dependency, aggressive JSON schema validator. It arrests your bad data.
validationjsonschemautility
typescript 9 1 3 4 files
README.md
struct-police 👮♂️
Stop letting bad JSON roam free in your application.
struct-police is a lightweight, zero-dependency validator that strictly enforces schema rules. If your data doesn't fit, it goes to jail (throws an error).
Usage
import { police } from 'struct-police';
const schema = {
type: 'object',
required: ['id', 'username'],
properties: {
id: { type: 'number' },
username: { type: 'string' }
}
};
police(data, schema); // Safe or throws