Comparing version
/** | ||
* filesize | ||
* | ||
* @copyright 2018 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
* @copyright 2019 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
* @license BSD-3-Clause | ||
* @version 3.6.1 | ||
* @version 4.0.0 | ||
*/ | ||
@@ -48,3 +48,3 @@ (function (global) { | ||
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " "; | ||
symbols = descriptor.symbols || descriptor.suffixes || {}; | ||
symbols = descriptor.symbols || {}; | ||
standard = base === 2 ? descriptor.standard || "jedec" : "jedec"; | ||
@@ -125,3 +125,3 @@ output = descriptor.output || "string"; | ||
if (output === "object") { | ||
return {value: result[0], suffix: result[1], symbol: result[1]}; | ||
return {value: result[0], symbol: result[1]}; | ||
} | ||
@@ -146,6 +146,4 @@ | ||
module.exports = filesize; | ||
} else if (typeof define === "function" && define.amd) { | ||
define(() => { | ||
return filesize; | ||
}); | ||
} else if (typeof define === "function" && define.amd !== void 0) { | ||
define(() => filesize); | ||
} else { | ||
@@ -152,0 +150,0 @@ global.filesize = filesize; |
@@ -6,5 +6,5 @@ "use strict"; | ||
* | ||
* @copyright 2018 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
* @copyright 2019 Jason Mulligan <jason.mulligan@avoidwork.com> | ||
* @license BSD-3-Clause | ||
* @version 3.6.1 | ||
* @version 4.0.0 | ||
*/ | ||
@@ -67,3 +67,3 @@ (function (global) { | ||
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " "; | ||
symbols = descriptor.symbols || descriptor.suffixes || {}; | ||
symbols = descriptor.symbols || {}; | ||
standard = base === 2 ? descriptor.standard || "jedec" : "jedec"; | ||
@@ -144,3 +144,3 @@ output = descriptor.output || "string"; | ||
if (output === "object") { | ||
return { value: result[0], suffix: result[1], symbol: result[1] }; | ||
return { value: result[0], symbol: result[1] }; | ||
} | ||
@@ -169,3 +169,3 @@ | ||
module.exports = filesize; | ||
} else if (typeof define === "function" && define.amd) { | ||
} else if (typeof define === "function" && define.amd !== void 0) { | ||
define(function () { | ||
@@ -172,0 +172,0 @@ return filesize; |
{ | ||
"name": "filesize", | ||
"description": "JavaScript library to generate a human readable String describing the file size", | ||
"version": "3.6.1", | ||
"version": "4.0.0", | ||
"homepage": "https://filesizejs.com", | ||
@@ -23,13 +23,13 @@ "author": "Jason Mulligan <jason.mulligan@avoidwork.com>", | ||
"devDependencies": { | ||
"babel-core": "^6.26.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-minify": "^0.3.0", | ||
"grunt": "^1.0.1", | ||
"babel-core": "^6.26.3", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-minify": "^0.5.0", | ||
"grunt": "^1.0.3", | ||
"grunt-babel": "^7.0.0", | ||
"grunt-cli": "^1.2.0", | ||
"grunt-cli": "^1.3.2", | ||
"grunt-contrib-concat": "^1.0.1", | ||
"grunt-contrib-nodeunit": "^1.0.0", | ||
"grunt-contrib-uglify": "^3.3.0", | ||
"grunt-contrib-watch": "^1.0.0", | ||
"grunt-eslint": "^20.1.0" | ||
"grunt-contrib-nodeunit": "^2.0.0", | ||
"grunt-contrib-uglify": "^4.0.0", | ||
"grunt-contrib-watch": "^1.1.0", | ||
"grunt-eslint": "^21.0.0" | ||
}, | ||
@@ -36,0 +36,0 @@ "keywords": [ |
@@ -36,3 +36,3 @@ # filesize.js | ||
### spacer | ||
_*(string)*_ Character between the `result` and `suffix`, default is `" "` | ||
_*(string)*_ Character between the `result` and `symbol`, default is `" "` | ||
@@ -43,7 +43,4 @@ ### standard | ||
### symbols | ||
_*(object)*_ Dictionary of SI/JEDEC symbols to replace for localization, defaults to english if no match is found | ||
_*(object)*_ Dictionary of SI/JEDEC/IEC symbols to replace for localization, defaults to english if no match is found | ||
### suffixes (deprecated: use 'symbols') | ||
_*(object)*_ Dictionary of SI/JEDEC symbols to replace for localization, defaults to english if no match is found | ||
### unix | ||
@@ -61,3 +58,3 @@ _*(boolean)*_ Enables unix style human readable output, e.g `ls -lh`, default is `false` | ||
filesize(265318, {output: "array"}); // [259.1, "KB"] | ||
filesize(265318, {output: "object"}); // {value: 259.1, suffix: "KB", symbol: "KB"} | ||
filesize(265318, {output: "object"}); // {value: 259.1, symbol: "KB"} | ||
filesize(1, {symbols: {B: "Б"}}); // "1 Б" | ||
@@ -90,3 +87,3 @@ filesize(1024); // "1 KB" | ||
## License | ||
Copyright (c) 2018 Jason Mulligan | ||
Copyright (c) 2019 Jason Mulligan | ||
Licensed under the BSD-3 license. |
Sorry, the diff of this file is not supported yet
14614
-1.39%274
-0.72%86
-3.37%