mazey 1.4.37 → 2.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/package.json CHANGED
@@ -1,85 +1,86 @@
1
- {
2
- "name": "mazey",
3
- "version": "1.4.37",
4
- "description": "Mazey's library for front end.",
5
- "main": "lib/index.cjs.js",
6
- "module": "lib/index.esm.js",
7
- "typings": "lib/index.d.ts",
8
- "mainEntryPointFilePath": "lib/index.d.ts",
9
- "directories": {
10
- "example": "example"
11
- },
12
- "scripts": {
13
- "dev": "webpack-dev-server --open",
14
- "build": "npx rollup -c",
15
- "docs": "npx typedoc --out docs/ src/",
16
- "release": "npm run build && npm publish",
17
- "lint-and-fix": "eslint ./src/index.ts --ext 'ts,tsx' --fix"
18
- },
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/mazeyqian/mazey.git"
22
- },
23
- "keywords": [
24
- "JavaScript",
25
- "Function",
26
- "Math",
27
- "Load"
28
- ],
29
- "author": "MazeyQian",
30
- "license": "MIT",
31
- "bugs": {
32
- "url": "https://github.com/mazeyqian/mazey/issues"
33
- },
34
- "homepage": "https://mazey.cn/docs/mazey/",
35
- "devDependencies": {
36
- "@babel/core": "7.8.4",
37
- "@babel/plugin-proposal-class-properties": "7.10.4",
38
- "@babel/plugin-proposal-object-rest-spread": "7.11.0",
39
- "@babel/plugin-transform-runtime": "7.11.0",
40
- "@babel/preset-env": "7.5.5",
41
- "@babel/preset-typescript": "7.10.4",
42
- "@commitlint/cli": "8.3.5",
43
- "@commitlint/config-conventional": "8.3.4",
44
- "@microsoft/api-extractor": "7.9.4",
45
- "@typescript-eslint/eslint-plugin": "^4.22.0",
46
- "@typescript-eslint/parser": "^4.22.0",
47
- "babel-eslint": "10.1.0",
48
- "clean-webpack-plugin": "1.0.1",
49
- "eslint": "6.8.0",
50
- "eslint-config-standard": "14.1.0",
51
- "eslint-plugin-import": "2.20.1",
52
- "eslint-plugin-node": "11.0.0",
53
- "eslint-plugin-promise": "4.2.1",
54
- "eslint-plugin-standard": "4.0.1",
55
- "html-webpack-plugin": "3.2.0",
56
- "http-server": "0.11.1",
57
- "husky": "4.2.3",
58
- "jsdoc": "3.6.3",
59
- "lint-staged": "10.0.8",
60
- "prettier": "1.19.1",
61
- "prettier-eslint-cli": "5.0.0",
62
- "rollup": "1.31.1",
63
- "rollup-plugin-babel": "4.3.3",
64
- "rollup-plugin-commonjs": "^10.1.0",
65
- "rollup-plugin-typescript2": "0.27.2",
66
- "ts-loader": "8.0.2",
67
- "typedoc": "0.18.0",
68
- "typescript": "3.9.7",
69
- "uglify-js": "3.4.7",
70
- "uglifycss": "0.0.29",
71
- "webpack": "4.30.0",
72
- "webpack-cli": "3.3.2",
73
- "webpack-dev-server": "3.10.3"
74
- },
75
- "husky": {
76
- "hooks": {
77
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
78
- "pre-commit": "lint-staged"
79
- }
80
- },
81
- "dependencies": {
82
- "@babel/runtime-corejs3": "7.11.2",
83
- "core-js": "3.6.5"
84
- }
85
- }
1
+ {
2
+ "name": "mazey",
3
+ "version": "2.0.0",
4
+ "description": "Mazey's library for front end.",
5
+ "main": "lib/index.cjs.js",
6
+ "module": "lib/index.esm.js",
7
+ "typings": "lib/index.d.ts",
8
+ "mainEntryPointFilePath": "lib/index.d.ts",
9
+ "directories": {
10
+ "lib": "./lib"
11
+ },
12
+ "scripts": {
13
+ "dev": "webpack-dev-server --open",
14
+ "build": "npx rollup -c",
15
+ "test": "jest",
16
+ "docs": "npx typedoc --out docs/ src/",
17
+ "release": "npm run build && npm publish",
18
+ "lint-and-fix": "eslint ./src/index.ts --ext 'ts,tsx' --fix"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/mazeyqian/mazey.git"
23
+ },
24
+ "keywords": [
25
+ "JavaScript",
26
+ "Function",
27
+ "Math",
28
+ "Load"
29
+ ],
30
+ "author": "MazeyQian",
31
+ "license": "MIT",
32
+ "bugs": {
33
+ "url": "https://github.com/mazeyqian/mazey/issues"
34
+ },
35
+ "homepage": "https://mazey.cn/docs/mazey/",
36
+ "devDependencies": {
37
+ "@babel/core": "7.8.4",
38
+ "@babel/plugin-proposal-class-properties": "7.10.4",
39
+ "@babel/plugin-proposal-object-rest-spread": "7.11.0",
40
+ "@babel/plugin-transform-runtime": "7.11.0",
41
+ "@babel/preset-env": "7.5.5",
42
+ "@babel/preset-typescript": "7.10.4",
43
+ "@commitlint/cli": "8.3.5",
44
+ "@commitlint/config-conventional": "8.3.4",
45
+ "@typescript-eslint/eslint-plugin": "^4.22.0",
46
+ "@typescript-eslint/parser": "^4.22.0",
47
+ "babel-eslint": "10.1.0",
48
+ "clean-webpack-plugin": "1.0.1",
49
+ "eslint": "6.8.0",
50
+ "eslint-config-standard": "14.1.0",
51
+ "eslint-plugin-import": "2.20.1",
52
+ "eslint-plugin-node": "11.0.0",
53
+ "eslint-plugin-promise": "4.2.1",
54
+ "eslint-plugin-standard": "4.0.1",
55
+ "html-webpack-plugin": "3.2.0",
56
+ "http-server": "0.11.1",
57
+ "husky": "4.2.3",
58
+ "jest": "^27.5.1",
59
+ "jsdoc": "3.6.3",
60
+ "lint-staged": "10.0.8",
61
+ "prettier": "1.19.1",
62
+ "prettier-eslint-cli": "5.0.0",
63
+ "rollup": "1.31.1",
64
+ "rollup-plugin-babel": "4.3.3",
65
+ "rollup-plugin-commonjs": "^10.1.0",
66
+ "rollup-plugin-typescript2": "0.27.2",
67
+ "ts-loader": "8.0.2",
68
+ "typedoc": "0.18.0",
69
+ "typescript": "3.9.7",
70
+ "uglify-js": "3.4.7",
71
+ "uglifycss": "0.0.29",
72
+ "webpack": "4.30.0",
73
+ "webpack-cli": "3.3.2",
74
+ "webpack-dev-server": "3.10.3"
75
+ },
76
+ "husky": {
77
+ "hooks": {
78
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
79
+ "pre-commit": "lint-staged"
80
+ }
81
+ },
82
+ "dependencies": {
83
+ "@babel/runtime-corejs3": "7.11.2",
84
+ "core-js": "3.6.5"
85
+ }
86
+ }
@@ -0,0 +1,21 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <title>Test Page</title>
6
+ <link rel="shortcut icon" type="image/png" href="https://mazey.cn/fav/logo-dark-circle-transparent-144x144.png">
7
+ <style>
8
+ .box {
9
+ color: #333;
10
+ }
11
+ </style>
12
+ </head>
13
+ <body>
14
+ <div class="container">
15
+ <div class="box">
16
+ <span>Box</span>
17
+ </div>
18
+ <div class="s"></div>
19
+ </div>
20
+ </body>
21
+ </html>
package/src/example.ts ADDED
@@ -0,0 +1,49 @@
1
+ import {
2
+ isNumber,
3
+ getQueryParam,
4
+ getUrlParam,
5
+ updateQueryParam,
6
+ getHashQueryParam,
7
+ getDomain,
8
+ camelCaseToKebabCase,
9
+ camelCase2Underscore,
10
+ mTrim,
11
+ newLine,
12
+ deepCopyObject,
13
+ isJsonString,
14
+ generateRndNum,
15
+ } from './index';
16
+
17
+ // 数字测试
18
+ console.log('数字测试:', isNumber(Infinity, { isUnFiniteAsNumber: true }));
19
+
20
+ const hashParam = getHashQueryParam('ttt');
21
+
22
+ console.log('hashParam', hashParam);
23
+
24
+ // const t3 = getQueryParam('t3');
25
+ // const t4 = getQueryParam('t4');
26
+
27
+ // console.log('t3', t3);
28
+ // console.log('t4', t4);
29
+
30
+ // const t3 = getUrlParam('http://example.com/?t1=1&t2=2&t3=3&t4=4', 't3');
31
+ // const t4 = getUrlParam('http://example.com/?t1=1&t2=2&t3=3&t4=4', 't4');
32
+
33
+ // const t3 = updateQueryParam('http://example.com/?t1=1&t2=2&t3=3&t4=4', 't3', 'three');
34
+ // const t4 = updateQueryParam('http://example.com/?t1=1&t2=2&t3=3&t4=4', 't4', 'four');
35
+
36
+ // const t3 = getHashQueryParam('t3'); // 3
37
+ // const t4 = getHashQueryParam('t4'); // 4
38
+
39
+ // const t3 = getDomain('http://example.com/?t1=1&t2=2&t3=3&t4=4'); // example.com
40
+ // const t4 = getDomain('http://example.com/test/thanks?t1=1&t2=2&t3=3&t4=4', ['hostname', 'pathname']); // example.com/test/thanks
41
+
42
+ // const m1 = camelCaseToKebabCase('aBC'); // a-b-c
43
+ // const m2 = camelCase2Underscore('bBC'); // a_b_c
44
+
45
+ const m1 = generateRndNum(4); // '9730'
46
+ const m2 = generateRndNum(7); // '2262490'
47
+
48
+ console.log('m1', m1);
49
+ console.log('m2', m2);