This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM ruby:2.5.5 | |
| RUN apt-get update && \ | |
| apt-get install -yqq apt-transport-https ca-certificates build-essential libpq-dev --fix-missing --no-install-recommends | |
| RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \ | |
| echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \ | |
| curl -sL https://deb.nodesource.com/setup_11.x | bash - | |
| RUN apt-get update && \ | |
| apt-get install -yqq nodejs yarn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function validaCPF(cpf: string): boolean { | |
| cpf = cpf.replace(/\D/g, ''); | |
| if (cpf.length !== 11 || /^(\d)\1+$/.test(cpf)) return false; | |
| const calcularDigito = (base: number) => { | |
| let soma = 0; | |
| for (let i = 0; i < base - 1; i++) { | |
| soma += parseInt(cpf.charAt(i)) * (base - i); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function validaCNPJ(cnpj: string): boolean { | |
| cnpj = cnpj.replace(/\D/g, ''); | |
| if (cnpj.length !== 14 || /^(\d)\1+$/.test(cnpj)) return false; | |
| const calcularDigito = (base: number) => { | |
| const pesos = base === 12 ? [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2] : [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]; | |
| let soma = 0; | |
| for (let i = 0; i < base; i++) { | |
| soma += parseInt(cnpj.charAt(i)) * pesos[i]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function validaTelefoneBR(telefone: string): boolean { | |
| // Remove caracteres não numéricos, exceto o sinal de mais (+) no início para código de país | |
| const numeroLimpo = telefone.replace(/[^\d+]/g, ''); | |
| // Regex para validar números de telefone fixos e móveis no Brasil | |
| // Aceita números com e sem o código do país (+55) e o prefixo nacional (0) | |
| const regex = /^(?:(?:\+55\s?)?(?:[1-9][1-9])|(?:0[1-9][1-9]))\s?(?:9\s?\d{4}|\d{4})[-\s]?\d{4}$/; | |
| return regex.test(numeroLimpo); | |
| } |
OlderNewer