Skip to content

Instantly share code, notes, and snippets.

View wellserrano's full-sized avatar

Wellington Serrano wellserrano

View GitHub Profile
{
"Typescript React Function Component": {
"prefix": "fc",
"body": [
"import * as React from 'react'",
"import { cva, VariantProps } from 'class-variance-authority'",
"//import { cn } from '../../lib/utils/cn'",
"",
"const ${TM_FILENAME_BASE/([^.]+)/${1:/downcase}/g}Variants = cva(",
"`$1`,",
function handlePassword() {
const passwordRegexRules = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z])(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$/
const isPasswordValid = passwordRegexRules.test(password)
if (!isPasswordValid) Alert.alert('Invalid password. Password must contain at least one uppercase letter, one digit, one special character and be 8 charachters long')
}
<TextInput
textContentType="password"
secureTextEntry
export function validateCpf(cpf: string) {
cpf = cpf.replace(/[^\d]+/g,'')
if (
cpf.length !== 11 ||
cpf === '' ||
cpf === "00000000000" ||
cpf === "11111111111" ||
cpf === "22222222222" ||
cpf === "33333333333" ||