Skip to content

Commit ff58fc8

Browse files
committed
Updated build
1 parent 1a2ad5a commit ff58fc8

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

dist/vue2-filters.js

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ __webpack_require__.d(string_namespaceObject, "truncate", function() { return st
110110
var other_namespaceObject = {};
111111
__webpack_require__.r(other_namespaceObject);
112112
__webpack_require__.d(other_namespaceObject, "currency", function() { return other_currency; });
113-
__webpack_require__.d(other_namespaceObject, "fileSize", function() { return other_fileSize; });
113+
__webpack_require__.d(other_namespaceObject, "bytes", function() { return other_bytes; });
114114
__webpack_require__.d(other_namespaceObject, "pluralize", function() { return other_pluralize; });
115115
__webpack_require__.d(other_namespaceObject, "ordinal", function() { return other_ordinal; });
116116
__webpack_require__.d(other_namespaceObject, "number", function() { return other_number; });
@@ -572,40 +572,44 @@ function toFixed(num, precision) {
572572
}
573573

574574
/* harmony default export */ var other_currency = (currency);
575-
// CONCATENATED MODULE: ./src/other/fileSize.js
575+
// CONCATENATED MODULE: ./src/other/bytes.js
576+
576577
/**
577578
* 8 => '8 byte'
578579
* 1024 => '1.00 kb'
579580
* 2000000 => '1.90 MB'
580581
* 2000000000 => '1.86 GB'
581582
* 2000000000000 => '1.82 TB'
582583
*
583-
* @param {Number} valueInBytes The file size in bytes
584+
* @param {Number} value
584585
* @param {Number} decimals Decimal places (default: 2)
585586
*/
586-
function fileSize(valueInBytes) {
587-
var decimals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
588-
valueInBytes = valueInBytes === null || isNaN(valueInBytes) ? 0 : valueInBytes;
589587

590-
if (valueInBytes >= Math.pow(1024, 4)) {
588+
function bytes(value, decimals) {
589+
var globalOptions = this && this.bytes ? this.bytes : {};
590+
decimals = src_util.exist(decimals) ? decimals : globalOptions.decimalDigits;
591+
decimals = typeof decimals !== 'undefined' ? decimals : 2;
592+
value = value === null || isNaN(value) ? 0 : value;
593+
594+
if (value >= Math.pow(1024, 4)) {
591595
// TB
592-
return "".concat((valueInBytes / Math.pow(1024, 4)).toFixed(decimals), " TB");
593-
} else if (valueInBytes >= Math.pow(1024, 3)) {
596+
return "".concat((value / Math.pow(1024, 4)).toFixed(decimals), " TB");
597+
} else if (value >= Math.pow(1024, 3)) {
594598
// GB
595-
return "".concat((valueInBytes / Math.pow(1024, 3)).toFixed(decimals), " GB");
596-
} else if (valueInBytes >= Math.pow(1024, 2)) {
599+
return "".concat((value / Math.pow(1024, 3)).toFixed(decimals), " GB");
600+
} else if (value >= Math.pow(1024, 2)) {
597601
// MB
598-
return "".concat((valueInBytes / Math.pow(1024, 2)).toFixed(decimals), " MB");
599-
} else if (valueInBytes >= 1024) {
602+
return "".concat((value / Math.pow(1024, 2)).toFixed(decimals), " MB");
603+
} else if (value >= 1024) {
600604
// kb
601-
return "".concat((valueInBytes / 1024).toFixed(decimals), " kb");
605+
return "".concat((value / 1024).toFixed(decimals), " kb");
602606
} // byte
603607

604608

605-
return "".concat(valueInBytes, " byte");
609+
return "".concat(value, " byte");
606610
}
607611

608-
/* harmony default export */ var other_fileSize = (fileSize);
612+
/* harmony default export */ var other_bytes = (bytes);
609613
// CONCATENATED MODULE: ./src/other/pluralize.js
610614

611615
/**

0 commit comments

Comments
 (0)