
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
@lemoncode/fonk-array-required-validator
Advanced tools
This is a [fonk](https://github.com/Lemoncode/fonk) microlibrary that brings validation capabilities to validate if an array field of a form has items
This is a fonk microlibrary that brings validation capabilities to:
How to install it:
npm install @lemoncode/fonk-array-required-validator --save
How to add it to an existing form validation schema:
We have the following form model:
const myFormValues = {
product : 'shoes',
price: 20,
sizes: [36, 38, 41]
}
We can add a arrayRequired validation to the myFormValues
import { arrayRequired } from '@lemoncode/fonk-array-required-validator';
const validationSchema = {
field: {
sizes: [arrayRequired.validator],
},
};
We must specify the minimum number (1 by default) and optionally the maximum number of items allowed:
import { arrayRequired } from '@lemoncode/fonk-array-required-validator';
const validationSchema = {
field: {
sizes: [
{
validator: arrayRequired.validator,
customArgs: { minLength: 1, maxLength: 10 },
},
],
},
};
You can customize the error message displayed in two ways:
import { arrayRequired } from '@lemoncode/fonk-array-required-validator';
arrayRequired.setErrorMessage('El campo debe de ser una lista');
import { arrayRequired } from '@lemoncode/fonk-array-required-validator';
const validationSchema = {
field: {
price: [
{
validator: arrayRequired.validator,
message: 'Error message only updated for the validation schema',
},
],
},
};
Please, refer to fonk to know more.
We are an innovating team of Javascript experts, passionate about turning your ideas into robust products.
Basefactor, consultancy by Lemoncode provides consultancy and coaching services.
Lemoncode provides training services.
For the LATAM/Spanish audience we are running an Online Front End Master degree, more info: http://lemoncode.net/master-frontend
FAQs
This is a [fonk](https://github.com/Lemoncode/fonk) microlibrary that brings validation capabilities to validate if an array field of a form has items
We found that @lemoncode/fonk-array-required-validator 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.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.