0.0.10 • Published 2 years ago
@bizchain.vn/utils v0.0.10
Utils
Utils functions used by BizChain Labs
Helper functions
export function isEmpty(value: unknown): boolean
//Simple way extract plaintext from HTML. Best use for not very long HTML string
export function removeHTMLTags(str: string): string
//Convert readable password to un-readable password to keep in the database, if someone get this, he/she cannot use
export async function passwordHash(password: string): Promise<string>
///Determine whether the provided `date` is less than number of provided `days`
export function isRecentlyUpdate(date: string, days: number): boolean
Regex
REGEX_ENGLISH_NAME
REGEX_ANYNAME
REGEX_EMAIL
whether email is valid in format or notREGEX_EXTERNAL_URL
whether slug is an external url
//Send email via MailJet services
export async function sendMailJet(emailData: TEmailData, config: TMailJetConfig): Promise<unknown>
React Hook
/**
* Whether current position of scrollY has been greater than a supplied position
* @param pos
* @returns
*/
export function useScrollOver(pos: number): boolean
/**
* Whether user is going down
* @param _minY the minimum distant before starting checking. Default is 0 for to check immediately
*/
export function useScrollDown(_minY?: number): {
isGoingDown: boolean;
isOnTop: boolean;
}