
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
object-model-validator
Advanced tools
npm i object-model-validator
'use strict'
const {types, ObjectModel} = require('object-model-validator')
const model = await new ObjectModel({
name: types.string,
parse: (data) => {
return `${data.name} is Ok`
}
}).validate({
name: 'Validate object'
}).then(result => {
console.log(result)
})
// {name: 'Validate Object is Ok'}
### Custom Property
let model = await new ObjectModel({
name: types.string,
lastName: types.string,
fullName: {
optional: true,
type: types.string,
parse: (data) => {
return `${data.name} ${data.lastName}`
}
}
}).validate({name: 'Models', lastName: 'Object'})
console.log(model)
// { name: 'Models', lastName: 'Object', fullName: 'Models Object' }
types.integer
types.boolean
types.object
types.string
types.date
types.moment
## Declaration key options
type
The type of value that the key must containin
Array of available valuesparse
Function with data parameter equal to this and need return correct type valueoptional
If is required or not default falseformat
Only available in types.momentMIT
FAQs
Validate data models from object.
We found that object-model-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.