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 handleError(error: unknown): string { | |
let message: string; | |
if (error instanceof Error) { | |
console.log("if"); | |
message = error.message; | |
} else if (error && typeof error === "object" && "message" in error) { | |
console.log("if"); | |
message = String(error.message); | |
} else if (error && typeof error === "object" && "msg" in error) { | |
console.log("if"); |
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
import { PhoneNumberUtil } from "google-libphonenumber"; | |
export function manualParsePhoneNumber( | |
input: string, | |
country: string = "BR" | |
): any { | |
const phoneUtil = PhoneNumberUtil.getInstance(); | |
try { | |
const parsedNumber = phoneUtil.parse(input, country); | |
const countryCode = String(parsedNumber.getCountryCode()); |
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
https://github.com/ults-io/vscode-react-javascript-snippets/blob/HEAD/docs/Snippets.md | |
rafc import React from 'react' | |
export const $1 = () => { | |
return <div>$0</div> | |
} | |
imrse→ import React, { useState, useEffect } from 'react' |
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
// Verificar ambiente | |
{process.env.NODE_ENV === "development"} | |
// Limpar CPF CNPJ PHONE (deixa apenas números) | |
.replace(/\D/g, "") | |
// axios params | |
axios.get('https://www.example.com/search', { | |
params: { | |
q: 'axios', |