Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
class-validator-flat-formatter
Advanced tools
Convert array of ValidationError objects from class-validator to multiline string
Convert array of ValidationError objects from class-validator to multiline string
npm install class-validator-flat-formatter
import { validationError } from 'class-validator-flat-formatter';
const errors = await validate(user);
const message = validationError(errors, options);
// message => name: should not be empty (isNotEmpty), email: must be an email (isEmail)
export interface ValidationErrorOptions {
/**
* Custom template, tokens:
* {propertyPath} - Full dotted property path (e.g user.email)
* {property} - Last piece of {propertyPath} (e.g. email)
* {constraintRule} - Constraint rule id (e.g. isEmail)
* {constraintMessage} - Constraint message (e.g. must be an email)
*/
template?: string;
/**
* Delimiter of joined several validation messages.
* Default: Comma and space (CS)
*/
delimiter?: Delimiter | string;
/**
* Period at the end of string.
* Default: false
*/
period?: boolean;
}
import { validationErrorsAsArray } from 'class-validator-flat-formatter';
const errors = await validate(user);
const messages = validationErrorsAsArray(errors);
/**
messages => Array<string> {
'name: should not be empty (isNotEmpty)',
'email: must be an email (isEmail)'
}
*/
MIT License (c) 2024
FAQs
Convert array of ValidationError objects from class-validator to multiline string
The npm package class-validator-flat-formatter receives a total of 53 weekly downloads. As such, class-validator-flat-formatter popularity was classified as not popular.
We found that class-validator-flat-formatter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.