New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lisk-prettify

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lisk-prettify

Formats raw Lisk amounts to be more human-readable. Adds decimal point and commas where necessary.

  • 1.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

lisk-prettify

Format raw Lisk amounts to be more human-readable. Adds decimal point and commas where necessary.

e.g. 100251338358 becomes 1,002.51338358

Install

npm install --save lisk-prettify

Include in scripts

// require
var liskPrettify = require('lisk-prettify').liskPrettify

// require (ES6 version)
const { liskPrettify } = require('lisk-prettify')

// import
import liskPrettify from 'liskPrettify'

Usage Example

liskPrettify(100251338358)
// "1,002.51338358"

API

liskPrettify(rawLskValue, config <optional>)

Parameters

rawLskValue (number) - The raw LSK amount, usually returned when performing API calls to the Lisk network.

config (object) <optional> - Configuration for the returned result. The configurations are:

  • commas (boolean) - Choose whether or not to display commas where necessary e.g. 1,000,000.00000000. Default: true
  • decimals (boolean) - Choose whether or not to display decimal places. Default: true
Examples

Prettify a LSK amount

liskPrettify(100251338358)
// Result: "1,002.51338358"
// returns a string

Prettify a LSK amount without commas

liskPrettify(100251338358, { commas: false })
// Result: 1002.51338358
// returns a number

Prettify a LSK amount without decimal places

liskPrettify(100251338358, { decimals: false })
// Result: "1,002"

Tests

/* run this command inside lisk-prettify's
   node_modules folder */

npm run test

Feedback

Pull requests and opened issues are welcome!

License

MIT

Keywords

FAQs

Package last updated on 02 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc