mazey 3.2.0 → 3.3.2
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/LICENSE +21 -21
- package/README.md +536 -496
- package/README_CN.md +334 -334
- package/{src/example.html → examples/index.html} +21 -21
- package/examples/index.ts +50 -0
- package/index.js +47 -3
- package/lib/index.cjs.js +1 -1
- package/lib/index.d.ts +139 -56
- package/lib/index.d.ts.map +1 -1
- package/lib/index.esm.js +1 -1
- package/lib/mazey.min.js +1 -1
- package/package.json +109 -109
- package/scripts/release.js +28 -28
- package/src/index.ts +1604 -1426
- package/webpack.config.dev.js +39 -0
- package/src/example.ts +0 -49
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
2
|
+
/* eslint-disable no-undef */
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
5
|
+
const CleanWebpackPlugin = require('clean-webpack-plugin');
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
entry: {
|
|
9
|
+
index: './examples/index.ts'
|
|
10
|
+
},
|
|
11
|
+
output: {
|
|
12
|
+
filename: '[name].js',
|
|
13
|
+
path: path.resolve(__dirname, 'dist')
|
|
14
|
+
},
|
|
15
|
+
devServer: {
|
|
16
|
+
contentBase: './dist'
|
|
17
|
+
},
|
|
18
|
+
module: {
|
|
19
|
+
rules: [
|
|
20
|
+
{
|
|
21
|
+
test: /\.tsx?$/,
|
|
22
|
+
use: 'ts-loader',
|
|
23
|
+
exclude: /node_modules/,
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
plugins: [
|
|
28
|
+
new HtmlWebpackPlugin({
|
|
29
|
+
filename: path.resolve(__dirname, 'dist/index.html'),
|
|
30
|
+
template: path.resolve(__dirname, 'examples/index.html'),
|
|
31
|
+
inject: true,
|
|
32
|
+
chunksSortMode: 'dependency'
|
|
33
|
+
}),
|
|
34
|
+
new CleanWebpackPlugin(['dist'])
|
|
35
|
+
],
|
|
36
|
+
resolve: {
|
|
37
|
+
extensions: ['.tsx', '.ts', '.js'],
|
|
38
|
+
}
|
|
39
|
+
};
|
package/src/example.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
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);
|