Skip to content

Commit

Permalink
Fallback to default bytes when not provided
Browse files Browse the repository at this point in the history
Fix #558
  • Loading branch information
BenjaminVanRyseghem committed Jul 8, 2020
1 parent 4c27cab commit 6ae1cf0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ function formatByte(instance, providedFormat, state, numbro) {
const { binarySuffixes: localBinarySuffixes, decimalSuffixes: localDecimalSuffixes } = state.currentBytes();

const localBytes = {
general: { scale: 1024, suffixes: localDecimalSuffixes, marker: "bd" },
binary: { scale: 1024, suffixes: localBinarySuffixes, marker: "b" },
decimal: { scale: 1000, suffixes: localDecimalSuffixes, marker: "d" }
general: { scale: 1024, suffixes: localDecimalSuffixes || decimalSuffixes, marker: "bd" },
binary: { scale: 1024, suffixes: localBinarySuffixes || binarySuffixes, marker: "b" },
decimal: { scale: 1000, suffixes: localDecimalSuffixes || decimalSuffixes, marker: "d" }
};
let baseInfo = localBytes[base];

Expand Down
2 changes: 1 addition & 1 deletion src/globalState.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ state.currentLanguage = () => currentLanguageTag;
*
* @return {{}}
*/
state.currentBytes = () => currentLanguageData().bytes;
state.currentBytes = () => currentLanguageData().bytes || {};

/**
* Return the current language currency data
Expand Down

0 comments on commit 6ae1cf0

Please sign in to comment.