@autonomys/auto-consensus 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,mBAAmB,UAAW,MAAM,8BAUhD,CAAA;AAGD,eAAO,MAAM,oBAAoB,UAAW,MAAM,8BAUjD,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatSpaceToDecimal = exports.formatSpaceToBinary = void 0;
|
|
4
|
+
// Binary format (powers of 2)
|
|
5
|
+
const formatSpaceToBinary = (value, decimals = 2) => {
|
|
6
|
+
if (value === 0)
|
|
7
|
+
return '0 Bytes';
|
|
8
|
+
const k = 1024;
|
|
9
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
10
|
+
const sizes = ['Bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
11
|
+
const i = Math.floor(Math.log(value) / Math.log(k));
|
|
12
|
+
return parseFloat((value / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
|
13
|
+
};
|
|
14
|
+
exports.formatSpaceToBinary = formatSpaceToBinary;
|
|
15
|
+
// Decimal format (powers of 10)
|
|
16
|
+
const formatSpaceToDecimal = (value, decimals = 2) => {
|
|
17
|
+
if (value === 0)
|
|
18
|
+
return '0 Bytes';
|
|
19
|
+
const k = 1000;
|
|
20
|
+
const dm = decimals < 0 ? 0 : decimals;
|
|
21
|
+
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
22
|
+
const i = Math.floor(Math.log(value) / Math.log(k));
|
|
23
|
+
return parseFloat((value / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
|
|
24
|
+
};
|
|
25
|
+
exports.formatSpaceToDecimal = formatSpaceToDecimal;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAEA,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA"}
|
package/dist/utils/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
__exportStar(require("./events"), exports);
|
|
19
|
+
__exportStar(require("./format"), exports);
|
|
19
20
|
__exportStar(require("./parse"), exports);
|
|
20
21
|
__exportStar(require("./query"), exports);
|
|
21
22
|
__exportStar(require("./sudo"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@autonomys/auto-consensus",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"url": "https://www.autonomys.net"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@autonomys/auto-utils": "^1.0.
|
|
25
|
+
"@autonomys/auto-utils": "^1.0.6"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/jest": "^29.5.12",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"ts-jest": "^29.1.4",
|
|
33
33
|
"typescript": "^5.4.5"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "2ee93dd0867c16e0a42f2f47b2fa66bc41ba29cf"
|
|
36
36
|
}
|