Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
db-schema-validator
Advanced tools
Object model validation
$ npm install --save db-schema-validator
import dbSchemaValidator from 'db-schema-validator';
const validate = dbSchemaValidator({
aString: 'string',
aNumber: 'number',
aNullableDate: 'date?',
anArray: ['any']
});
validate({
aString: 'test',
aNumber: 2.15,
aNullableDate: null,
anArray: ['string', 2, true]
});
//=> true
validate({
aString: 2,
aNumber: 2.15,
aNullableDate: null,
anArray: []
});
// => throw "Expected 'aString' to be a string"
Type: object
required
the schema used to validate the object, see schema definition for more details
Type: object
required
the object to validate
string
number
int
: non-floating number
date
bool
any
: anything but undefined
or null
Just append ?
at the end of the above
ei: number?
will validate undefined
, null
, or a number
Nested object are supported
ei:
{
l1: {
l2: {
aString: 'string'
},
aNumber: 2
}
}
Just wrap your types in []
ei: ['string']
will validate an array of string
Array of objects are also supported
ei:
[{
aString: 'string',
aNumber: 'number'
}]
The schema definition is highly inspired by ottoman
MIT © Thomas Sileghem
FAQs
Object model validation
The npm package db-schema-validator receives a total of 1 weekly downloads. As such, db-schema-validator popularity was classified as not popular.
We found that db-schema-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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.