Skip to content

Commit

Permalink
chore: update json en.json
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-logan committed May 28, 2024
1 parent 002a35e commit 5494fc7
Show file tree
Hide file tree
Showing 6 changed files with 266 additions and 147 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,57 @@ import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import { a11yDark } from "react-syntax-highlighter/dist/esm/styles/prism";

import DrawerComponent from "@/components/Drawer";
import translation from "@/components/Internationalization";

export default function CnpjIsValid() {
const t = (text: string) =>
translation({ text, subject: "DocumentationJsFunctions" });

return (
<div id="page-content-wrapper">
<div className="relative mr-10 flex justify-end p-4">
<DrawerComponent />
</div>
<div className="container-fluid container">
<h1 className="title">cnpjIsValid Function Documentation</h1>
<h1 className="title">cnpjIsValid {t("Function Documentation")}</h1>
<p>
The <code>cnpjIsValid</code> function is used to validate a Brazilian
CNPJ (National Registry of Legal Entities) number. It returns an
object containing the <code>isValid</code> (boolean) and{" "}
<code>errorMsg</code> (string) properties, indicating whether the CNPJ
is valid and, in case of an error, the corresponding error message.
{t("The")} <code>cnpjIsValid</code>{" "}
{t(
"function is used to validate a Brazilian CNPJ (National Registry of Legal Entities) number. It returns an object containing the",
)}{" "}
<code>isValid</code> (boolean) {t("and")} <code>errorMsg</code>{" "}
(string){" "}
{t(
"properties, indicating whether the CNPJ is valid and, in case of an error, the corresponding error message.",
)}
</p>

<h2 className="subtitle">Import</h2>
<h2 className="subtitle">{t("Import")}</h2>
<p>
The function can be imported using ES6 syntax from the
&quot;multiform-validator&quot; package:
{t(
'The function can be imported using ES6 syntax from the "multiform-validator" package:',
)}
</p>

<SyntaxHighlighter language="javascript" style={a11yDark}>
{`import { cnpjIsValid } from 'multiform-validator';`}
</SyntaxHighlighter>

<h2 className="subtitle">Parameters</h2>
<p>The function takes two parameters:</p>
<h2 className="subtitle">{t("Parameters")}</h2>
<p>{t("The function takes two parameters:")}</p>
<ul>
<li>
<code>cnpj</code> (string) - The CNPJ number to validate.
<code>cnpj</code> (string) - {t("The CNPJ number to validate.")}
</li>
<li>
<code>errorMsg</code> (optional array) - A list of custom error
messages. If not provided, it uses a default list of error messages.
<code>errorMsg</code> ({t("optional array")}) -{" "}
{t(
"A list of custom error messages. If not provided, it uses a default list of error messages.",
)}
</li>
</ul>

<h2 className="subtitle">Examples</h2>
<h2 className="subtitle">{t("Examples")}</h2>

<SyntaxHighlighter language="javascript" style={a11yDark}>
{`// Example 1 - Using the CNPJ number '72.501.263/0001-40' const
Expand All @@ -57,14 +68,16 @@ console.log(result2.isValid); // false
console.log(result2.errorMsg); // 'CNPJ is wrong'`}
</SyntaxHighlighter>

<h2 className="subtitle">Notes</h2>
<h2 className="subtitle">{t("Notes")}</h2>
<p>
If the function is called with an invalid value for the{" "}
<code>errorMsg</code> parameter (non-array), or if an error occurs
during the validation process, the function will return an object with{" "}
<code>isValid</code> set to <code>false</code> and{" "}
<code>errorMsg</code> containing the default error message
&apos;Unknown error&apos;.
{t("If the function is called with an invalid value for the")}{" "}
<code>errorMsg</code>{" "}
{t(
"parameter (non-array), or if an error occurs during the validation process, the function will return an object with",
)}{" "}
<code>isValid</code> {t("set to")} <code>false</code> {t("and")}{" "}
<code>errorMsg</code>{" "}
{t("containing the default error message 'Unknown error'.")}
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,57 +4,67 @@ import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import { a11yDark } from "react-syntax-highlighter/dist/esm/styles/prism";

import DrawerComponent from "@/components/Drawer";
import translation from "@/components/Internationalization";

export default function CpfIsValid() {
const t = (text: string) =>
translation({ text, subject: "DocumentationJsFunctions" });

return (
<div id="page-content-wrapper">
<div className="relative mr-10 flex justify-end p-4">
<DrawerComponent />
</div>
<div className="container-fluid container">
<h1 className="title">cpfIsValid Function Documentation</h1>
<h1 className="title">cpfIsValid {t("Function Documentation")}</h1>
<p>
The <code>cpfIsValid</code> function is used to validate a Brazilian
CPF (Individual Taxpayer Identification) number. It returns an object
containing the <code>isValid</code> (boolean) and{" "}
<code>errorMsg</code> (string) properties, indicating whether the CPF
is valid and, in case of an error, the corresponding error message.
{t("The")} <code>cpfIsValid</code>{" "}
{t(
"function is used to validate a Brazilian CPF (Individual Taxpayer Identification) number. It returns an object containing the",
)}{" "}
<code>isValid</code> (boolean) {t("and")} <code>errorMsg</code>{" "}
(string){" "}
{t(
"properties, indicating whether the CPF is valid and, in case of an error, the corresponding error message.",
)}
</p>

<h2 className="subtitle">Import</h2>
<p>There are two ways to import the function:</p>
<h2 className="subtitle">{t("Import")}</h2>
<p>{t("There are two ways to import the function:")}</p>
<ul>
<li>
<strong>
Using <code>require</code> (Node.js):
{t("Using")} <code>{t("require")}</code> (Node.js):
</strong>
</li>
<SyntaxHighlighter language="javascript" style={a11yDark}>
{`const { cpfIsValid } = require('multiform-validator');`}
</SyntaxHighlighter>
<li>
<strong>
Using <code>import</code> (ES6):
{t("Using")} <code>{t("Import")}</code> (ES6):
</strong>
</li>
<SyntaxHighlighter language="javascript" style={a11yDark}>
{`import { cpfIsValid } from 'multiform-validator';`}
</SyntaxHighlighter>
</ul>

<h2 className="subtitle">Parameters</h2>
<p>The function takes two parameters:</p>
<h2 className="subtitle">{t("Parameters")}</h2>
<p>{t("The function takes two parameters:")}</p>
<ul>
<li>
<code>cpf</code> (string) - The CPF number to validate.
<code>cpf</code> (string) - {t("The CPF number to be validated.")}
</li>
<li>
<code>errorMsg</code> (optional array) - A list of custom error
messages. If not provided, it uses a default list of error messages.
<code>errorMsg</code> ({t("optional array")}) -{" "}
{t(
"A list of custom error messages. If not provided, it uses a default list of error messages.",
)}
</li>
</ul>

<h2 className="subtitle">Examples</h2>
<h2 className="subtitle">{t("Examples")}</h2>

<SyntaxHighlighter language="javascript" style={a11yDark}>
{`// Example 1 - Using the CPF number '123.456.789.10'
Expand All @@ -76,14 +86,16 @@ console.log(result3.isValid); // true
console.log(result3.errorMsg); // null`}
</SyntaxHighlighter>

<h2 className="subtitle">Notes</h2>
<h2 className="subtitle">{t("Notes")}</h2>
<p>
If the function is called with an invalid value for the{" "}
<code>errorMsg</code> parameter (non-array), or if an error occurs
during the validation process, the function will return an object with{" "}
<code>isValid</code> set to <code>false</code> and{" "}
<code>errorMsg</code> containing the default error message
&apos;Unknown error&apos;.
{t("If the function is called with an invalid value for the")}{" "}
<code>errorMsg</code>{" "}
{t(
"parameter (non-array), or if an error occurs during the validation process, the function will return an object with",
)}{" "}
<code>isValid</code> {t("set to")} <code>false</code> {t("and")}{" "}
<code>errorMsg</code>{" "}
{t("containing the default error message 'Unknown error'.")}
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,75 +4,98 @@ import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import { a11yDark } from "react-syntax-highlighter/dist/esm/styles/prism";

import DrawerComponent from "@/components/Drawer";
import translation from "@/components/Internationalization";

export default function GetOnlyEmail() {
const t = (text: string) =>
translation({ text, subject: "DocumentationJsFunctions" });

return (
<div id="page-content-wrapper">
<div className="relative mr-10 flex justify-end p-4">
<DrawerComponent />
</div>
<div className="container-fluid container">
<h1 className="title">getOnlyEmail Function Documentation</h1>
<h1 className="title">getOnlyEmail {t("Function Documentation")}</h1>
<p>
The <code>getOnlyEmail</code> function extracts email addresses from a
given text. If the optional <code>multiple</code> parameter is set to{" "}
<code>true</code>, it returns an array with all the email addresses
found. Otherwise, it returns only the first email address found as a
string.
{t("The")} <code>getOnlyEmail</code>{" "}
{t(
"function extracts email addresses from a given text. If the optional",
)}{" "}
<code>multiple</code> {t("parameter is set to")} <code>true</code>,{" "}
{t(
"it returns an array with all the email addresses found. Otherwise, it returns only the first email address found as a string.",
)}
</p>

<h2 className="subtitle">Import</h2>
<h2 className="subtitle">{t("Import")}</h2>
<p>
The function can be imported using ES6 syntax from the
&quot;multiform-validator&quot; package:
{t(
'The function can be imported using ES6 syntax from the "multiform-validator" package:',
)}
</p>

<SyntaxHighlighter language="javascript" style={a11yDark}>
{`import { getOnlyEmail } from 'multiform-validator';`}
</SyntaxHighlighter>

<p>
Alternatively, you can import the function using CommonJS syntax with{" "}
<code>require</code> (Node.js):
{t(
"Alternatively, you can import the function using CommonJS syntax with",
)}{" "}
<code>{t("require")}</code> (Node.js):
</p>

<SyntaxHighlighter language="javascript" style={a11yDark}>
{`const { getOnlyEmail } = require('multiform-validator');`}
</SyntaxHighlighter>

<h2 className="subtitle">Parameters</h2>
<p>The function takes two parameters:</p>
<h2 className="subtitle">{t("Parameters")}</h2>
<p>{t("The function takes two parameters:")}</p>
<ul>
<li>
<code>text</code> (string) - The input text from which emails will
be extracted.
<code>text</code> (string) -{" "}
{t("The input text from which emails will be extracted.")}
</li>
<li>
<code>multiple</code> (optional boolean) - If set to{" "}
<code>true</code>, the function will return an array with all the
email addresses found. If set to <code>false</code> or not provided,
it will return only the first email address found as a string.
<code>multiple</code> {t("(optional boolean) - If set to")}{" "}
<code>true</code>,{" "}
{t(
"the function will return an array with all the email addresses found. If set to",
)}{" "}
<code>false</code>{" "}
{t(
"or not provided, it will return only the first email address found as a string.",
)}
</li>
<li>
<code>cleanDomain</code> (optional boolean | string[]) - Either a
boolean value indicating whether to clean after default domains or
an array of custom domains to clean after. Default is{" "}
<code>false</code> which means it won&apos;t clean the email
addresses after default domains [&apos;.br&apos;, &apos;.io&apos;,
&apos;.pt&apos;, &apos;.us&apos;, &apos;.org&apos;,
&apos;.com&apos;, ];. If set to <code>true</code>, it will clean
after default domains. If set to an array of strings, it will clean
after the specified custom domains.
<code>cleanDomain</code>{" "}
{t(
"(optional boolean | string[]) - Either a boolean value indicating whether to clean after default domains or an array of custom domains to clean after. Default is",
)}{" "}
<code>false</code>{" "}
{t(
"which means it won't clean the email addresses after default domains ['.br', '.io', '.pt', '.us', '.org', '.com'];. If set to",
)}{" "}
<code>true</code>,{" "}
{t(
"it will clean after default domains. If set to an array of strings, it will clean after the specified custom domains.",
)}
</li>
<li>
<code>repeatEmail</code> (optional boolean) - If set to{" "}
<code>false</code>, the function will remove duplicate emails from
the output list. If set to <code>true</code> or not provided, it
will keep the duplicate emails in the output list.
<code>repeatEmail</code> {t("(optional boolean) - If set to")}{" "}
<code>false</code>,{" "}
{t(
"the function will remove duplicate emails from the output list. If set to",
)}{" "}
<code>true</code>{" "}
{t(
"or not provided, it will keep the duplicate emails in the output list.",
)}
</li>
</ul>

<h2 className="subtitle">Examples</h2>
<h2 className="subtitle">{t("Examples")}</h2>

<SyntaxHighlighter language="javascript" style={a11yDark}>
{`// Example 1 - Extracting multiple emails from the text
Expand Down Expand Up @@ -105,10 +128,11 @@ console.log(result4);
// Output: [ 'fiawn@rdwah.com', 'asdasd@gmail.com', 'fiawn@rdwah.com' ]`}
</SyntaxHighlighter>

<h2 className="subtitle">Notes</h2>
<h2 className="subtitle">{t("Notes")}</h2>
<p>
If no email address is found in the input text, the function will
return the string &quot;No email found&quot;.
{t(
"If no email address is found in the input text, the function will return the string 'No email found'.",
)}
</p>
</div>
</div>
Expand Down
Loading

0 comments on commit 5494fc7

Please sign in to comment.