Skip to content

Commit bb72429

Browse files
committedSep 12, 2021
Fixing assignment of standard such that it aligns with the README (default of "iec") & updating tests, fixing hardcoded copyright year in rollup.config.js, version bump to release
1 parent 9633cda commit bb72429

14 files changed

+34
-32
lines changed
 

Diff for: ‎lib/filesize.es6.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* @copyright 2021 Jason Mulligan <jason.mulligan@avoidwork.com>
55
* @license BSD-3-Clause
6-
* @version 8.0.0
6+
* @version 8.0.1
77
*/
88
(function (global, factory) {
99
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -58,7 +58,7 @@
5858
separator = descriptor.separator !== void 0 ? descriptor.separator : "";
5959
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " ";
6060
symbols = descriptor.symbols || {};
61-
standard = base === 2 ? descriptor.standard || "iec" : "jedec";
61+
standard = descriptor.standard in symbol ? descriptor.standard : "iec";
6262
output = descriptor.output || "string";
6363
full = descriptor.fullform === true;
6464
fullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];

Diff for: ‎lib/filesize.es6.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: ‎lib/filesize.es6.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: ‎lib/filesize.esm.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* @copyright 2021 Jason Mulligan <jason.mulligan@avoidwork.com>
55
* @license BSD-3-Clause
6-
* @version 8.0.0
6+
* @version 8.0.1
77
*/
88
const b = /^(b|B)$/,
99
symbol = {
@@ -52,7 +52,7 @@ function filesize (arg, descriptor = {}) {
5252
separator = descriptor.separator !== void 0 ? descriptor.separator : "";
5353
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " ";
5454
symbols = descriptor.symbols || {};
55-
standard = base === 2 ? descriptor.standard || "iec" : "jedec";
55+
standard = descriptor.standard in symbol ? descriptor.standard : "iec";
5656
output = descriptor.output || "string";
5757
full = descriptor.fullform === true;
5858
fullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];

Diff for: ‎lib/filesize.esm.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: ‎lib/filesize.esm.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: ‎lib/filesize.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* @copyright 2021 Jason Mulligan <jason.mulligan@avoidwork.com>
55
* @license BSD-3-Clause
6-
* @version 8.0.0
6+
* @version 8.0.1
77
*/
88
(function (global, factory) {
99
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -79,7 +79,7 @@
7979
separator = descriptor.separator !== void 0 ? descriptor.separator : "";
8080
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " ";
8181
symbols = descriptor.symbols || {};
82-
standard = base === 2 ? descriptor.standard || "iec" : "jedec";
82+
standard = descriptor.standard in symbol ? descriptor.standard : "iec";
8383
output = descriptor.output || "string";
8484
full = descriptor.fullform === true;
8585
fullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];

Diff for: ‎lib/filesize.min.js

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: ‎lib/filesize.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: ‎package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: ‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "filesize",
33
"description": "JavaScript library to generate a human readable String describing the file size",
4-
"version": "8.0.0",
4+
"version": "8.0.1",
55
"homepage": "https://filesizejs.com",
66
"author": "Jason Mulligan <jason.mulligan@avoidwork.com>",
77
"repository": {

Diff for: ‎rollup.config.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@ import babel from 'rollup-plugin-babel';
22
import { terser } from 'rollup-plugin-terser';
33
import pkg from './package.json';
44

5+
const year = new Date().getFullYear();
6+
57
const bannerLong = `/**
68
* ${pkg.name}
79
*
8-
* @copyright ${new Date().getFullYear()} ${pkg.author}
10+
* @copyright ${year} ${pkg.author}
911
* @license ${pkg.license}
1012
* @version ${pkg.version}
1113
*/`;
1214

1315
const bannerShort = `/*!
14-
2020 Jason Mulligan <jason.mulligan@avoidwork.com>
16+
${year} Jason Mulligan <jason.mulligan@avoidwork.com>
1517
@version ${pkg.version}
1618
*/`;
1719

Diff for: ‎src/filesize.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function filesize (arg, descriptor = {}) {
4545
separator = descriptor.separator !== void 0 ? descriptor.separator : "";
4646
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " ";
4747
symbols = descriptor.symbols || {};
48-
standard = base === 2 ? descriptor.standard || "iec" : "jedec";
48+
standard = descriptor.standard in symbol ? descriptor.standard : "iec";
4949
output = descriptor.output || "string";
5050
full = descriptor.fullform === true;
5151
fullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];

Diff for: ‎test/filesize_test.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ exports.filesize = {
139139
test.equal(filesize(0, {base: 10, fullform: true, output: "object"}).unit, "B", "Should be 'B'");
140140
test.equal(filesize(1, {base: 10, bits: true, fullform: true}), "8 bits", "Should be '8 bits'");
141141
test.equal(filesize(1, {base: 10, fullform: true}), "1 byte", "Should be '1 byte'");
142-
test.equal(filesize(this.kibibyte, {base: 10, fullform: true}), "1.02 kilobytes", "Should be '1.02 kilobytes'");
143-
test.equal(filesize(this.kibibyte, {base: 2, standard: "iec", fullform: true }), "1 kibibyte", "Should be '1 kibibyte'");
144-
test.equal(filesize(this.kibibyte, {base: 2, standard: "iec", fullform: true, output: "object"}).unit, "KiB", "Should be 'KiB'");
142+
test.equal(filesize(this.kibibyte, {base: 10, fullform: true}), "1.02 kibibytes", "Should be '1.02 kibibytes'");
143+
test.equal(filesize(this.kibibyte, {base: 2, standard: "jedec", fullform: true }), "1 kilobyte", "Should be '1 kilobyte'");
144+
test.equal(filesize(this.kibibyte, {base: 2, standard: "jedec", fullform: true, output: "object"}).unit, "KB", "Should be 'KB'");
145145
test.equal(filesize(this.kibibyte * 1.3, {
146146
base: 2,
147147
standard: "iec",
@@ -153,7 +153,7 @@ exports.filesize = {
153153
exponent: function (test) {
154154
test.expect(2);
155155
test.equal(filesize(0, {base: 10, exponent: 0}), "0 B", "Should be '0 B'");
156-
test.equal(filesize(0, {base: 10, exponent: 2}), "0 MB", "Should be '0 MB'");
156+
test.equal(filesize(0, {base: 10, exponent: 2}), "0 MiB", "Should be '0 MiB'");
157157
test.done();
158158
},
159159
separator: function (test) {
@@ -202,10 +202,10 @@ exports.filesize = {
202202
precision: function (test) {
203203
test.expect(5);
204204
test.equal(filesize(this.kibibyte * 1, {base: 10, precision: 3}), "1.02 kB", "Should be '1.02 kB'");
205-
test.equal(filesize(this.kibibyte * this.kibibyte * 10.25, {base: 10, precision: 3}), "10.8 MB", "Should be '10.8 MB'");
206-
test.equal(filesize(this.kibibyte * this.kibibyte * 10.25, {base: 10, precision: "x"}), "10.75 MB", "Should be '10.75 MB'");
207-
test.equal(filesize(this.kibibyte * this.kibibyte * this.kibibyte, {base: 10, precision: 3}), "1.07 GB", "Should be '1.07 GB'");
208-
test.equal(filesize(Math.pow(this.kibibyte, 10), {base: 10, precision: 3}), "1e+6 YB", "Should be '1e+6 YB'");
205+
test.equal(filesize(this.kibibyte * this.kibibyte * 10.25, {base: 10, precision: 3}), "10.8 MiB", "Should be '10.8 MiB'");
206+
test.equal(filesize(this.kibibyte * this.kibibyte * 10.25, {base: 10, precision: "x"}), "10.75 MiB", "Should be '10.75 MiB'");
207+
test.equal(filesize(this.kibibyte * this.kibibyte * this.kibibyte, {base: 10, precision: 3}), "1.07 GiB", "Should be '1.07 GiB'");
208+
test.equal(filesize(Math.pow(this.kibibyte, 10), {base: 10, precision: 3}), "1e+6 YiB", "Should be '1e+6 YiB'");
209209
test.done();
210210
},
211211
defaults: function (test) {

0 commit comments

Comments
 (0)
Please sign in to comment.