mazey 1.4.39 → 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/README.md +264 -122
- package/README_CN.md +335 -0
- package/lib/example.d.ts +2 -0
- package/lib/example.d.ts.map +1 -0
- package/lib/index.cjs.js +195 -457
- package/lib/index.d.ts +78 -134
- package/lib/index.d.ts.map +1 -1
- package/lib/index.esm.js +194 -449
- package/package.json +4 -3
- package/src/example.html +21 -0
- package/src/example.ts +49 -0
- package/src/index.ts +146 -428
- package/lib/test.d.ts +0 -2
- package/lib/test.d.ts.map +0 -1
- package/src/js/data-structure/MSet.js +0 -89
- package/src/js/polyfill.js +0 -63
- package/src/js/service/common.js +0 -4
- package/src/scss/extend/index.scss +0 -149
- package/src/scss/index.scss +0 -5
- package/src/scss/mixin/index.scss +0 -41
- package/src/scss/variate/index.scss +0 -28
- package/src/test.html +0 -33
- package/src/test.ts +0 -52
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mazey",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Mazey's library for front end.",
|
|
5
5
|
"main": "lib/index.cjs.js",
|
|
6
6
|
"module": "lib/index.esm.js",
|
|
7
7
|
"typings": "lib/index.d.ts",
|
|
8
8
|
"mainEntryPointFilePath": "lib/index.d.ts",
|
|
9
9
|
"directories": {
|
|
10
|
-
"
|
|
10
|
+
"lib": "./lib"
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
13
|
"dev": "webpack-dev-server --open",
|
|
14
14
|
"build": "npx rollup -c",
|
|
15
|
+
"test": "jest",
|
|
15
16
|
"docs": "npx typedoc --out docs/ src/",
|
|
16
17
|
"release": "npm run build && npm publish",
|
|
17
18
|
"lint-and-fix": "eslint ./src/index.ts --ext 'ts,tsx' --fix"
|
|
@@ -41,7 +42,6 @@
|
|
|
41
42
|
"@babel/preset-typescript": "7.10.4",
|
|
42
43
|
"@commitlint/cli": "8.3.5",
|
|
43
44
|
"@commitlint/config-conventional": "8.3.4",
|
|
44
|
-
"@microsoft/api-extractor": "7.9.4",
|
|
45
45
|
"@typescript-eslint/eslint-plugin": "^4.22.0",
|
|
46
46
|
"@typescript-eslint/parser": "^4.22.0",
|
|
47
47
|
"babel-eslint": "10.1.0",
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"html-webpack-plugin": "3.2.0",
|
|
56
56
|
"http-server": "0.11.1",
|
|
57
57
|
"husky": "4.2.3",
|
|
58
|
+
"jest": "^27.5.1",
|
|
58
59
|
"jsdoc": "3.6.3",
|
|
59
60
|
"lint-staged": "10.0.8",
|
|
60
61
|
"prettier": "1.19.1",
|
package/src/example.html
ADDED
|
@@ -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);
|