Skip to content

Commit

Permalink
Merge pull request #7 from bchainhub/update/rounding-01
Browse files Browse the repository at this point in the history
Limit to supported rounding
  • Loading branch information
rastislavcore authored Mar 12, 2024
2 parents a9020b3 + 8fcb064 commit e6bba2f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ const bitcoinFormatter = new ExchNumberFormat('en-US', {
style: 'currency',
currency: 'BTC',
customCurrency: 'BTC',
roundingMode: 'halfUp',
roundingMode: 'halfFloor',
currencyDisplay: 'symbol'
});

const formattedBTC = bitcoinFormatter.format(1234.567);
console.log(formattedBTC); // Output: '₿1,234.57'
console.log(formattedBTC); // Output: '₿1,234.567'

// Example: Formatting with custom options
const customFormatter = new ExchNumberFormat('en-US', {
Expand Down
2 changes: 1 addition & 1 deletion dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
interface RoundNumberOptions extends Intl.NumberFormatOptions {
customCurrency?: string;
roundingMode?: 'ceil' | 'expand' | 'floor' | 'trunc' | 'halfCeil' | 'halfExpand' | 'halfFloor' | 'halfTrunc' | 'halfEven' | 'halfOdd';
roundingMode?: 'ceil' | 'floor' | 'expand' | 'trunc' | 'halfCeil' | 'halfFloor' | 'halfExpand' | 'halfTrunc' | 'halfEven';
}
declare class ExchNumberFormat {
private formatter;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "exchange-rounding",
"version": "1.0.3",
"version": "1.0.4",
"description": "Exchange Number Formatting",
"main": "dist/index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
interface RoundNumberOptions extends Intl.NumberFormatOptions {
customCurrency?: string;
roundingMode?: 'ceil' | 'expand' | 'floor' | 'trunc' | 'halfCeil' | 'halfExpand' | 'halfFloor' | 'halfTrunc' | 'halfEven' | 'halfOdd';
roundingMode?: 'ceil' | 'floor' | 'expand' | 'trunc' | 'halfCeil' | 'halfFloor' | 'halfExpand' | 'halfTrunc' | 'halfEven';
}

class ExchNumberFormat {
Expand Down
2 changes: 1 addition & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface RoundNumberOptions extends Intl.NumberFormatOptions {
customCurrency?: string;
roundingMode?: 'ceil' | 'expand' | 'floor' | 'trunc' | 'halfCeil' | 'halfExpand' | 'halfFloor' | 'halfTrunc' | 'halfEven' | 'halfOdd';
roundingMode?: 'ceil' | 'floor' | 'expand' | 'trunc' | 'halfCeil' | 'halfFloor' | 'halfExpand' | 'halfTrunc' | 'halfEven';
}

export interface CurrencyData {
Expand Down

0 comments on commit e6bba2f

Please sign in to comment.