
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
joi-decorators
Advanced tools
Decorator based goodies for sophisticated validation support in your ES7 classes
Use ES7 decorators to augment your javascript classes with declarative validation support.
import { ObjectSchema } from 'joi-validators'
@ObjectSchema({
username: Joi.string().alphanum().min(3).max(30).required(),
email: Joi.string().email()
})
class User {
constructor(username, email) {
this.username = username
this.email = email
}
}
let user = new User('lorefnon', 'lorefnon@example.com')
user.validate() // returns { error: null, ... }
user.isValid() // returns true
user.ensureValid() // does not throw exceptio
user = new User(10, 20)
user.validate() // returns { error: { name: 'ValidationError', ... }, ... }
user.isValid() // returns false
user.ensureValid() // throws ValidationError
import { ArgumentSchema } from 'joi-validators'
class User {
@ArgumentSchema([
Joi.string().required(),
Joi.string().required()
])
getFullName(firstName, lastName) {
return `${firstName} ${lastName}`
}
}
let user = new User
user.getFullName('lorem', 'ipsum') // returns 'lorem ipsum'
user.getFullName(10, 20) // throws ValidationError
npm i -D joi-decorators
MIT © Lorefnon
FAQs
Decorator based goodies for sophisticated validation support in your ES7 classes
We found that joi-decorators 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
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.