guoguo-converbyte 1.2.0 → 1.2.2
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.
- package/exec.js +7 -0
- package/index.js +9 -24
- package/package.json +4 -1
package/exec.js
ADDED
package/index.js
CHANGED
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 计算机容量单位转换
|
|
3
|
+
* @params number bytes 字节数
|
|
4
|
+
* @params number type 0:不转回 1:KB 2:MB 3:GB 4:TB 默认值是0
|
|
5
|
+
* @return number 转换之后的结果
|
|
6
|
+
*/
|
|
7
|
+
const coverByte = (bytes, type=0) => bytes / (1024 ** type);
|
|
7
8
|
|
|
8
|
-
*/
|
|
9
|
-
const _ = require('lodash');
|
|
10
|
-
// commonJS引入
|
|
11
|
-
const chalk = require('chalk');
|
|
12
|
-
// ES6引入
|
|
13
|
-
// import chalk from 'chalk';
|
|
14
|
-
const uniq = require('uniq');
|
|
15
|
-
// const converbyte = require('converbyte');
|
|
16
9
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
console.log(_.chunk(arr, 3));
|
|
20
|
-
|
|
21
|
-
console.log(chalk.red('高小乐一口水喝掉一个太平洋!'));
|
|
22
|
-
console.log(chalk.bgRed('高小乐吃了一顿饭!'));
|
|
23
|
-
|
|
24
|
-
console.log(uniq([10,20,30,40,50,40,30,30,20]));
|
|
25
|
-
|
|
26
|
-
// console.log(converbyte(3445454545, 3).toFixed(2) + 'GB');
|
|
10
|
+
// CommonJS模块规范暴露数据
|
|
11
|
+
module.exports = coverByte;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "guoguo-converbyte",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"author": "",
|
|
@@ -8,5 +8,8 @@
|
|
|
8
8
|
"main": "index.js",
|
|
9
9
|
"scripts": {
|
|
10
10
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
11
|
+
},
|
|
12
|
+
"bin": {
|
|
13
|
+
"bytec": "exec.js"
|
|
11
14
|
}
|
|
12
15
|
}
|