Skip to content

Commit

Permalink
Building
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Jun 17, 2022
1 parent 1d41805 commit 295907c
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 13 deletions.
28 changes: 25 additions & 3 deletions lib/filesize.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() :
Expand Down Expand Up @@ -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 = [],
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/filesize.es6.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/filesize.es6.min.js.map

Large diffs are not rendered by default.

28 changes: 25 additions & 3 deletions lib/filesize.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 = [],
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/filesize.esm.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/filesize.esm.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/filesize.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() :
Expand Down
2 changes: 1 addition & 1 deletion lib/filesize.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 295907c

Please sign in to comment.