
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
js-laravel-validation
Advanced tools
Set custom messages:
import { validate } from 'js-laravel-validation'
validate.setCustomMessage('required', ({ key, value }) => `${key} field is required.`)
The parameter to your createMessage
function will the same field object you supplied in your formData
. Differences are it will have a key
prop with the field name, and the validation
prop will be an array of rules (with parameters if any)
E.g:
validateForm({
name: {
value: "c mcg",
validation: 'required|string',
label: 'Full Name', //Custom property
}
})
will call the custom message function with
{
key: 'name',
validation: ['required', 'string'],
value: "c mcg",
label: 'Full Name',
}
Currently no dist is provided
import { validateForm } from 'js-laravel-validation'
const formData = {
username: {
value: 'test1',
validation: 'required|string'
},
password: {
value null,
validation: required|string'
}
}
const result = validateForm({
formData,
includeMessages: true,
});
if (result.errors) {
Object.keys(result.errors).forEach(key => {
const errors = result.errors[key];
errors.forEach(error => {
console.log(`invalid field field=${key} rule=${error.rule} messages=${error.message}`
}
}
}
FAQs
Laravel style form validation for JavaScript
The npm package js-laravel-validation receives a total of 106 weekly downloads. As such, js-laravel-validation popularity was classified as not popular.
We found that js-laravel-validation 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
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
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.