-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
52d0d4d
commit 7fc96eb
Showing
32 changed files
with
468 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
const ascii = /^[\x00-\x7F]+$/; | ||
|
||
/** | ||
* Checks if the given string consists only of ASCII characters. | ||
* | ||
* @param str - The string to be checked. | ||
* @returns `true` if the string contains only ASCII characters, otherwise `false`. | ||
*/ | ||
export function isAscii(str: string): boolean { | ||
return ascii.test(str); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
const isBICReg = /^[A-z]{4}[A-z]{2}\w{2}(\w{3})?$/; | ||
|
||
/** | ||
* Checks if the given string is a valid BIC (Bank Identifier Code). | ||
* | ||
* @param str - The string to be checked. | ||
* @returns `true` if the string is a valid BIC, otherwise `false`. | ||
*/ | ||
export function isBIC(str: string): boolean { | ||
return isBICReg.test(str); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
const base32 = /^[A-Z2-7]+=*$/; | ||
|
||
/** | ||
* Checks if a given string is a valid Base32 encoded string. | ||
* | ||
* A valid Base32 string must: | ||
* - Have a length greater than 0. | ||
* - Have a length that is a multiple of 8. | ||
* - Match the Base32 regular expression pattern. | ||
* | ||
* @param str - The string to be checked. | ||
* @returns `true` if the string is a valid Base32 encoded string, otherwise `false`. | ||
*/ | ||
export function isBase32(str: string): boolean { | ||
return str.length > 0 && str.length % 8 === 0 && base32.test(str); | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,15 @@ | ||
/** | ||
* Checks if the given string represents a boolean value. | ||
* | ||
* This function returns `true` if the input string is one of the following: | ||
* - "true" | ||
* - "false" | ||
* - "1" | ||
* - "0" | ||
* | ||
* @param str - The string to check. | ||
* @returns `true` if the string is a boolean representation, otherwise `false`. | ||
*/ | ||
export function isBoolean(str: string): boolean { | ||
return (['true', 'false', '1', '0'].indexOf(str) >= 0); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
// supports Bech32 addresses | ||
const btc = /^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$/; | ||
|
||
/** | ||
* Checks if the given string is a valid Bitcoin address. | ||
* | ||
* @param str - The string to be checked. | ||
* @returns `true` if the string is a valid Bitcoin address, otherwise `false`. | ||
*/ | ||
export function isBtcAddress(str: string): boolean { | ||
return btc.test(str); | ||
} |
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
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
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
Oops, something went wrong.