Registry / storage / schimitar

schimitar

JSON →
library1.1.0jsnpmunverified

A lightweight schema-based data cutter that removes properties or array items from JavaScript objects based on a JSON Schema definition. Version 1.1.0 is the latest stable release with no defined release cadence. It provides naive sanitisation for trimming objects to a schema shape, but does not perform validation or throw errors on mismatches. Unlike validators like Ajv, schimitar focuses solely on cutting unwanted data, making it suitable for simple sanitisation before further processing.

npm install schimitar
INSTALL
IMPORT
SIG · SCHIMITAR
S
schimitar
storagejavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

schimitar
import schimitar from 'schimitar'
const schimitar = require('schimitar')
CommonJS require is still valid but ESM import is recommended for modern environments.
default
const schimitar = require('schimitar');
const { schimitar } = require('schimitar');
The package exports a single function as default, no named exports.

Demonstrates using schimitar to remove unwanted properties from an object based on a JSON Schema.

import schimitar from 'schimitar'; const data = { name: 'John', age: 30, password: 'secret', email: 'john@example.com' }; const schema = { type: 'object', properties: { name: { type: 'string' }, email: { type: 'string' } }, additionalProperties: false }; const cleaned = schimitar(data, schema); console.log(cleaned); // { name: 'John', email: 'john@example.com' }
Debug
Known issues
gotchaschimitar does not validate data types; it only removes properties not in the schema.
fix
Use a validator like Ajv for type checking.
affects: >=1.0.0
gotchaIf the schema uses additionalProperties: false, all properties not listed in properties are removed; no error is thrown.
fix
Ensure your schema correctly defines all allowed properties.
affects: >=1.0.0
gotchaArray items removal is naive; it may corrupt nested structures.
fix
Inspect output carefully; consider using more robust sanitisation for complex data.
affects: >=1.0.0
gotchaPackage has no TypeScript definitions; using with TypeScript may require custom type declarations.
fix
Create a .d.ts file: declare module 'schimitar' { export default function schimitar(data: any, schema: any): any; }
affects: >=1.0.0
gotchaThe function returns undefined for invalid input (e.g., non-object data) without throwing.
fix
Check the return value before using it.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: schimitar is not a function
Incorrect import: using destructured import with named export.
fix
Use default import: import schimitar from 'schimitar'
Cannot find module 'schimitar'
Package not installed or incorrect path.
fix
Run: npm install schimitar
Uncaught TypeError: Cannot read properties of undefined (reading 'name')
schimitar returned undefined because data was not an object.
fix
Ensure data is a plain object before passing to schimitar.
Error: Unknown schema type 'null'
Schema uses a type not supported by schimitar.
fix
Only use types: object, array, string, number, boolean, integer. See docs for full support.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
16
Resources
schimitar — npm install schimitar · libregistry