A collection of Node.js classes for easy conversion between TF2 currencies.
Using npm:
$ npm install @mann-conomy/tf-exchange
Using yarn:
$ yarn add @mann-conomy/tf-exchange
Using npm:
$ npm test
Using yarn:
$ yarn test
Easily convert between TF2 currencies with a single exchange rate for all arithmetic operations.
try {
const calculator = new Calculator({ exchange: 66.88 });
const first = new Currency({ keys: 5, refined: 23.88 });
const second = new Currency({ keys: 2, refined: 47.33 });
const currency = calculator.subtract(first, second);
console.log(currency.toString()); // 2 keys, 43.44 refined
} catch (error) {
console.error("Error adding the two currencies", error.message);
}
Some more examples are available in the examples and test directories.
See the Wiki pages for further documentation.
Copyright 2024, The Mann-Conomy Project