yuma_rand 1.0.1 → 1.0.3
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/cli.js +10 -3
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
// console.log(process.argv);
|
|
1
|
+
#!/usr/bin/env node
|
|
3
2
|
const rand = require('./index');
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
const min = Number(process.argv[2]) || 1;
|
|
5
|
+
const max = Number(process.argv[3]) || 100;
|
|
6
|
+
|
|
7
|
+
if (isNaN(min) || isNaN(max)) {
|
|
8
|
+
console.error('参数必须是数字,用法: rand <min> <max>');
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
console.log(rand(min, max));
|