@fsyyft/npmjs-add 0.0.3 → 0.1.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 +7 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -4
- package/dist/index.d.ts +27 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,8 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
> 一个简单的加法工具库
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@fsyyft/npmjs-add)
|
|
5
|
+
[](https://www.npmjs.com/package/@fsyyft/npmjs-add)
|
|
6
|
+
[](https://www.npmjs.com/package/@fsyyft/npmjs-add)
|
|
6
7
|
[](https://www.npmjs.com/package/@fsyyft/npmjs-add)
|
|
8
|
+
[](https://github.com/fsyyft-ts/npmjs-add/actions)
|
|
9
|
+
[](https://github.com/fsyyft-ts/npmjs-add/actions)
|
|
10
|
+
[](https://www.typescriptlang.org/)
|
|
11
|
+
[](https://www.npmjs.com/package/@fsyyft/npmjs-add)
|
|
12
|
+
[](https://bundlephobia.com/package/@fsyyft/npmjs-add)
|
|
7
13
|
|
|
8
14
|
## 特性
|
|
9
15
|
|
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/cli.ts"],"sourcesContent":["/**\n *
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/cli.ts"],"sourcesContent":["/**\n * 加法工具库。\n *\n * @description\n * 提供数字加法运算功能,支持整数、负数和小数运算。\n *\n * @example\n * ```typescript\n * import { add } from '@fsyyft/npmjs-add';\n * const result = add(1, 2); // 3\n * ```\n */\n\n/**\n * 计算两个数的和。\n *\n * @description\n * 接收两个数字参数,返回它们的和。支持正数、负数和小数运算。\n *\n * @param a - 第一个加数\n * @param b - 第二个加数\n * @returns 两个数的和\n *\n * @example\n * ```typescript\n * add(1, 2); // 3\n * add(-1, 5); // 4\n * add(0.1, 0.2); // 0.30000000000000004\n * ```\n */\nexport function add(a: number, b: number): number {\n return a + b;\n}\n","#!/usr/bin/env node\n/**\n * CLI 入口文件。\n *\n * @description\n * npmjs-add 命令行工具的入口文件,负责解析命令行参数、\n * 验证输入、调用加法函数并输出结果。\n *\n * @remarks\n * - 解析命令行参数,要求两个数字输入;\n * - 验证参数数量和有效性;\n * - 调用 add 函数执行加法运算;\n * - 错误时输出使用说明并退出。\n *\n * @example\n * ```bash\n * npmjs-add 1 2 # 输出: 3\n * npmjs-add 100 200 # 输出: 300\n * npmjs-add -5 3 # 输出: -2\n * ```\n */\nimport { add } from \"./index\";\n\n// 从命令行参数中获取用户输入,跳过前两个系统参数\nconst args = process.argv.slice(2);\n\n// 参数验证:确保提供了两个数字\nif (args.length < 2) {\n console.error(\"Usage: npmjs-add <number1> <number2>\");\n process.exit(1);\n}\n\n// 将参数转换为数字\nconst a = Number(args[0]);\nconst b = Number(args[1]);\n\n// 验证参数是否为有效数字\nif (isNaN(a) || isNaN(b)) {\n console.error(\"Error: Both arguments must be valid numbers\");\n process.exit(1);\n}\n\n// 执行加法运算并输出结果\nconsole.log(add(a, b));\n"],"mappings":";;;;AA8BO,SAAS,IAAIA,IAAWC,IAAmB;AAChD,SAAOD,KAAIC;AACb;;;ACRA,IAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAGjC,IAAI,KAAK,SAAS,GAAG;AACnB,UAAQ,MAAM,sCAAsC;AACpD,UAAQ,KAAK,CAAC;AAChB;AAGA,IAAM,IAAI,OAAO,KAAK,CAAC,CAAC;AACxB,IAAM,IAAI,OAAO,KAAK,CAAC,CAAC;AAGxB,IAAI,MAAM,CAAC,KAAK,MAAM,CAAC,GAAG;AACxB,UAAQ,MAAM,6CAA6C;AAC3D,UAAQ,KAAK,CAAC;AAChB;AAGA,QAAQ,IAAI,IAAI,GAAG,CAAC,CAAC;","names":["a","b"]}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/cli.ts"],"sourcesContent":["/**\n *
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/cli.ts"],"sourcesContent":["/**\n * 加法工具库。\n *\n * @description\n * 提供数字加法运算功能,支持整数、负数和小数运算。\n *\n * @example\n * ```typescript\n * import { add } from '@fsyyft/npmjs-add';\n * const result = add(1, 2); // 3\n * ```\n */\n\n/**\n * 计算两个数的和。\n *\n * @description\n * 接收两个数字参数,返回它们的和。支持正数、负数和小数运算。\n *\n * @param a - 第一个加数\n * @param b - 第二个加数\n * @returns 两个数的和\n *\n * @example\n * ```typescript\n * add(1, 2); // 3\n * add(-1, 5); // 4\n * add(0.1, 0.2); // 0.30000000000000004\n * ```\n */\nexport function add(a: number, b: number): number {\n return a + b;\n}\n","#!/usr/bin/env node\n/**\n * CLI 入口文件。\n *\n * @description\n * npmjs-add 命令行工具的入口文件,负责解析命令行参数、\n * 验证输入、调用加法函数并输出结果。\n *\n * @remarks\n * - 解析命令行参数,要求两个数字输入;\n * - 验证参数数量和有效性;\n * - 调用 add 函数执行加法运算;\n * - 错误时输出使用说明并退出。\n *\n * @example\n * ```bash\n * npmjs-add 1 2 # 输出: 3\n * npmjs-add 100 200 # 输出: 300\n * npmjs-add -5 3 # 输出: -2\n * ```\n */\nimport { add } from \"./index\";\n\n// 从命令行参数中获取用户输入,跳过前两个系统参数\nconst args = process.argv.slice(2);\n\n// 参数验证:确保提供了两个数字\nif (args.length < 2) {\n console.error(\"Usage: npmjs-add <number1> <number2>\");\n process.exit(1);\n}\n\n// 将参数转换为数字\nconst a = Number(args[0]);\nconst b = Number(args[1]);\n\n// 验证参数是否为有效数字\nif (isNaN(a) || isNaN(b)) {\n console.error(\"Error: Both arguments must be valid numbers\");\n process.exit(1);\n}\n\n// 执行加法运算并输出结果\nconsole.log(add(a, b));\n"],"mappings":";;;AA8BO,SAAS,IAAIA,IAAWC,IAAmB;AAChD,SAAOD,KAAIC;AACb;;;ACRA,IAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAGjC,IAAI,KAAK,SAAS,GAAG;AACnB,UAAQ,MAAM,sCAAsC;AACpD,UAAQ,KAAK,CAAC;AAChB;AAGA,IAAM,IAAI,OAAO,KAAK,CAAC,CAAC;AACxB,IAAM,IAAI,OAAO,KAAK,CAAC,CAAC;AAGxB,IAAI,MAAM,CAAC,KAAK,MAAM,CAAC,GAAG;AACxB,UAAQ,MAAM,6CAA6C;AAC3D,UAAQ,KAAK,CAAC;AAChB;AAGA,QAAQ,IAAI,IAAI,GAAG,CAAC,CAAC;","names":["a","b"]}
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n *
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * 加法工具库。\n *\n * @description\n * 提供数字加法运算功能,支持整数、负数和小数运算。\n *\n * @example\n * ```typescript\n * import { add } from '@fsyyft/npmjs-add';\n * const result = add(1, 2); // 3\n * ```\n */\n\n/**\n * 计算两个数的和。\n *\n * @description\n * 接收两个数字参数,返回它们的和。支持正数、负数和小数运算。\n *\n * @param a - 第一个加数\n * @param b - 第二个加数\n * @returns 两个数的和\n *\n * @example\n * ```typescript\n * add(1, 2); // 3\n * add(-1, 5); // 4\n * add(0.1, 0.2); // 0.30000000000000004\n * ```\n */\nexport function add(a: number, b: number): number {\n return a + b;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BO,SAAS,IAAI,GAAW,GAAmB;AAChD,SAAO,IAAI;AACb;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @
|
|
5
|
-
*
|
|
2
|
+
* 加法工具库。
|
|
3
|
+
*
|
|
4
|
+
* @description
|
|
5
|
+
* 提供数字加法运算功能,支持整数、负数和小数运算。
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { add } from '@fsyyft/npmjs-add';
|
|
10
|
+
* const result = add(1, 2); // 3
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* 计算两个数的和。
|
|
15
|
+
*
|
|
16
|
+
* @description
|
|
17
|
+
* 接收两个数字参数,返回它们的和。支持正数、负数和小数运算。
|
|
18
|
+
*
|
|
19
|
+
* @param a - 第一个加数
|
|
20
|
+
* @param b - 第二个加数
|
|
21
|
+
* @returns 两个数的和
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* add(1, 2); // 3
|
|
26
|
+
* add(-1, 5); // 4
|
|
27
|
+
* add(0.1, 0.2); // 0.30000000000000004
|
|
28
|
+
* ```
|
|
6
29
|
*/
|
|
7
30
|
declare function add(a: number, b: number): number;
|
|
8
31
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @
|
|
5
|
-
*
|
|
2
|
+
* 加法工具库。
|
|
3
|
+
*
|
|
4
|
+
* @description
|
|
5
|
+
* 提供数字加法运算功能,支持整数、负数和小数运算。
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { add } from '@fsyyft/npmjs-add';
|
|
10
|
+
* const result = add(1, 2); // 3
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* 计算两个数的和。
|
|
15
|
+
*
|
|
16
|
+
* @description
|
|
17
|
+
* 接收两个数字参数,返回它们的和。支持正数、负数和小数运算。
|
|
18
|
+
*
|
|
19
|
+
* @param a - 第一个加数
|
|
20
|
+
* @param b - 第二个加数
|
|
21
|
+
* @returns 两个数的和
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* add(1, 2); // 3
|
|
26
|
+
* add(-1, 5); // 4
|
|
27
|
+
* add(0.1, 0.2); // 0.30000000000000004
|
|
28
|
+
* ```
|
|
6
29
|
*/
|
|
7
30
|
declare function add(a: number, b: number): number;
|
|
8
31
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n *
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * 加法工具库。\n *\n * @description\n * 提供数字加法运算功能,支持整数、负数和小数运算。\n *\n * @example\n * ```typescript\n * import { add } from '@fsyyft/npmjs-add';\n * const result = add(1, 2); // 3\n * ```\n */\n\n/**\n * 计算两个数的和。\n *\n * @description\n * 接收两个数字参数,返回它们的和。支持正数、负数和小数运算。\n *\n * @param a - 第一个加数\n * @param b - 第二个加数\n * @returns 两个数的和\n *\n * @example\n * ```typescript\n * add(1, 2); // 3\n * add(-1, 5); // 4\n * add(0.1, 0.2); // 0.30000000000000004\n * ```\n */\nexport function add(a: number, b: number): number {\n return a + b;\n}\n"],"mappings":";AA8BO,SAAS,IAAI,GAAW,GAAmB;AAChD,SAAO,IAAI;AACb;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fsyyft/npmjs-add",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "一个关于加法运算的 npm 管理的项目示例",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"url": "git+https://github.com/fsyyft-ts/npmjs-add.git"
|
|
29
29
|
},
|
|
30
30
|
"keywords": [],
|
|
31
|
-
"author": "",
|
|
31
|
+
"author": "fsyyft-ts",
|
|
32
32
|
"license": "ISC",
|
|
33
33
|
"bin": {
|
|
34
34
|
"npmjs-add": "./dist/cli.js"
|