NodeJS Crypto Converter
A minimal crypto crypto converter library for NodeJS that works out of the box.
Getting started
Installation
This package can be installed using npm
npm install crypto-converter-lt
or, yarn
yarn add crypto-converter-lt
Usage
Import crypto-converter-lt
.
const CC = require('crypto-converter-lt')
Then instantiate with either the empty constructor
let cryptoConverter = new CC()
Or, with a json object
let cryptoConverter = new CC({from:"BTC", to:"ETH", amount:100})
The convert method will return the conversion based on the last conversion rate and can be used as a promise.
cryptoConverter.convert().then((response) => {
console.log(response) //or do something else
})
convert
can also take the amount as a parameter.
cryptoConverter.convert(100).then((response) => {
console.log(response) //or do something else
})
To find the rates use the rates
method.
cryptoConverter.rates().then((response) => {
console.log(response) //or do something else
})
Chaining is also supported.
cryptoConverter.from("LTC").to("ETH").amount(125).convert().then((response) => {
console.log(response) //or do something else
})
Issues
If any issues are found, they can be reported here.
License
This project is licensed under the MIT license.