0.2.2 • Published 2 years ago

@xpla.kitchen/utils v0.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@xpla.kitchen/utils

installation

npm i --save @xpla.kitchen/utils

Usage

Format

import { readAmount, readDenom, readPercent, toAmount } from "@xpla.kitchen/utils"

readAmount("1234567890") // "1234.56789"
readAmount("1234567890", { decimals: 0 }) // "1234567890"
readAmount("1234567890", { fixed: 6 }) // "1234.567890"
readAmount("1234567890", { comma: true }) // "1,234.56789"
readAmount("1234567890", { integer: true }) // "1234"
readAmount("1234567890", { prefix: true }) // "1.23K"

toAmount("1234.56789") // "1234567890"
toAmount("1234", { decimals: 0 }) // "1234"

readDenom("axpla") // "XPLA"

readPercent("1.23") // "123.00%"
readPercent("1.23", { fixed: 3 }) // "123.000%"

Is

import { isDenomXpla, isDenomIBC, isDenom } from "@xpla.kitchen/utils"

isDenomXpla('axpla') // true
isDenomIBC('ibc/...') // true
isDenom("axpla") // true
isDenom("ibc/...") // true

Text

import { truncate } from "@xpla.kitchen/utils"

truncate("xpla1sxl7purz2upza8agspzc9262ukdt2ph8uq3q34") // "xpla1...uq3q34"
truncate("xpla1sxl7purz2upza8agspzc9262ukdt2ph8uq3q34", [5, 3]) // "xpla1...q34"
0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago