Code Monkey home page Code Monkey logo

core-units's Introduction

₡ORE Unit Converter

Install

npm i core-units

Getting started

Example №1

const convert = require('core-units')
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-units')
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-units

Getting started

$ core-units {value} {unit}

Examples

$ core-units 10 core

ore      10000000000000000000
wav      10000000000000000
grav     10000000000000
nucle    10000000000
atom     10000000
moli     10000
core     10
aer      0.01
orb      0.00001
plano    0.00000001
tera     0.00000000001
sola     0.00000000000001
galx     0.00000000000000001
cluster  0.00000000000000000001
supermatter 0.00000000000000000000001
$ core-units 42 nucle

ore      42000000000
wav      42000000
grav     42000
nucle    42
atom     0.042
moli     0.000042
core     0.000000042
aer      0.000000000042
orb      0.000000000000042
plano    0.000000000000000042
tera     0.000000000000000000042
sola     0.000000000000000000000042
galx     0.000000000000000000000000042
cluster  0.000000000000000000000000000042
supermatter 0.000000000000000000000000000000042
$ core-units 1 core ore

1000000000000000000
$ core-units 30 nucle core

0.00000003

Piping value example:

$ echo 1000000000000000000 | core-units ore core

1

Using decimal numbers example:

$ core-units 1000000 -6 core

1
$ core-units 1000000 -6 1

1
$ core-units 1 1 -6

1000000

Contributions

Feel free to contribute in any way.

We appreciate:

Epigram

「Cryptoni Confidimus」

License

Licensed under the CORE License.

core-units's People

Contributors

miguelmota avatar rastislavcore avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.