Git Product home page Git Product logo

curp_mx's Introduction

CurpMx

Librer铆a para validar CURPs. Nada complicado, es esencialmente un regex que regresa una lista de errores de haber algunos.

    curp = CurpMx::Validator.new("JOJO200927HNLJJO09")
    curp.valid?
    #=> true | false
    
    curp.errors
    #=> {
        :curp => ["Invalid format"],
        :birth_day => ["Invalid day"]
    }
    

驴Espa帽ol?

El README estaba en ingl茅s hasta que ca铆 en la cuenta que la librer铆a va dirigida a un p煤blico mexicano... No hay necesidad de explicarlo en otro idioma. Opino.

Instrucciones

Validaci贸n r谩pida

CurpMx::Validator.valid?("curp")
#=> true | false

Validaci贸n a detalle

validator = CurpMx::Validator.new("curp")
# El m茅todo #validate es llamado al inicializarlo

validator.valid?
#=> false

validator.errors
#=> [
      format: ["Invalid format"],
      ...
    ]

Validaciones

Valor Error
format El formato no coincide con el de un CURP
state El ESTADO no coincide con las abreviaciones del RENAPO
problematic_name Las iniciales forman una palabra prohibida. (Ej. 'CACA')
birth_day D铆a de nacimiento <= 0 o > 31
birth_month Mes de nacimiento <= 0 o > 12
birth_date Fecha de nacimiento inexistente (Ej. 31/02/1989)

curp_mx's People

Contributors

hslzr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    馃枛 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 馃搳馃搱馃帀

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google 鉂わ笍 Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.