1.0.3 • Published 10 months ago
@mann-conomy/tf-exchange v1.0.3
tf-exchange
A collection of Node.js classes for fast and easy conversion between TF2 currencies.
Installation
Using npm:
$ npm install @mann-conomy/tf-exchangeUsing yarn:
$ yarn add @mann-conomy/tf-exchangeTesting
Using npm:
$ npm testUsing yarn:
$ yarn testExamples
Easily convert between TF2 currencies with a single exchange rate for all arithmetic operations.
import { Calculator, Currency } from "@mann-conomy/tf-exchange";
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 subtracting the two currencies", error.message);
}Some more examples are available in the examples and test directories.
Documentation
See the Wiki pages for further documentation.
License
Copyright 2025, The Mann-Conomy Project