JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q92662F
  • License MIT

Package Exports

  • @conceptho/adonis-validators

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@conceptho/adonis-validators) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Adonis Validators

How to Use:

  1. Install the npm package:
    npm install @conceptho/adonis-validators --save

  2. Register it under providers in start/app.js.

const providers = [
  /* Some providers here.
     Also, make sure to define the default Validator before */
'@conceptho/adonis-validators'
];
  1. Enjoy!

Available Functions

  • cpf
    const rules = {
      cpf: 'required|string|cpf'
    }
  • uniqueWhere
    const rules = {
      process_number: 'required|string|uniqueWhere:lawsuits,process_number,workspace_id',
    }
  • exists
    const rules = {
      user_id: 'required|exists:users,id',
    }
  • isBetween
    const rules = {
      // supports float
      value: 'number|isBetween:0.0,5',
    }