Skip to content

Commit

Permalink
chore: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-logan committed Jul 13, 2024
1 parent d2250c0 commit 72b527d
Show file tree
Hide file tree
Showing 6 changed files with 319 additions and 196 deletions.
8 changes: 7 additions & 1 deletion .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

148 changes: 0 additions & 148 deletions docs/SUMMARY.md

This file was deleted.

12 changes: 10 additions & 2 deletions docs/classes/CnpjValidator.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,18 @@ import io.github.multiform_validator.CnpjValidator;

public class Main {
public static void main(String[] args) {
System.out.println(cnpjIsTrue()); // true
System.out.println(cnpjIsFalse()); // false
}

public static boolean cnpjIsTrue() {
String cnpjTrue = "69.807.668/0001-41";
return CnpjValidator.cnpjIsValid(cnpjTrue);
}

public static boolean cnpjIsFalse() {
String cnpjFalse = "61.807.661/0001-48";
System.out.println(CnpjValidator.cnpjIsValid(cnpjTrue)); // true
System.out.println(CnpjValidator.cnpjIsValid(cnpjFalse)); // false
return CnpjValidator.cnpjIsValid(cnpjFalse);
}
}
```
Expand Down
14 changes: 10 additions & 4 deletions docs/classes/CreditCardValidator.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ import io.github.multiform_validator.CreditCardValidator;

public class Main {
public static void main(String[] args) {
String creditCardTrue = "4532 8770 0040 4166";
String creditCardFalse = "4532 8770 0040 4167";
System.out.println(CreditCardValidator.isCreditCardValid(creditCardTrue)); // true
System.out.println(CreditCardValidator.isCreditCardValid(creditCardFalse)); // false
valid();
invalid();
}

private static void valid() {
System.out.println(CreditCardValidator.isCreditCardValid("4532 8770 0040 4166")); // true
}

private static void invalid() {
System.out.println(CreditCardValidator.isCreditCardValid("4532 8770 0040 4167")); // false
}
}
```
Expand Down
79 changes: 68 additions & 11 deletions docs/classes/FileValidator.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,85 @@ The `FileValidator` class is used to validate files. It has the following method

## How to use

### isValidAudio

```java
import io.github.multiform_validator.FileValidator;
import static io.github.multiform_validator.FileValidator.isValidAudio;

import java.io.File;

public class Main {
public static void main(String[] args) {
File file = new File("path/to/file");
System.out.println(FileValidator.isValidAudio(file)); // true | false
System.out.println(FileValidator.isValidImage(file)); // true | false
System.out.println(FileValidator.isValidPdf(file)); // true | false
System.out.println(FileValidator.isValidTxt(file)); // true | false

File file = new File("src/main/resources/audio.mp3");
System.out.println(isValidAudio(file)); // true | false

exampleExcludingExtensions();
}

public static void exampleExcludingExtensions() {
File file = new File("path/to/file");
File file = new File("src/main/resources/audio.mp3");
String[] audioExtensions = {"mp3"};
System.out.println(isValidAudio(file, audioExtensions)); // false
}
}
```

### isValidImage

```java
import static io.github.multiform_validator.FileValidator.isValidImage;

import java.io.File;

public class Main {
public static void main(String[] args) {
File file = new File("src/main/resources/image.png");
System.out.println(isValidImage(file)); // true | false

exampleExcludingExtensions();
example2ExcludingExtensions();
}

public static void exampleExcludingExtensions() {
File file = new File("src/main/resources/image.png");
String[] imageExtensions = {"ico", "jpeg", "png"};
System.out.println(FileValidator.isValidAudio(file, audioExtensions)); // true | false
System.out.println(FileValidator.isValidImage(file, imageExtensions)); // false | true
System.out.println(isValidImage(file, imageExtensions)); // false
}

public static void example2ExcludingExtensions() {
File file = new File("src/main/resources/image.png");
String[] imageExtensions = {"ico", "jpeg"};
System.out.println(isValidImage(file, imageExtensions)); // true | false
}
}
```

### isValidPdf

```java
import static io.github.multiform_validator.FileValidator.isValidPdf;

import java.io.File;

public class Main {
public static void main(String[] args) {
File file = new File("src/main/resources/file.pdf");
System.out.println(isValidPdf(file)); // true | false
}
}
```

### isValidTxt

```java
import static io.github.multiform_validator.FileValidator.isValidTxt;

import java.io.File;

public class Main {
public static void main(String[] args) {
File file = new File("src/main/resources/file.txt");
System.out.println(isValidTxt(file)); // true | false
}
}
```
Expand Down
Loading

0 comments on commit 72b527d

Please sign in to comment.