amos-tool 1.4.7 → 1.4.10

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.
Files changed (103) hide show
  1. package/.prettierignore +2 -2
  2. package/.prettierrc +50 -50
  3. package/README.md +3 -0
  4. package/apis/objectPath.md +129 -129
  5. package/docs/Logger.html +160 -2
  6. package/docs/global.html +529 -65
  7. package/docs/index.html +5 -2
  8. package/index.d.ts +11 -2
  9. package/index.js +3 -3
  10. package/lib/_browser.js +10 -8
  11. package/lib/_clone.js +68 -57
  12. package/lib/_cookie.js +50 -47
  13. package/lib/_deepCopy.js +14 -19
  14. package/lib/_deepEqual.js +7 -8
  15. package/lib/_fastDeepEqual.js +26 -34
  16. package/lib/_flashSupport.js +13 -10
  17. package/lib/_forOwn.js +8 -7
  18. package/lib/_funcThrottle.js +16 -15
  19. package/lib/_isnode.js +2 -1
  20. package/lib/_list.js +74 -79
  21. package/lib/_object.assign.js +19 -19
  22. package/lib/_object.entries.js +8 -7
  23. package/lib/_object.values.js +8 -7
  24. package/lib/_omit.js +12 -11
  25. package/lib/_parseJson.js +7 -6
  26. package/lib/_pick.js +8 -7
  27. package/lib/_queue.js +24 -21
  28. package/lib/_shallowCopy.js +24 -23
  29. package/lib/_stringify.js +13 -10
  30. package/lib/_supportWs.js +5 -5
  31. package/lib/_trim.js +5 -4
  32. package/lib/_typeOfList.js +22 -21
  33. package/lib/_uuids.js +30 -35
  34. package/lib/amostool.js +4 -66
  35. package/lib/array2tree.js +9 -9
  36. package/lib/arrayFilter.js +18 -19
  37. package/lib/arrayUtils.js +10 -8
  38. package/lib/browser/Cookie.js +35 -36
  39. package/lib/browser/indexDB.js +72 -71
  40. package/lib/browserSupport.js +76 -71
  41. package/lib/completeUnit.js +7 -4
  42. package/lib/consts.js +2 -1
  43. package/lib/dom/canvas2img.js +61 -72
  44. package/lib/dom/canvasTools.js +11 -16
  45. package/lib/dom/downloadFile.js +17 -12
  46. package/lib/dom/eventHelper.js +8 -6
  47. package/lib/dom/fileBlob.js +14 -14
  48. package/lib/dom/fileSaveAs.js +54 -61
  49. package/lib/dom/getFontSize.js +7 -10
  50. package/lib/dom/minfyImg.js +27 -24
  51. package/lib/encrypt/_base64.js +32 -25
  52. package/lib/encrypt/_md5.js +68 -31
  53. package/lib/encrypt/des.js +430 -366
  54. package/lib/extra/_common.js +120 -161
  55. package/lib/extra/filterNull.js +5 -4
  56. package/lib/extra/find.js +10 -11
  57. package/lib/extra/index.js +4 -3
  58. package/lib/extra/memo.js +18 -0
  59. package/lib/extra/pathToTree.js +49 -36
  60. package/lib/extra/pwdStrength.js +4 -2
  61. package/lib/extra/sortBy.js +28 -30
  62. package/lib/flat.js +9 -13
  63. package/lib/locationParams.js +93 -95
  64. package/lib/log.js +23 -26
  65. package/lib/math/_keyColor.js +3 -1
  66. package/lib/math/addition.js +9 -7
  67. package/lib/math/amountCase.js +8 -12
  68. package/lib/math/coinFormat.js +6 -4
  69. package/lib/math/colorUtil.js +91 -94
  70. package/lib/math/dateTime.js +79 -97
  71. package/lib/math/operations.js +33 -37
  72. package/lib/math/pwdStrength.js +4 -2
  73. package/lib/math/randomColor.js +17 -5
  74. package/lib/math/subtraction.js +10 -9
  75. package/lib/merged.js +9 -9
  76. package/lib/objectPath.js +81 -82
  77. package/lib/parseText.js +8 -7
  78. package/lib/png/Identicon.js +32 -28
  79. package/lib/png/pnglib.js +59 -34
  80. package/lib/png/randomPic.js +8 -14
  81. package/lib/positionFactory.js +28 -28
  82. package/lib/pwdPolicy.js +27 -31
  83. package/lib/qs/_assign.js +7 -5
  84. package/lib/qs/_merge.js +20 -23
  85. package/lib/qs/_tools.js +3 -2
  86. package/lib/qs/formats.js +6 -5
  87. package/lib/qs/index.js +4 -4
  88. package/lib/qs/parse.js +56 -51
  89. package/lib/qs/stringify.js +54 -69
  90. package/lib/qs/utils.js +70 -83
  91. package/lib/random.js +5 -4
  92. package/lib/shallowEqual.js +25 -29
  93. package/lib/store.js +93 -95
  94. package/lib/strUtils.js +52 -43
  95. package/lib/tableFilter.js +178 -169
  96. package/lib/throttleDebounce.js +18 -22
  97. package/lib/url/encodeUrl.js +5 -4
  98. package/lib/url/restfulUrl.js +8 -7
  99. package/lib/utils.js +170 -222
  100. package/lib/xss/htmlEncode.js +3 -2
  101. package/lib/xss/implementEncode.js +36 -37
  102. package/lib/xss/index.js +4 -3
  103. package/package.json +4 -4
