Socket
Socket
Sign inDemoInstall

core-unit

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    core-unit

Core unit converter


Version published
Maintainers
1
Created

Readme

Source

₡ORE Unit Converter

Install

npm i core-unit

Getting started

Example №1

const convert = require('core-unit')
const result = convert(1, 'core')
console.log(JSON.stringify(result, null, 2))

Output:

{
  "ore": "1000000000000000000",
  "wav": "1000000000000000",
  "grav": "1000000000000",
  "nucle": "1000000000",
  "atom": "1000000",
  "moli": "1000",
  "core": "1",
  "aer": "0.001",
  "orb": "0.000001",
  "plano": "0.000000001",
  "tera": "0.000000000001",
  "sola": "0.000000000000001",
  "galx": "0.000000000000000001",
  "cluster": "0.000000000000000000001",
  "supermatter": "0.000000000000000000000001"
}

Example №2

const convert = require('core-unit')
const result = convert(30, 'nucle')
console.log(JSON.stringify(result, null, 2))

Output:

{
  "ore": "30000000000",
  "wav": "30000000",
  "grav": "30000",
  "nucle": "30",
  "atom": "0.03",
  "moli": "0.00003",
  "core": "0.00000003",
  "aer": "0.00000000003",
  "orb": "0.00000000000003",
  "plano": "0.00000000000000003",
  "tera": "0.00000000000000000003",
  "sola": "0.00000000000000000000003",
  "galx": "0.00000000000000000000000003",
  "cluster": "0.00000000000000000000000000003",
  "supermatter": "0.00000000000000000000000000000003"
}

Specific output examples:

console.log(convert(1, 'core', 'ore')) // 1000000000000000000
console.log(convert(30, 'nucle', 'core')) // 0.00000003
console.log(convert(30, 'nucle', 'ore')) // 30000000000

CLI

Install

npm i -g core-unit

Getting started

$ core-unit {value} {unit}

Examples

$ core-unit 10 core

wei     10000000000000000000
kwei    10000000000000000
mwei    10000000000000
gwei    10000000000
szabo   10000000
finney  10000
ether   10
kether  0.01
mether  0.00001
gether  0.00000001
tether  0.00000000001
$ core-unit 30 nucle

wei     30000000000
kwei    30000000
mwei    30000
gwei    30
szabo   0.03
finney  0.00003
ether   0.00000003
kether  0.00000000003
mether  0.00000000000003
gether  0.00000000000000003
tether  0.00000000000000000003
$ core-unit 1 core ore

1000000000000000000
$ core-unit 30 nucle core

0.00000003

Piping value example:

$ echo 1000000000000000000 | core-unit ore core

1

Using decimal numbers example:

$ core-unit 1000000 -6 core

1
$ core-unit 1000000 -6 1

1
$ core-unit 1 1 -6

1000000

Contributions

Feel free to contribute in any way.

We appreciate:

  • Fork this repository
  • Open pull request
  • Send us some Øres / ₡ores: cb7147879011ea207df5b35a24ca6f0859dcfb145999
  • Star this repository

Epigram

「Cryptoni Confidimus」

License

Licensed under the CORE License.

Keywords

FAQs

Last updated on 24 Oct 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc