Skip to content

Paquete de JavaScript para validar datos de la cédula, RUC, celular, teléfono, placas y más datos de Ecuador.

License

Notifications You must be signed in to change notification settings

insoutt/ecuador-validator-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

Ecuador Validator Javascript

Paquete de JavaScript para validar datos de la cédula, RUC, celular, teléfono, placas y más datos de Ecuador.

Getting Started

Installation

Install the package with npm:

npm install ecuador-validator

Getting Started

You can import the validator in your project with the following code:

const validator = require('ecuador-validator');

Or with ES6:

import validator from 'ecuador-validator';

Usage

Validator is available with the following methods:

validator.ci(ci: string): boolean;
validator.ruc(ruc: string): boolean;
validator.cellphone(cellphone: string, type?: 'simple' | 'code'): boolean;
validator.telephone(telephone: string, type?: 'simple' | 'code' | 'international'): boolean;
validator.placaCar(placa: string): boolean;
validator.placaMoto(placa: string): boolean;

And you can use it like this:

validator.cedula('1723456789'); // true
validator.ruc('1723456789001'); // true
validator.cellphone('0991234567'); // true, type is simple by default
validator.cellphone('0991234567', 'code'); // false
validator.cellphone('+593991234567', 'code'); // true
validator.cellphone('593991234567', 'code'); // true
validator.telephone('2123456'); // true, type is simple by default
validator.telephone('022123456', 'code'); // true
validator.telephone('+59322123456', 'international'); // true
validator.telephone('59322123456', 'international'); // true
validator.placaCar('ABC-123'); // false
validator.placaCar('ABC0123'); // true
validator.placaMoto('AA012E'); // true

Run Locally

  1. Clone the repo
    git clone git@github.com:insoutt/ecuador-validator-js.git
  2. Install NPM packages
    npm install
  3. Edit the index.js file

Running Tests

To run tests, run the following command

  npm run test

Contact

Elvis Fernando - @insoutt - Website

Project Link: https://github.com/insoutt/ecuador-validator-js

(back to top)

About

Paquete de JavaScript para validar datos de la cédula, RUC, celular, teléfono, placas y más datos de Ecuador.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published