js-moi-utils
Version:
Collection of utility functions used in js-moi-sdk.
12 lines (11 loc) • 385 B
text/typescript
/**
* Checks if the given address is a valid address.
*
* @param {string} address - The address to validate.
* @returns {boolean} Returns true if the address is valid, otherwise false.
*/
export const isValidAddress = (address: string): boolean => {
if (typeof address !== 'string') return false;
if (!/^0x[0-9a-fA-F]{64}$/.test(address)) return false;
return true;
}