Socket
Book a DemoInstallSign in
Socket

@lemoncode/fonk-is-lowercase-validator

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lemoncode/fonk-is-lowercase-validator

This is a [fonk](https://github.com/Lemoncode/fonk) microlibrary that brings validation capabilities to validate if a field of a form is a lowercase string

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

fonk-is-lowercase-validator

CircleCI NPM Version bundle-size

This is a fonk microlibrary that brings validation capabilities to:

  • Validate if a field of a form is a lowercase string

How to add it to an existing form validation schema:

We have the following form model:

const myFormValues = {
  product: 'shoes',
  price: 20,
}

We can add a isLowercase validation to the myFormValues

import { isLowercase } from '@lemoncode/fonk-is-lowercase-validator';

const validationSchema = {
  field: {
    product: [isLowercase.validator],
  },
};

You can customize the error message displayed in two ways:

  • Globally, replace the default error message in all validationSchemas (e.g. porting to spanish):
import { isLowercase } from '@lemoncode/fonk-is-lowercase-validator';

isLowercase.setErrorMessage('El campo debe de ser una cadena en minúsculas');
  • Locally just override the error message for this validationSchema:
import { isLowercase } from '@lemoncode/fonk-is-lowercase-validator';

const validationSchema = {
  field: {
    price: [
      {
        validator: isLowercase.validator,
        message: 'Error message only updated for the validation schema',
      },
    ],
  },
};

Please, refer to fonk to know more.

License

MIT

About Basefactor + Lemoncode

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

Keywords

isLowercase

FAQs

Package last updated on 17 Oct 2019

Did you know?

Socket

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.

Install

Related posts