-
-
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.
- Loading branch information
Showing
9 changed files
with
57 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
* | ||
* @copyright 2022 Jason Mulligan <[email protected]> | ||
* @license BSD-3-Clause | ||
* @version 9.0.8 | ||
* @version 9.0.9 | ||
*/ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
|
@@ -58,7 +58,24 @@ | |
* @param {Object} descriptor [Optional] Flags | ||
* @return {String} Readable file size String | ||
*/ | ||
function filesize (arg, {bits = false, pad = false, base = -1, round = 2, locale = EMPTY, localeOptions = {}, separator = EMPTY, spacer = SPACE, symbols = {}, standard = EMPTY, output = STRING, fullform = false, fullforms = [], exponent = -1, roundingMethod = ROUND, precision = 0} = {}) { | ||
function filesize (arg, { | ||
bits = false, | ||
pad = false, | ||
base = -1, | ||
round = 2, | ||
locale = EMPTY, | ||
localeOptions = {}, | ||
separator = EMPTY, | ||
spacer = SPACE, | ||
symbols = {}, | ||
standard = EMPTY, | ||
output = STRING, | ||
fullform = false, | ||
fullforms = [], | ||
exponent = -1, | ||
roundingMethod = ROUND, | ||
precision = 0 | ||
} = {}) { | ||
let e = exponent, | ||
num = Number(arg), | ||
result = [], | ||
|
@@ -180,7 +197,12 @@ | |
} | ||
|
||
// Returning Array, Object, or String (default) | ||
return output === ARRAY ? result : output === OBJECT ? {value: result[0], symbol: result[1], exponent: e, unit: u} : result.join(spacer); | ||
return output === ARRAY ? result : output === OBJECT ? { | ||
value: result[0], | ||
symbol: result[1], | ||
exponent: e, | ||
unit: u | ||
} : result.join(spacer); | ||
} | ||
|
||
// Partial application for functional programming | ||
|
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 2022 Jason Mulligan <[email protected]> | ||
* @license BSD-3-Clause | ||
* @version 9.0.8 | ||
* @version 9.0.9 | ||
*/ | ||
const ARRAY = "array"; | ||
const BIT = "bit"; | ||
|
@@ -52,7 +52,24 @@ const strings = { | |
* @param {Object} descriptor [Optional] Flags | ||
* @return {String} Readable file size String | ||
*/ | ||
function filesize (arg, {bits = false, pad = false, base = -1, round = 2, locale = EMPTY, localeOptions = {}, separator = EMPTY, spacer = SPACE, symbols = {}, standard = EMPTY, output = STRING, fullform = false, fullforms = [], exponent = -1, roundingMethod = ROUND, precision = 0} = {}) { | ||
function filesize (arg, { | ||
bits = false, | ||
pad = false, | ||
base = -1, | ||
round = 2, | ||
locale = EMPTY, | ||
localeOptions = {}, | ||
separator = EMPTY, | ||
spacer = SPACE, | ||
symbols = {}, | ||
standard = EMPTY, | ||
output = STRING, | ||
fullform = false, | ||
fullforms = [], | ||
exponent = -1, | ||
roundingMethod = ROUND, | ||
precision = 0 | ||
} = {}) { | ||
let e = exponent, | ||
num = Number(arg), | ||
result = [], | ||
|
@@ -174,7 +191,12 @@ function filesize (arg, {bits = false, pad = false, base = -1, round = 2, locale | |
} | ||
|
||
// Returning Array, Object, or String (default) | ||
return output === ARRAY ? result : output === OBJECT ? {value: result[0], symbol: result[1], exponent: e, unit: u} : result.join(spacer); | ||
return output === ARRAY ? result : output === OBJECT ? { | ||
value: result[0], | ||
symbol: result[1], | ||
exponent: e, | ||
unit: u | ||
} : result.join(spacer); | ||
} | ||
|
||
// Partial application for functional programming | ||
|
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 2022 Jason Mulligan <[email protected]> | ||
* @license BSD-3-Clause | ||
* @version 9.0.8 | ||
* @version 9.0.9 | ||
*/ | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : | ||
|
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.