amos-tool 1.4.7 → 1.4.8
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/.prettierignore +2 -2
- package/.prettierrc +50 -50
- package/README.md +667 -667
- package/apis/objectPath.md +129 -129
- package/index.d.ts +11 -2
- package/index.js +3 -3
- package/lib/_browser.js +10 -8
- package/lib/_clone.js +68 -57
- package/lib/_cookie.js +50 -47
- package/lib/_deepCopy.js +14 -19
- package/lib/_deepEqual.js +7 -8
- package/lib/_fastDeepEqual.js +26 -34
- package/lib/_flashSupport.js +13 -10
- package/lib/_forOwn.js +8 -7
- package/lib/_funcThrottle.js +16 -15
- package/lib/_isnode.js +2 -1
- package/lib/_list.js +74 -79
- package/lib/_object.assign.js +19 -19
- package/lib/_object.entries.js +8 -7
- package/lib/_object.values.js +8 -7
- package/lib/_omit.js +12 -11
- package/lib/_parseJson.js +7 -6
- package/lib/_pick.js +8 -7
- package/lib/_queue.js +24 -21
- package/lib/_shallowCopy.js +24 -23
- package/lib/_stringify.js +13 -10
- package/lib/_supportWs.js +5 -5
- package/lib/_trim.js +5 -4
- package/lib/_typeOfList.js +22 -21
- package/lib/_uuids.js +30 -35
- package/lib/amostool.js +4 -66
- package/lib/array2tree.js +9 -9
- package/lib/arrayFilter.js +18 -19
- package/lib/arrayUtils.js +10 -8
- package/lib/browser/Cookie.js +35 -36
- package/lib/browser/indexDB.js +72 -71
- package/lib/browserSupport.js +76 -71
- package/lib/completeUnit.js +7 -4
- package/lib/consts.js +2 -1
- package/lib/dom/canvas2img.js +61 -72
- package/lib/dom/canvasTools.js +11 -16
- package/lib/dom/downloadFile.js +17 -12
- package/lib/dom/eventHelper.js +8 -6
- package/lib/dom/fileBlob.js +14 -14
- package/lib/dom/fileSaveAs.js +54 -61
- package/lib/dom/getFontSize.js +7 -10
- package/lib/dom/minfyImg.js +27 -24
- package/lib/encrypt/_base64.js +32 -25
- package/lib/encrypt/_md5.js +68 -31
- package/lib/encrypt/des.js +430 -366
- package/lib/extra/_common.js +120 -161
- package/lib/extra/filterNull.js +5 -4
- package/lib/extra/find.js +10 -11
- package/lib/extra/index.js +4 -3
- package/lib/extra/memo.js +18 -0
- package/lib/extra/pathToTree.js +49 -36
- package/lib/extra/pwdStrength.js +4 -2
- package/lib/extra/sortBy.js +28 -30
- package/lib/flat.js +9 -13
- package/lib/locationParams.js +93 -95
- package/lib/log.js +20 -26
- package/lib/math/_keyColor.js +3 -1
- package/lib/math/addition.js +9 -7
- package/lib/math/amountCase.js +8 -12
- package/lib/math/coinFormat.js +6 -4
- package/lib/math/colorUtil.js +91 -94
- package/lib/math/dateTime.js +79 -97
- package/lib/math/operations.js +33 -37
- package/lib/math/pwdStrength.js +4 -2
- package/lib/math/randomColor.js +17 -5
- package/lib/math/subtraction.js +10 -9
- package/lib/merged.js +9 -9
- package/lib/objectPath.js +81 -82
- package/lib/parseText.js +8 -7
- package/lib/png/Identicon.js +32 -28
- package/lib/png/pnglib.js +59 -34
- package/lib/png/randomPic.js +8 -14
- package/lib/positionFactory.js +28 -28
- package/lib/pwdPolicy.js +27 -31
- package/lib/qs/_assign.js +7 -5
- package/lib/qs/_merge.js +20 -23
- package/lib/qs/_tools.js +3 -2
- package/lib/qs/formats.js +6 -5
- package/lib/qs/index.js +4 -4
- package/lib/qs/parse.js +56 -51
- package/lib/qs/stringify.js +54 -69
- package/lib/qs/utils.js +70 -83
- package/lib/random.js +5 -4
- package/lib/shallowEqual.js +25 -29
- package/lib/store.js +93 -95
- package/lib/strUtils.js +52 -43
- package/lib/tableFilter.js +178 -169
- package/lib/throttleDebounce.js +18 -22
- package/lib/url/encodeUrl.js +5 -4
- package/lib/url/restfulUrl.js +8 -7
- package/lib/utils.js +171 -222
- package/lib/xss/htmlEncode.js +3 -2
- package/lib/xss/implementEncode.js +36 -37
- package/lib/xss/index.js +4 -3
- package/package.json +4 -4
- package/docs/Logger.html +0 -189
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +0 -978
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +0 -1049
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/global.html +0 -14535
- package/docs/index.html +0 -791
- package/docs/scripts/collapse.js +0 -20
- package/docs/scripts/linenumber.js +0 -25
- package/docs/scripts/nav.js +0 -12
- package/docs/scripts/polyfill.js +0 -4
- package/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docs/scripts/prettify/lang-css.js +0 -2
- package/docs/scripts/prettify/prettify.js +0 -28
- package/docs/scripts/search.js +0 -83
- package/docs/styles/jsdoc.css +0 -765
- package/docs/styles/prettify.css +0 -79
package/lib/tableFilter.js
CHANGED
|
@@ -1,213 +1,222 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
_deepCopy = require("./_deepCopy");
|
|
2
|
+
|
|
3
|
+
var _utils = require("./utils"), _trim = require("./_trim"), _deepCopy = require("./_deepCopy");
|
|
5
4
|
|
|
6
5
|
function getChildrenlength(e) {
|
|
7
6
|
var t = 1;
|
|
8
|
-
return
|
|
7
|
+
return _utils.isArray(e) && (t = e.length), t;
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
function flatToHierarchy(e) {
|
|
12
11
|
if (!e.length) return e;
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
12
|
+
var t = [], n = {};
|
|
13
|
+
e.forEach((function(e) {
|
|
14
|
+
if (e.pos) {
|
|
15
|
+
var t = e.pos.split("-").length;
|
|
16
|
+
n[t] || (n[t] = []), n[t].push(e);
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
19
|
+
var r = Object.keys(n).sort((function(e, t) {
|
|
20
|
+
return t - e;
|
|
21
|
+
}));
|
|
22
|
+
return _utils.reduce(r, (function(e, r) {
|
|
23
|
+
return r && r !== e && n[e].forEach((function(e) {
|
|
24
|
+
var l = !1;
|
|
25
|
+
n[r].forEach((function(t) {
|
|
26
|
+
isInclude(t.pos.split("-"), e.pos.split("-")) && (l = !0, t.children || (t.children = []),
|
|
27
|
+
t.children.push(e));
|
|
28
|
+
})), l || t.push(e);
|
|
29
|
+
})), r;
|
|
30
|
+
})), n[r[r.length - 1]].concat(t);
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
function filterParentPosition(e) {
|
|
33
|
-
var
|
|
34
|
-
e.forEach(function(e) {
|
|
35
|
-
var
|
|
36
|
-
|
|
37
|
-
});
|
|
38
|
-
for (var
|
|
39
|
-
for (var
|
|
40
|
-
isInclude(
|
|
41
|
-
}),
|
|
42
|
-
return e
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
var
|
|
46
|
-
return
|
|
47
|
-
|
|
48
|
-
}),
|
|
34
|
+
var t = {};
|
|
35
|
+
e.forEach((function(e) {
|
|
36
|
+
var n = e.split("-").length;
|
|
37
|
+
t[n] || (t[n] = []), t[n].push(e);
|
|
38
|
+
}));
|
|
39
|
+
for (var n = Object.keys(t).sort(), r = 0; r < n.length; r++) n[r + 1] && t[n[r]].forEach((function(e) {
|
|
40
|
+
for (var l = r + 1; l < n.length; l++) t[n[l]].forEach((function(r, c) {
|
|
41
|
+
isInclude(e.split("-"), r.split("-")) && (t[n[l]][c] = null);
|
|
42
|
+
})), t[n[l]] = t[n[l]].filter((function(e) {
|
|
43
|
+
return e;
|
|
44
|
+
}));
|
|
45
|
+
}));
|
|
46
|
+
var l = [];
|
|
47
|
+
return n.forEach((function(e) {
|
|
48
|
+
l = l.concat(t[e]);
|
|
49
|
+
})), l;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
|
-
function isInclude(e,
|
|
52
|
-
return _utils.every(e, function(e,
|
|
53
|
-
return e === n
|
|
54
|
-
})
|
|
52
|
+
function isInclude(e, t) {
|
|
53
|
+
return _utils.every(e, (function(e, n) {
|
|
54
|
+
return e === t[n];
|
|
55
|
+
}));
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
function filterAllCheckedData(
|
|
58
|
-
if (!
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
node:
|
|
66
|
-
pos:
|
|
67
|
-
}),
|
|
68
|
-
e.__checked = !0,
|
|
58
|
+
function filterAllCheckedData(e, t) {
|
|
59
|
+
if (!e.length) return e;
|
|
60
|
+
var n = recursiveGen(t), r = [];
|
|
61
|
+
return function t(n) {
|
|
62
|
+
n.forEach((function(n) {
|
|
63
|
+
if (!n.__checked) {
|
|
64
|
+
var l = e.indexOf(n.value), c = n.children;
|
|
65
|
+
l > -1 ? (n.__checked = !0, r.push({
|
|
66
|
+
node: n,
|
|
67
|
+
pos: n._pos
|
|
68
|
+
}), e.splice(l, 1), c && recursive(c, (function(e) {
|
|
69
|
+
e.__checked = !0, r.push({
|
|
69
70
|
node: e,
|
|
70
71
|
pos: e._pos
|
|
71
|
-
})
|
|
72
|
-
})) :
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
72
|
+
});
|
|
73
|
+
}))) : c && t(c);
|
|
74
|
+
}
|
|
75
|
+
}));
|
|
76
|
+
}(n), function e(t, n) {
|
|
77
|
+
n || (n = {
|
|
78
|
+
root: !0
|
|
79
|
+
});
|
|
80
|
+
var l = 0;
|
|
81
|
+
t.forEach((function(t) {
|
|
82
|
+
var n = t.children;
|
|
83
|
+
if (!n || t.__checked || t.__halfChecked) t.__checked ? l++ : t.__halfChecked && (l += .5); else {
|
|
84
|
+
var r = e(n, t);
|
|
85
|
+
r.__checked ? l++ : r.__halfChecked && (l += .5);
|
|
86
|
+
}
|
|
87
|
+
}));
|
|
88
|
+
var c = t.length;
|
|
89
|
+
return l === c ? (n.__checked = !0, r.push({
|
|
90
|
+
node: n,
|
|
91
|
+
pos: n._pos
|
|
92
|
+
})) : l < c && l > 0 && (n.__halfChecked = !0), n.root ? t : n;
|
|
93
|
+
}(n), r.forEach((function(e, t) {
|
|
94
|
+
delete r[t].node.__checked, delete r[t].node._pos, r[t].node.props = {
|
|
95
|
+
title: r[t].node.title,
|
|
96
|
+
label: r[t].node.label || r[t].node.title,
|
|
97
|
+
value: r[t].node.value
|
|
98
|
+
}, r[t].node.children && (r[t].node.props.children = r[t].node.children), delete r[t].node.title,
|
|
99
|
+
delete r[t].node.label, delete r[t].node.value, delete r[t].node.children;
|
|
100
|
+
})), r;
|
|
96
101
|
}
|
|
97
102
|
|
|
98
|
-
function recursiveGen(e,
|
|
99
|
-
return
|
|
100
|
-
var
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
})
|
|
103
|
+
function recursiveGen(e, t) {
|
|
104
|
+
return t || (t = 0), e.map((function(e, n) {
|
|
105
|
+
var r = t + "-" + n, l = {
|
|
106
|
+
title: e.title,
|
|
107
|
+
label: e.label || e.title,
|
|
108
|
+
value: e.value,
|
|
109
|
+
key: e.key,
|
|
110
|
+
_pos: r
|
|
111
|
+
};
|
|
112
|
+
return e.children && (l.children = recursiveGen(e.children, r)), l;
|
|
113
|
+
}));
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
function recursive(e, t) {
|
|
113
|
-
e.forEach(function(e) {
|
|
114
|
-
t(e), e.children && recursive(e.children, t)
|
|
115
|
-
})
|
|
117
|
+
e.forEach((function(e) {
|
|
118
|
+
t(e), e.children && recursive(e.children, t);
|
|
119
|
+
}));
|
|
116
120
|
}
|
|
117
121
|
|
|
118
|
-
function flatCustomArr(
|
|
119
|
-
if (
|
|
120
|
-
if (!
|
|
121
|
-
var
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
c
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
122
|
+
function flatCustomArr(e, t) {
|
|
123
|
+
if (e = _trim(e), _utils.isEmpty(e)) return t;
|
|
124
|
+
if (!t.length) return t;
|
|
125
|
+
var n = [], r = {};
|
|
126
|
+
!function t(n) {
|
|
127
|
+
n.forEach((function(n) {
|
|
128
|
+
n.code && (0 == n.level || "0" == n.level || n.level) && (n.children && n.children.length > 0 ? (r[n.level] || (r[n.level] = []),
|
|
129
|
+
r[n.level].push(n), t(n.children), n.children = []) : (r[n.level] || (r[n.level] = []),
|
|
130
|
+
n.label.indexOf(e) > -1 && r[n.level].push(n)));
|
|
131
|
+
}));
|
|
132
|
+
}(t);
|
|
133
|
+
var l = Object.keys(r).sort((function(e, t) {
|
|
134
|
+
return t - e;
|
|
135
|
+
}));
|
|
136
|
+
return _utils.reduce(l, (function(e, t) {
|
|
137
|
+
return t && t !== e && r[e].forEach((function(e, l) {
|
|
138
|
+
var c = !1;
|
|
139
|
+
r[t].forEach((function(t) {
|
|
140
|
+
isInclude(t.pos.split("-"), e.pos.split("-")) && (c = !0, t.children || (t.children = []),
|
|
141
|
+
t.children.push(e));
|
|
142
|
+
})), c || n.push(e);
|
|
143
|
+
})), t;
|
|
144
|
+
})), r[l[l.length - 1]].concat(n);
|
|
139
145
|
}
|
|
140
146
|
|
|
141
147
|
function recombineFlatData(e, t) {
|
|
142
|
-
return flatCustomArr(e, t)
|
|
148
|
+
return flatCustomArr(e, t);
|
|
143
149
|
}
|
|
144
150
|
|
|
145
151
|
function flatMatchedData2Hierarchy(e) {
|
|
146
152
|
if (!e.length) return e;
|
|
147
|
-
var
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
153
|
+
var t = [], n = {};
|
|
154
|
+
e.forEach((function(e) {
|
|
155
|
+
if (e.code) {
|
|
156
|
+
var t = e.code.split("_").length;
|
|
157
|
+
n[t] || (n[t] = []), n[t].push(e);
|
|
158
|
+
}
|
|
159
|
+
}));
|
|
160
|
+
var r = Object.keys(n).sort((function(e, t) {
|
|
161
|
+
return t - e;
|
|
162
|
+
}));
|
|
163
|
+
return _utils.reduce(r, (function(e, r) {
|
|
164
|
+
return r && r !== e && n[e].forEach((function(e) {
|
|
165
|
+
var l = !1;
|
|
166
|
+
n[r].forEach((function(t) {
|
|
167
|
+
isInclude(t.code.split("_"), e.code.split("_")) && (l = !0, t.children || (t.children = []),
|
|
168
|
+
t.children.push(e));
|
|
169
|
+
})), l || t.push(e);
|
|
170
|
+
})), r;
|
|
171
|
+
})), n[r[r.length - 1]].concat(t);
|
|
164
172
|
}
|
|
165
173
|
|
|
166
|
-
function fileterAllMatchedData(
|
|
167
|
-
var
|
|
168
|
-
return function r
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
174
|
+
function fileterAllMatchedData(e, t) {
|
|
175
|
+
var n = [];
|
|
176
|
+
return function t(r) {
|
|
177
|
+
r.forEach((function(r) {
|
|
178
|
+
if (!r.__matched) {
|
|
179
|
+
r.__pos = r.code;
|
|
180
|
+
var l = r.label.indexOf(e), c = r.children;
|
|
181
|
+
l > -1 ? (r.__matched = !0, n.push(r), c && t(c)) : c && t(c);
|
|
182
|
+
}
|
|
183
|
+
}));
|
|
184
|
+
}(t), function e(t, r) {
|
|
185
|
+
r || (r = {
|
|
186
|
+
root: !0
|
|
187
|
+
});
|
|
188
|
+
var l = !1;
|
|
189
|
+
return t.forEach((function(t) {
|
|
190
|
+
var n = t.children;
|
|
191
|
+
!n || t.__matched || t.__halfMatched ? t.__matched && (l = !0) : e(n, t).__matched && (l = !0);
|
|
192
|
+
})), l && (r.__matched = !0, r.children = [], r.root || n.push(r)), r.root ? t : r;
|
|
193
|
+
}(t), n.forEach((function(e, t) {
|
|
194
|
+
delete n[t].__matched, delete n[t].__halfMatched, delete n[t].__pos, delete n[t].children;
|
|
195
|
+
})), n;
|
|
186
196
|
}
|
|
187
197
|
|
|
188
198
|
function recombineData(e, t) {
|
|
189
|
-
return e = _trim(e),
|
|
199
|
+
return e = _trim(e), _utils.isEmpty(e) ? t : t.length ? flatMatchedData2Hierarchy(fileterAllMatchedData(e, t = _deepCopy(t))) : t;
|
|
190
200
|
}
|
|
191
201
|
|
|
192
|
-
function filterChilds(
|
|
193
|
-
var
|
|
194
|
-
return function
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
})
|
|
198
|
-
}(
|
|
202
|
+
function filterChilds(e, t) {
|
|
203
|
+
var n = [];
|
|
204
|
+
return function t(r) {
|
|
205
|
+
r.forEach((function(r, l) {
|
|
206
|
+
r.children && r.children.length > 0 ? t(r.children) : r.label.indexOf(e) > -1 && n.push(r);
|
|
207
|
+
}));
|
|
208
|
+
}(t), n;
|
|
199
209
|
}
|
|
200
210
|
|
|
201
211
|
function filterTreeLevel(e, t, n) {
|
|
202
|
-
var r =
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
})
|
|
209
|
-
}(e = e || []), e
|
|
212
|
+
var r = (n = n || {}).levelKey || "level", l = n.childrenKey || "children";
|
|
213
|
+
return function e(t) {
|
|
214
|
+
t.forEach((function(t, n) {
|
|
215
|
+
t[l] && t[l].length > 0 ? e(t[l]) : 3 == t[r] && delete t[l];
|
|
216
|
+
}));
|
|
217
|
+
}(e = e || []), e;
|
|
210
218
|
}
|
|
219
|
+
|
|
211
220
|
module.exports = {
|
|
212
221
|
getChildrenlength: getChildrenlength,
|
|
213
222
|
flatToHierarchy: flatToHierarchy,
|
|
@@ -220,4 +229,4 @@ module.exports = {
|
|
|
220
229
|
fileterAllMatchedData: fileterAllMatchedData,
|
|
221
230
|
recursive: recursive,
|
|
222
231
|
filterTreeLevel: filterTreeLevel
|
|
223
|
-
};
|
|
232
|
+
};
|
package/lib/throttleDebounce.js
CHANGED
|
@@ -1,34 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function throttle(
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function f() {
|
|
8
|
-
l && clearTimeout(l)
|
|
3
|
+
function throttle(t, o, e, n) {
|
|
4
|
+
var i, u = !1, c = 0;
|
|
5
|
+
function r() {
|
|
6
|
+
i && clearTimeout(i);
|
|
9
7
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
e = arguments;
|
|
15
|
-
|
|
16
|
-
function n() {
|
|
17
|
-
a = Date.now(), c.apply(t, e)
|
|
8
|
+
function l() {
|
|
9
|
+
var l = this, d = Date.now() - c, a = arguments;
|
|
10
|
+
function f() {
|
|
11
|
+
c = Date.now(), e.apply(l, a);
|
|
18
12
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
13
|
+
function v() {
|
|
14
|
+
i = void 0;
|
|
15
|
+
}
|
|
16
|
+
u || (n && !i && f(), r(), void 0 === n && d > t ? f() : !0 !== o && (i = setTimeout(n ? v : f, void 0 === n ? t - d : t)));
|
|
22
17
|
}
|
|
23
|
-
return "boolean" != typeof
|
|
24
|
-
|
|
25
|
-
},
|
|
18
|
+
return "boolean" != typeof o && (n = e, e = o, o = void 0), l.cancel = function() {
|
|
19
|
+
r(), u = !0;
|
|
20
|
+
}, l;
|
|
26
21
|
}
|
|
27
22
|
|
|
28
23
|
function debounce(t, o, e) {
|
|
29
|
-
return void 0 === e ? throttle(t, o, !1) : throttle(t, e, !1 !== o)
|
|
24
|
+
return void 0 === e ? throttle(t, o, !1) : throttle(t, e, !1 !== o);
|
|
30
25
|
}
|
|
26
|
+
|
|
31
27
|
module.exports = {
|
|
32
28
|
throttle: throttle,
|
|
33
29
|
debounce: debounce
|
|
34
|
-
};
|
|
30
|
+
};
|
package/lib/url/encodeUrl.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
|
|
2
3
|
var encodeLen = 8;
|
|
4
|
+
|
|
3
5
|
module.exports = function(e) {
|
|
4
|
-
var r = [/[+]/g, /[ ]/g, /[\/]/g, /[\?]/g, /[#]/g, /[&]/g, /[=]/g],
|
|
5
|
-
g = ["%2B", "%20", "%2F", "%3F", "%23", "%26", "%3D"];
|
|
6
|
+
var r = [ /[+]/g, /[ ]/g, /[\/]/g, /[\?]/g, /[#]/g, /[&]/g, /[=]/g ], g = [ "%2B", "%20", "%2F", "%3F", "%23", "%26", "%3D" ];
|
|
6
7
|
e = e.replace(/[%]/g, "%25");
|
|
7
8
|
for (var n = 0; n < encodeLen - 1; n++) e = e.replace(r[n], g[n]);
|
|
8
|
-
return e
|
|
9
|
-
};
|
|
9
|
+
return e;
|
|
10
|
+
};
|
package/lib/url/restfulUrl.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
2
|
+
|
|
3
|
+
var utils = require("./../utils"), _regex = /\{\s*([^\|\}]+?)\s*(?:\|([^\}]*))?\s*\}/g;
|
|
4
|
+
|
|
5
|
+
module.exports = function(e, r, s) {
|
|
6
|
+
return s || (s = _regex), e.replace ? e.replace(s, (function(e, s) {
|
|
7
|
+
return utils.isUndefined(r[s]) ? e : r[s];
|
|
8
|
+
})) : e;
|
|
9
|
+
};
|