@@ -1,213 +1,222 @@
1
1
  "use strict";
2
- var _utils = require("./utils"),
3
- _trim = require("./_trim"),
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 t = _utils.isArray(e) ? e.length : t
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 l = [],
14
- c = {};
15
- e.forEach(function(e) {
16
- var t;
17
- e.pos && (t = e.pos.split("-").length, c[t] || (c[t] = []), c[t].push(e))
18
- });
19
- e = Object.keys(c).sort(function(e, t) {
20
- return t - e
21
- });
22
- return _utils.reduce(e, function(e, r) {
23
- return r && r !== e && c[e].forEach(function(t) {
24
- var n = !1;
25
- c[r].forEach(function(e) {
26
- isInclude(e.pos.split("-"), t.pos.split("-")) && (n = !0, e.children || (e.children = []), e.children.push(t))
27
- }), n || l.push(t)
28
- }), r
29
- }), c[e[e.length - 1]].concat(l)
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 l = {};
34
- e.forEach(function(e) {
35
- var t = e.split("-").length;
36
- l[t] || (l[t] = []), l[t].push(e)
37
- });
38
- for (var c = Object.keys(l).sort(), t = 0; t < c.length; t++) c[t + 1] && l[c[t]].forEach(function(n) {
39
- for (var r = t + 1; r < c.length; r++) l[c[r]].forEach(function(e, t) {
40
- isInclude(n.split("-"), e.split("-")) && (l[c[r]][t] = null)
41
- }), l[c[r]] = l[c[r]].filter(function(e) {
42
- return e
43
- })
44
- });
45
- var n = [];
46
- return c.forEach(function(e) {
47
- n = n.concat(l[e])
48
- }), n
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, n) {
52
- return _utils.every(e, function(e, t) {
53
- return e === n[t]
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(l, e) {
58
- if (!l.length) return l;
59
- var e = recursiveGen(e),
60
- c = [];
61
- return function r(e) {
62
- e.forEach(function(e) {
63
- var t, n;
64
- e.__checked || (t = l.indexOf(e.value), n = e.children, -1 < t ? (e.__checked = !0, c.push({
65
- node: e,
66
- pos: e._pos
67
- }), l.splice(t, 1), n && recursive(n, function(e) {
68
- e.__checked = !0, c.push({
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
- })) : n && r(n))
73
- })
74
- }(e),
75
- function n(e, t) {
76
- t = t || {
77
- root: !0
78
- };
79
- var r = 0;
80
- e.forEach(function(e) {
81
- var t = e.children;
82
- !t || e.__checked || e.__halfChecked ? e.__checked ? r++ : e.__halfChecked && (r += .5) : (e = n(t, e)).__checked ? r++ : e.__halfChecked && (r += .5)
83
- });
84
- var l = e.length;
85
- return r === l ? (t.__checked = !0, c.push({
86
- node: t,
87
- pos: t._pos
88
- })) : r < l && 0 < r && (t.__halfChecked = !0), t.root ? e : t
89
- }(e), c.forEach(function(e, t) {
90
- delete c[t].node.__checked, delete c[t].node._pos, c[t].node.props = {
91
- title: c[t].node.title,
92
- label: c[t].node.label || c[t].node.title,
93
- value: c[t].node.value
94
- }, c[t].node.children && (c[t].node.props.children = c[t].node.children), delete c[t].node.title, delete c[t].node.label, delete c[t].node.value, delete c[t].node.children
95
- }), c
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, r) {
99
- return r = r || 0, e.map(function(e, t) {
100
- var n = r + "-" + t,
101
- t = {
102
- title: e.title,
103
- label: e.label || e.title,
104
- value: e.value,
105
- key: e.key,
106
- _pos: n
107
- };
108
- return e.children && (t.children = recursiveGen(e.children, n)), t
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(n, e) {
119
- if (n = _trim(n), _utils.isEmpty(n)) return e;
120
- if (!e.length) return e;
121
- var l = [],
122
- c = {};
123
- ! function t(e) {
124
- e.forEach(function(e) {
125
- e.code && (0 != e.level && "0" != e.level && !e.level || (e.children && 0 < e.children.length ? (c[e.level] || (c[e.level] = []), c[e.level].push(e), t(e.children), e.children = []) : (c[e.level] || (c[e.level] = []), -1 < e.label.indexOf(n) && c[e.level].push(e))))
126
- })
127
- }(e);
128
- e = Object.keys(c).sort(function(e, t) {
129
- return t - e
130
- });
131
- return _utils.reduce(e, function(e, r) {
132
- return r && r !== e && c[e].forEach(function(t, e) {
133
- var n = !1;
134
- c[r].forEach(function(e) {
135
- isInclude(e.pos.split("-"), t.pos.split("-")) && (n = !0, e.children || (e.children = []), e.children.push(t))
136
- }), n || l.push(t)
137
- }), r
138
- }), c[e[e.length - 1]].concat(l)
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 l = [],
148
- c = {};
149
- e.forEach(function(e) {
150
- var t;
151
- e.code && (t = e.code.split("_").length, c[t] || (c[t] = []), c[t].push(e))
152
- });
153
- e = Object.keys(c).sort(function(e, t) {
154
- return t - e
155
- });
156
- return _utils.reduce(e, function(e, r) {
157
- return r && r !== e && c[e].forEach(function(t) {
158
- var n = !1;
159
- c[r].forEach(function(e) {
160
- isInclude(e.code.split("_"), t.code.split("_")) && (n = !0, e.children || (e.children = []), e.children.push(t))
161
- }), n || l.push(t)
162
- }), r
163
- }), c[e[e.length - 1]].concat(l)
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(l, e) {
167
- var c = [];
168
- return function r(e) {
169
- e.forEach(function(e) {
170
- var t, n;
171
- e.__matched || (e.__pos = e.code, t = e.label.indexOf(l), n = e.children, -1 < t && (e.__matched = !0, c.push(e)), n && r(n))
172
- })
173
- }(e),
174
- function n(e, t) {
175
- t = t || {
176
- root: !0
177
- };
178
- var r = !1;
179
- return e.forEach(function(e) {
180
- var t = e.children;
181
- !t || e.__matched || e.__halfMatched ? e.__matched && (r = !0) : n(t, e).__matched && (r = !0)
182
- }), r && (t.__matched = !0, t.children = [], t.root || c.push(t)), t.root ? e : t
183
- }(e), c.forEach(function(e, t) {
184
- delete c[t].__matched, delete c[t].__halfMatched, delete c[t].__pos, delete c[t].children
185
- }), c
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), !_utils.isEmpty(e) && t.length ? flatMatchedData2Hierarchy(fileterAllMatchedData(e, t = _deepCopy(t))) : t
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(r, e) {
193
- var l = [];
194
- return function n(e) {
195
- e.forEach(function(e, t) {
196
- e.children && 0 < e.children.length ? n(e.children) : -1 < e.label.indexOf(r) && l.push(e)
197
- })
198
- }(e), l
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 = 3,
203
- l = (n = n || {}).levelKey || "level",
204
- c = n.childrenKey || "children";
205
- return function n(e) {
206
- e.forEach(function(e, t) {
207
- e[c] && 0 < e[c].length ? n(e[c]) : e[l] == r && delete e[c]
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
+ };
@@ -1,34 +1,30 @@
1
1
  "use strict";
2
2
 
3
- function throttle(i, u, c, r) {
4
- var l, d = !1,
5
- a = 0;
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
- function t() {
12
- var t = this,
13
- o = Date.now() - a,
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
- d || (r && !l && n(), f(), void 0 === r && i < o ? n() : !0 !== u && (l = setTimeout(r ? function() {
20
- l = void 0
21
- } : n, void 0 === r ? i - o : i)))
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 u && (r = c, c = u, u = void 0), t.cancel = function() {
24
- f(), d = !0
25
- }, t
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
+ };
@@ -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
+ };
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
- var utils = require("./../utils"),
3
- _regex = /\{\s*([^\|\}]+?)\s*(?:\|([^\}]*))?\s*\}/g;
4
- module.exports = function(e, s, r) {
5
- return r = r || _regex, e.replace ? e.replace(r, function(e, r) {
6
- return utils.isUndefined(s[r]) ? e : s[r]
7
- }) : e
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
+ };