Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/_filter/math/byte-fmt.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
*
* @description
* Convert bytes into appropriate display
* 1024 bytes => 1 KB
* 1000 bytes => 1 KB
*/
angular.module('a8m.math.byteFmt', [])
.filter('byteFmt', function () {
var compared = [{str: 'B', val: 1024}];
var compared = [{str: 'B', val: 1000}];
['KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'].forEach(function(el, i) {
compared.push({str: el, val: compared[i].val * 1024 });
compared.push({str: el, val: compared[i].val * 1000 });
});
return function (bytes, decimal) {
if(isNumber(decimal) && isFinite(decimal) && decimal%1===0 && decimal >= 0 &&
Expand Down
8 changes: 4 additions & 4 deletions src/_filter/math/kb-fmt.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
*
* @description
* Convert bytes into appropriate display
* 1024 kilobytes => 1 MB
* 1000 kilobytes => 1 MB
*/
angular.module('a8m.math.kbFmt', [])
.filter('kbFmt', function () {
var compared = [{str: 'KB', val: 1024}];
var compared = [{str: 'KB', val: 1000}];
['MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'].forEach(function(el, i) {
compared.push({str: el, val: compared[i].val * 1024 });
compared.push({str: el, val: compared[i].val * 1000 });
});
return function (bytes, decimal) {
if(isNumber(decimal) && isFinite(decimal) && decimal%1===0 && decimal >= 0 &&
Expand All @@ -23,4 +23,4 @@ angular.module('a8m.math.kbFmt', [])
}
return 'NaN';
}
});
});