@getclave/utils
TypeScript icon, indicating that this package has built-in type declarations

1.1.21 • Public • Published

Clave Utils

💡 In progress.

clave-utils is a utility package that provides a collection of commonly used functions designed to enhance development efficiency across multiple applications. These functions encapsulate repetitive tasks and common patterns, making them easily accessible and reusable. By centralizing these utilities, clave-utils promotes consistent coding practices and accelerates development across projects.

Installation

Currently, since we are in monorepo, you can add clave-utils to your dependencies to use the existing functions from clave-utils.

{
	"dependencies": {
    ...
    "@getclave/utils": "*",
	 }
}

Available Functions

import {
    // validates whether a given string is a valid email address.
    HexString,
    abiCoder, // ethers.utils.AbiCoder()
    bufferToHex, // checks if given addresses valid or not
    dateToString, // format date to month.day.year string // converts buffer to hex
    derPublicToCoordinates, // converts DER public key to coordinates
    derPublicToRaw, // converts DER public key to raw representation
    derSignatureToRs, // converts DER signature to R and S
    filterNulls, // filters out null or undefined values from an array
    formatHex, // adds 0x to hex
    getFatSignature, // converting a custom signature and public key into a concatenated format.
    hexToBuffer,
    isAddressValid, // converts hex to buffer
    isEmpty, // checks if a string or array is empty.
    nullThrows, // throws an error if the value is `null` or `undefined`
    parseHex, // converts string to HexString
    shortenPublicAddress, // shortens an address with ellipsis.
    stringToHex, // converts string to hex // `0x${string}`
    toHexString, // removes 0x from hex
    validateEmail,
} from '@getclave/utils';

Readme

Keywords

Package Sidebar

Install

npm i @getclave/utils

Weekly Downloads

122

Version

1.1.21

License

MIT

Unpacked Size

77.2 kB

Total Files

105

Last publish

Collaborators

  • zetsuboii
  • asgarovf