1.0.3 • Published 10 months ago

@mann-conomy/tf-exchange v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

tf-exchange

A collection of Node.js classes for fast and easy conversion between TF2 currencies.

npm version npm downloads Node.js version GitHub actions GitHub license

Installation

Using npm:

$ npm install @mann-conomy/tf-exchange

Using yarn:

$ yarn add @mann-conomy/tf-exchange

Testing

Using npm:

$ npm test

Using yarn:

$ yarn test

Examples

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

MIT

Copyright 2025, The Mann-Conomy Project

1.0.3

10 months ago

1.0.1

12 months ago

1.0.0

1 year ago