
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
A pure, extendable, very useful validator base Promise and Decorator
$validate
function, Vulidate will exec validator function in ordered.npm install vulidate --save
npm install @babel/plugin-proposal-decorators --save-dev
config babel.config.js
plugins: [
[
'@babel/plugin-proposal-decorators',
{
legacy: true
}
]
]
import vulidate from 'vulidate'
const requiredRule = {
validator: val => val != null && val !== '',
message: 'required'
}
const required = vulidate(requiredRule)
const checkPhone = vulidate(value => fetch(`xxx/${value}`))
const user = {
@required('nickname is required')
nickname: '',
@checkPhone('phone valid fail')
@required
phone: ''
}
user
.$validate()
.then(/* success */)
.catch(reason => {
/* fail */
alert(reason[0].message)
})
arguments structure, describe with typescript interface.
interface vulidate {
(rule: Validator | Rule): AppendDecorator
}
interface ProxyObject {
readonly __rules: Map<string, Rule[]>
readonly $validate(): Promise<ResolvedSource[]>
}
interface Decorator {
(target: ProxyObject, property: string): void
}
interface AppendDecorator {
(args: string | Rule | any): Decorator
}
interface Validator {
(value: any, source: Source): boolean | Promise<any>
}
interface Rule {
validator: Validator
message?: string
}
interface Source extends Rule {
value: any
}
interface ResolvedSource extends Source {
reason?: any
}
FAQs
A pure, extendable, very useful validator base Promise and Decorator
The npm package vulidate receives a total of 65 weekly downloads. As such, vulidate popularity was classified as not popular.
We found that vulidate 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.