guoguo-converbyte 1.2.0
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/index.js +26 -0
- package/index.mjs +11 -0
- package/package.json +12 -0
package/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// 使用第三方包
|
|
2
|
+
/*
|
|
3
|
+
1. 先找是否存在内置模块 lodash
|
|
4
|
+
2. 再从当前目录中的 node_modules 里面找 lodash
|
|
5
|
+
3. 如果没有,会从上级目录的 node_modules 里面找 lodash, 一直向上找
|
|
6
|
+
4. 最后会找全局 node_modules
|
|
7
|
+
|
|
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
|
+
|
|
17
|
+
|
|
18
|
+
const arr = [1,2,3,4,5,6,7,8,9,10,11];
|
|
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');
|
package/index.mjs
ADDED
package/package.json
ADDED