-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplifying the assignment of
base
& standard
, adding an si
ali…
…as to correct implementations, fixing tests for the standards, adding tests for `si` standard, updating types, updating README.md Version bump
- Loading branch information
Showing
15 changed files
with
196 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* | ||
* @copyright 2023 Jason Mulligan <[email protected]> | ||
* @license BSD-3-Clause | ||
* @version 10.0.13 | ||
* @version 10.1.0 | ||
*/ | ||
'use strict'; | ||
|
||
|
@@ -23,6 +23,7 @@ const OBJECT = "object"; | |
const PERIOD = "."; | ||
const ROUND = "round"; | ||
const S = "s"; | ||
const SI = "si"; | ||
const SI_KBIT = "kbit"; | ||
const SI_KBYTE = "kB"; | ||
const SPACE = " "; | ||
|
@@ -70,15 +71,16 @@ function filesize (arg, { | |
u = EMPTY; | ||
|
||
// Sync base & standard | ||
if (base === -1 && standard.length === 0) { | ||
if (standard === SI) { | ||
base = 10; | ||
standard = JEDEC; | ||
} else if (base === -1 && standard.length > 0) { | ||
standard = standard === IEC ? IEC : JEDEC; | ||
base = standard === IEC ? 2 : 10; | ||
} else if (standard === IEC || standard === JEDEC) { | ||
base = 2; | ||
} else if (base === 2) { | ||
standard = IEC; | ||
} else { | ||
base = base === 2 ? 2 : 10; | ||
standard = base === 10 ? JEDEC : standard === JEDEC ? JEDEC : IEC; | ||
base = 10; | ||
standard = JEDEC; | ||
} | ||
|
||
const ceil = base === 10 ? 1000 : 1024, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* | ||
* @copyright 2023 Jason Mulligan <[email protected]> | ||
* @license BSD-3-Clause | ||
* @version 10.0.13 | ||
* @version 10.1.0 | ||
*/ | ||
const ARRAY = "array"; | ||
const BIT = "bit"; | ||
|
@@ -21,6 +21,7 @@ const OBJECT = "object"; | |
const PERIOD = "."; | ||
const ROUND = "round"; | ||
const S = "s"; | ||
const SI = "si"; | ||
const SI_KBIT = "kbit"; | ||
const SI_KBYTE = "kB"; | ||
const SPACE = " "; | ||
|
@@ -66,15 +67,16 @@ const STRINGS = { | |
u = EMPTY; | ||
|
||
// Sync base & standard | ||
if (base === -1 && standard.length === 0) { | ||
if (standard === SI) { | ||
base = 10; | ||
standard = JEDEC; | ||
} else if (base === -1 && standard.length > 0) { | ||
standard = standard === IEC ? IEC : JEDEC; | ||
base = standard === IEC ? 2 : 10; | ||
} else if (standard === IEC || standard === JEDEC) { | ||
base = 2; | ||
} else if (base === 2) { | ||
standard = IEC; | ||
} else { | ||
base = base === 2 ? 2 : 10; | ||
standard = base === 10 ? JEDEC : standard === JEDEC ? JEDEC : IEC; | ||
base = 10; | ||
standard = JEDEC; | ||
} | ||
|
||
const ceil = base === 10 ? 1000 : 1024, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* | ||
* @copyright 2023 Jason Mulligan <[email protected]> | ||
* @license BSD-3-Clause | ||
* @version 10.0.13 | ||
* @version 10.1.0 | ||
*/ | ||
(function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports):typeof define==='function'&&define.amd?define(['exports'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.filesize={}));})(this,(function(exports){'use strict';const ARRAY = "array"; | ||
const BIT = "bit"; | ||
|
@@ -21,6 +21,7 @@ const OBJECT = "object"; | |
const PERIOD = "."; | ||
const ROUND = "round"; | ||
const S = "s"; | ||
const SI = "si"; | ||
const SI_KBIT = "kbit"; | ||
const SI_KBYTE = "kB"; | ||
const SPACE = " "; | ||
|
@@ -66,15 +67,16 @@ const STRINGS = { | |
u = EMPTY; | ||
|
||
// Sync base & standard | ||
if (base === -1 && standard.length === 0) { | ||
if (standard === SI) { | ||
base = 10; | ||
standard = JEDEC; | ||
} else if (base === -1 && standard.length > 0) { | ||
standard = standard === IEC ? IEC : JEDEC; | ||
base = standard === IEC ? 2 : 10; | ||
} else if (standard === IEC || standard === JEDEC) { | ||
base = 2; | ||
} else if (base === 2) { | ||
standard = IEC; | ||
} else { | ||
base = base === 2 ? 2 : 10; | ||
standard = base === 10 ? JEDEC : standard === JEDEC ? JEDEC : IEC; | ||
base = 10; | ||
standard = JEDEC; | ||
} | ||
|
||
const ceil = base === 10 ? 1000 : 1024, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.