@luzhaoqi/test 0.0.55 → 0.0.57

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/package.json CHANGED
@@ -1,26 +1,52 @@
1
- {
2
- "name": "@luzhaoqi/test",
3
- "version": "0.0.55",
4
- "private": false,
5
- "description": "A simple math library with sum function",
6
- "main": "src/index.js",
7
- "module": "src/vue-plugin.js",
8
- "scripts": {
9
- "test": "jest",
10
- "pub": "npm publish --access public"
11
- },
12
- "keywords": [
13
- "math",
14
- "sum",
15
- "addition",
16
- "calculator"
17
- ],
18
- "author": "lzq",
19
- "license": "MIT",
20
- "peerDependencies": {
21
- "vue": "^2.6.0 || ^3.0.0"
22
- },
23
- "devDependencies": {
24
- "jest": "^27.0.6"
25
- }
26
- }
1
+ {
2
+ "name": "@luzhaoqi/test",
3
+ "version": "0.0.57",
4
+ "private": false,
5
+ "main": "dist/z-ui3.mjs",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "scripts": {
10
+ "dev": "vite",
11
+ "build": "vite build",
12
+ "preview": "vite preview",
13
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore",
14
+ "format": "prettier --write src/",
15
+ "pub": "npm publish --access public",
16
+ "patch": "npm version patch",
17
+ "lib": "npm run build & npm run pub"
18
+ },
19
+ "dependencies": {
20
+ "@element-plus/icons-vue": "^2.3.1",
21
+ "@vueuse/head": "^2.0.0",
22
+ "axios": "^1.6.3",
23
+ "clipboard": "^2.0.11",
24
+ "element-plus": "^2.4.4",
25
+ "file-saver": "^2.0.5",
26
+ "fuse.js": "6.4.3",
27
+ "js-cookie": "^3.0.1",
28
+ "jsencrypt": "^3.0.0-rc.1",
29
+ "mockjs": "^1.1.0",
30
+ "nprogress": "^0.2.0",
31
+ "pinia": "^2.1.7",
32
+ "pinia-plugin-persist": "^1.0.0",
33
+ "quill": "1.3.7",
34
+ "screenfull": "5.0.2",
35
+ "vue": "^3.3.11",
36
+ "vue-router": "^4.2.5"
37
+ },
38
+ "devDependencies": {
39
+ "@rushstack/eslint-patch": "^1.3.3",
40
+ "@vitejs/plugin-vue": "^4.5.2",
41
+ "@vitejs/plugin-vue-jsx": "^3.1.0",
42
+ "@vue/eslint-config-prettier": "^8.0.0",
43
+ "eslint": "^8.49.0",
44
+ "eslint-plugin-vue": "^9.17.0",
45
+ "prettier": "^3.0.3",
46
+ "sass": "1.69.5",
47
+ "unplugin-auto-import": "^0.17.3",
48
+ "unplugin-vue-components": "^0.26.0",
49
+ "vite": "^5.0.10",
50
+ "vite-plugin-vue-setup-extend": "^0.4.0"
51
+ }
52
+ }
package/.idea/modules.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/npm-test.iml" filepath="$PROJECT_DIR$/.idea/npm-test.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/temp" />
6
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
package/src/index.js DELETED
@@ -1,38 +0,0 @@
1
- /**
2
- * 加法函数
3
- * @param {...number} numbers - 要相加的数字
4
- * @returns {number} 和
5
- * @throws {TypeError} 如果参数不是数字
6
- */
7
- function add(...numbers) {
8
- validateNumbers(numbers);
9
- return numbers.reduce((total, num) => total + num, 0);
10
- }
11
-
12
- /**
13
- * 减法函数
14
- * @param {number} a - 被减数
15
- * @param {number} b - 减数
16
- * @returns {number} 差
17
- * @throws {TypeError} 如果参数不是数字
18
- */
19
- function subtract(a, b) {
20
- validateNumbers([a, b]);
21
- return a - b;
22
- }
23
-
24
- /**
25
- * 验证数字
26
- * @param {Array} numbers - 要验证的数字数组
27
- * @throws {TypeError} 如果任何参数不是数字
28
- */
29
- function validateNumbers(numbers) {
30
- if (!numbers.every(num => typeof num === 'number' && !isNaN(num))) {
31
- throw new TypeError('所有参数必须是有效数字');
32
- }
33
- }
34
-
35
- module.exports = {
36
- add,
37
- subtract
38
- };
package/src/vue-plugin.js DELETED
@@ -1,39 +0,0 @@
1
- const { add, subtract } = require('./index');
2
-
3
- const VueMathOpsPlugin = {
4
- install(Vue, options) {
5
- // 添加全局方法
6
- Vue.add = add;
7
- Vue.subtract = subtract;
8
-
9
- // 添加实例方法
10
- Vue.prototype.$add = add;
11
- Vue.prototype.$subtract = subtract;
12
-
13
- // 添加全局过滤器
14
- Vue.filter('add', function(numbers) {
15
- return add(...numbers);
16
- });
17
-
18
- Vue.filter('subtract', function(numbers) {
19
- return subtract(...numbers);
20
- });
21
-
22
- // 添加指令
23
- Vue.directive('add', {
24
- bind(el, binding) {
25
- el.textContent = add(...binding.value);
26
- }
27
- });
28
-
29
- Vue.directive('subtract', {
30
- bind(el, binding) {
31
- if (binding.value.length === 2) {
32
- el.textContent = subtract(...binding.value);
33
- }
34
- }
35
- });
36
- }
37
- };
38
-
39
- module.exports = VueMathOpsPlugin;
@@ -1,17 +0,0 @@
1
- const { add, subtract } = require('../src/index');
2
-
3
- test('add function', () => {
4
- expect(add(1, 2, 3)).toBe(6);
5
- expect(add(10, -5, 3.5)).toBe(8.5);
6
- expect(add()).toBe(0);
7
- });
8
-
9
- test('subtract function', () => {
10
- expect(subtract(5, 3)).toBe(2);
11
- expect(subtract(10, -5)).toBe(15);
12
- });
13
-
14
- test('error handling', () => {
15
- expect(() => add('a', 2)).toThrow(TypeError);
16
- expect(() => subtract('a', 2)).toThrow(TypeError);
17
- });