A Typescript modules for frequently used types, utilities, constants, and more across Normal repositories.
yarn add @normalfinance/utils
or
npm install @normalfinance/utils
Using a database table type:
import { NewInvestment } from '@normalfinance/utils';
const myNewInvestment: NewInvestment = {
idempotencyKey: 'xyz',
userId: '123',
exchangeId: 1;
indexId: 2;
amount: '125',
currency: "usd",
feeStatus: "pending"
}
Calculating an investment fee:
import { calculateIndexFee } from '@normalfinance/utils';
const totalInvestmentsSoFar = 1000;
const newInvestment = 500;
const indexFee = calculateIndexFee(totalInvestmentsSoFar, newInvesment);
- Install the current LTS version of Node.js
- If you are using nvm (recommended) running
nvm install
will install the latest version and runningnvm use
will automatically choose the right node version for you.
- If you are using nvm (recommended) running
- Install Yarn v3
- Run
yarn install
to install dependencies and run any required post-install scripts
Run yarn test
to run the tests once. To run tests on file changes, run yarn test:watch
.
Run yarn lint
to run the linter, or run yarn lint:fix
to run the linter and fix any automatically fixable issues.
Coming soon.