https://github.com/mann-conomy/tf-exchange
A collection of Node.js classes for fast and easy conversion between TF2 currencies.
https://github.com/mann-conomy/tf-exchange
currency exchange javascript mann-conomy nodejs rate tf2 typescript
Last synced: 5 months ago
JSON representation
A collection of Node.js classes for fast and easy conversion between TF2 currencies.
- Host: GitHub
- URL: https://github.com/mann-conomy/tf-exchange
- Owner: Mann-Conomy
- License: mit
- Created: 2024-05-29T17:13:42.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-08T12:02:06.000Z (6 months ago)
- Last Synced: 2025-01-09T16:28:45.152Z (5 months ago)
- Topics: currency, exchange, javascript, mann-conomy, nodejs, rate, tf2, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@mann-conomy/tf-exchange
- Size: 137 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tf-exchange
A collection of Node.js classes for fast and easy conversion between TF2 currencies.
[](https://npmjs.com/package/@mann-conomy/tf-exchange)
[](https://npmjs.com/package/@mann-conomy/tf-exchange)
[](https://nodejs.org/en/about/releases/)
[](https://github.com/Mann-Conomy/tf-exchange/blob/main/.github/workflows/test.yml)
[](https://github.com/Mann-Conomy/tf-exchange/blob/main/LICENSE)## Installation
Using [npm](https://www.npmjs.com/package/@mann-conomy/tf-exchange):
```bash
$ npm install @mann-conomy/tf-exchange
```Using [yarn](https://yarnpkg.com/package/@mann-conomy/tf-exchange):
```bash
$ yarn add @mann-conomy/tf-exchange
```## Testing
Using [npm](https://docs.npmjs.com/cli/v8/commands/npm-run-script):
```bash
$ npm test
```Using [yarn](https://classic.yarnpkg.com/lang/en/docs/cli/run/):
```bash
$ yarn test
```## Examples
Easily convert between TF2 currencies with a single exchange rate for all arithmetic operations.
```js
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](https://github.com/Mann-Conomy/tf-exchange/tree/main/examples) and [test](https://github.com/Mann-Conomy/tf-exchange/tree/main/test) directories.
## Documentation
See the [Wiki pages](https://github.com/Mann-Conomy/tf-exchange/wiki) for further documentation.
## License
[MIT](LICENSE)
Copyright 2025, The Mann-Conomy Project