Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Async validation library for node and browser.
Install using npm or yarn:
npm install handcuffs
# or
yarn add handcuffs
Basic usage example:
import { validate } from 'handcuffs'
const data = {
name: 'Jack',
wife: {
name: 'Susan'
}
}
const rules = {
name: 'required|string',
'wife.age': 'required|number',
pets: 'required|array',
'pets.*.type': 'required|string'
}
async function start() {
const validationResult = await validate(data, rules)
if (!validationResult.valid) {
console.log(validationResult.errors)
}
}
start()
accepted
{ rules: 'accepted' }
The field under validation must be 'yes'
, 'on'
, 1
, or true
.
alpha
{ name: 'alpha' }
The field under validation must be entirely alphabetic characters.
alphaNum
{ password: 'alphaNum' }
The field under validation must be entirely alpha-numeric characters.
alphaNumDash
{ url: 'alphaNumDash' }
The field under validation may have alpha-numeric characters, as well as dashes and underscores.
array
{ permissions: 'array' }
The field under validation must be an array.
between
{ guests: 'between:1,3' }
The field under validation must have a size between the given min and max values.
boolean
{ isVisible: 'boolean' }
The field under validation must be a boolean. Accepted input values are true
and false
.
max
{ password: 'max:10' }
The field under validation must be less than or equal to the given max value.
min
{ password: 'min:6' }
The field under validation must be greater than or equal to the given min value.
numeric
{ age: 'numeric' }
The field under validation must be numeric.
required
{ name: 'required' }
The field under validation must be present in the input data and not empty.
string
{ name: 'string' }
The field under validation must be a string.
MIT
FAQs
Async validation library for node and browser
The npm package handcuffs receives a total of 3 weekly downloads. As such, handcuffs popularity was classified as not popular.
We found that handcuffs 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.