0.2.1 • Published 6 months ago

qansigliere-splitbills v0.2.1

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

Split Bills | Split Payments

The library is based on the Javascript programming language and allows you to calculate different number of split bills and tips based on the initial amount. You just need to specify amount, number of payments, should we calculate tips and percentage of tips

Author

https://www.youtube.com/@QANSIGLIERE/

Support the project

https://buymeacoffee.com/qansigliere

Installing

Using npm:

npm i qansigliere-splitbills

Functions

splitBills(initialAmount, numberOfPayments, withTips, tipsRatePercent) - This function calculates the amount of each individual payment based on the specified initial amount and the number of expected payments. Plus it can calculate a tip for each payment if needed.

Example

CommonJS

var { splitBills } = require('qansigliere-splitbills');

console.log(JSON.stringify(splitBills(1.31, 4, true, 15)));

console.log(JSON.stringify(splitBills(0.01, 2, true, 15, false))); // Error message turned off

Output

[{"amount":0.33,"tips":0.05},{"amount":0.33,"tips":0.05},{"amount":0.33,"tips":0.05},{"amount":0.32,"tips":0.05}]

[{"amount":0.01,"tips":0}]

ES Module

import { splitBills } from 'qansigliere-splitbills';

console.log(JSON.stringify(splitBills(1.31, 4, true, 15)));

console.log(JSON.stringify(splitBills(0.01, 2, true, 15, false))); // Error message turned off

Output

[{"amount":0.33,"tips":0.05},{"amount":0.33,"tips":0.05},{"amount":0.33,"tips":0.05},{"amount":0.32,"tips":0.05}]

[{"amount":0.01,"tips":0}]

Improvements & Suggestions

https://forms.gle/GZbS9hw42tSYJxKL7

0.2.1

6 months ago

0.2.0

11 months ago

0.1.0

11 months ago