dddzy-lab6-utils 0.0.0-stage → 1.0.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/README.md CHANGED
@@ -1,3 +1,9 @@
1
- # Temporary Holding Version
1
+ # lab6-utils
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Laboratory 6 npm package demo.
4
+
5
+ ## Usage
6
+
7
+ const lab = require("yourname-lab6-utils");
8
+ lab.student.hello();
9
+ lab.calculator.add(1, 2);
package/index.js ADDED
@@ -0,0 +1,8 @@
1
+ const student = require("./lib/student");
2
+ const calculator = require("./lib/calculator");
3
+
4
+ module.exports = {
5
+ version: "1.0.0",
6
+ student,
7
+ calculator
8
+ };
@@ -0,0 +1,13 @@
1
+ const constants = { PI: 3.14159, E: 2.71828 };
2
+
3
+ function add(a, b) {
4
+ console.log(`add: ${a} + ${b} = ${a + b}`);
5
+ return a + b;
6
+ }
7
+
8
+ function multiply(a, b) {
9
+ console.log(`multiply: ${a} * ${b} = ${a * b}`);
10
+ return a * b;
11
+ }
12
+
13
+ module.exports = { constants, add, multiply };
package/lib/student.js ADDED
@@ -0,0 +1,15 @@
1
+ const info = {
2
+ name: "邓昭阳",
3
+ studentId: "2400770175",
4
+ course: "Java Web后端开发技术"
5
+ };
6
+
7
+ function hello() {
8
+ console.log("hello from student module");
9
+ }
10
+
11
+ function printInfo() {
12
+ console.log("student info:", info);
13
+ }
14
+
15
+ module.exports = { info, hello, printInfo };
package/package.json CHANGED
@@ -1,6 +1,21 @@
1
1
  {
2
2
  "name": "dddzy-lab6-utils",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0",
4
+ "description": "Lab 6 npm package with two CommonJS modules",
5
+ "main": "index.js",
6
+ "files": [
7
+ "index.js",
8
+ "lib"
9
+ ],
10
+ "scripts": {
11
+ "test": "node test.js"
12
+ },
13
+ "keywords": [
14
+ "npm",
15
+ "lab",
16
+ "commonjs"
17
+ ],
18
+ "author": "邓昭阳",
19
+ "license": "MIT",
20
+ "type": "commonjs"
6
21
  }