View (snippet) FunctionComponent
This file contains 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
{ | |
"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`,", |
View password-regex-rules.ts
This file contains 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 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 |
View validate-cpf.ts
This file contains 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
export function validateCpf(cpf: string) { | |
cpf = cpf.replace(/[^\d]+/g,'') | |
if ( | |
cpf.length !== 11 || | |
cpf === '' || | |
cpf === "00000000000" || | |
cpf === "11111111111" || | |
cpf === "22222222222" || | |
cpf === "33333333333" || |