magtool 1.3.9 → 1.4.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.1.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # magtool
2
2
 
3
+ 1.4.0
4
+
5
+ Array.filter覆写,返回data和index
6
+
3
7
  1.3.9
4
8
 
5
9
  init 为dev环境热更前置判断,
package/dist/util.js CHANGED
@@ -73,9 +73,9 @@ const N = (s) => {
73
73
  return e;
74
74
  };
75
75
  globalThis.$fd = F;
76
- const b = (o, r = !1) => o.substr(0, 1).toUpperCase() + (r ? o.substr(1, o.length).toLowerCase() : o.substr(1, o.length));
77
- s.config.globalProperties.$toUpperCamel = b, globalThis.$toUpperCamel = b;
78
- const p = (o, r = 2) => {
76
+ const p = (o, r = !1) => o.substr(0, 1).toUpperCase() + (r ? o.substr(1, o.length).toLowerCase() : o.substr(1, o.length));
77
+ s.config.globalProperties.$toUpperCamel = p, globalThis.$toUpperCamel = p;
78
+ const u = (o, r = 2) => {
79
79
  const e = globalThis.$getType(o);
80
80
  let t;
81
81
  e === "Number" ? (o = o.toFixed(r), t = String(o), o = String(Math.abs(o))) : e === "String" && (t = o, o = String(Math.abs(Number(o))));
@@ -83,14 +83,14 @@ const N = (s) => {
83
83
  let n = l[0].split("");
84
84
  n = n.reverse();
85
85
  let a = [];
86
- n.forEach((E, $) => {
87
- $ !== 0 && $ % 3 === 0 && a.push(","), a.push(E);
86
+ n.forEach((O, $) => {
87
+ $ !== 0 && $ % 3 === 0 && a.push(","), a.push(O);
88
88
  });
89
89
  let c = a.reverse().join("");
90
90
  return globalThis.$getType(r) === "Number" && r > 0 && (c += ".", l[1] ? c += l[1].padEnd(r, 0).substr(0, r) : c += "0".padEnd(r, "0")), Number(t) !== Number(o) ? `-${c}` : c;
91
91
  };
92
- globalThis.$fa = p, s.config.globalProperties.$fa = p;
93
- const u = ({
92
+ globalThis.$fa = u, s.config.globalProperties.$fa = u;
93
+ const b = ({
94
94
  prop: o,
95
95
  currency: r,
96
96
  value: e,
@@ -99,7 +99,7 @@ const N = (s) => {
99
99
  const l = t[o];
100
100
  return l.unit === "currency" ? r ? `${r} ${globalThis.$fa(e, l == null ? void 0 : l.precision)}` : globalThis.$fa(e, l == null ? void 0 : l.precision) : l.unit === "%" ? `${globalThis.$fa(e, l == null ? void 0 : l.precision)}%` : globalThis.$fa(e, l == null ? void 0 : l.precision);
101
101
  };
102
- globalThis.$fu2 = u, s.config.globalProperties.$fu2 = u;
102
+ globalThis.$fu2 = b, s.config.globalProperties.$fu2 = b;
103
103
  const h = (o = () => {
104
104
  }, r = 2) => {
105
105
  let e = null;
@@ -134,6 +134,13 @@ const N = (s) => {
134
134
  index: e,
135
135
  data: r
136
136
  };
137
+ }, Array.prototype.filter = function(o) {
138
+ if (!o || typeof o != "function")
139
+ throw new Error(o + " is not a function");
140
+ const r = [];
141
+ for (let e = 0; e < this.length; e++)
142
+ o(this[e], e, this) && r.push({ data: this[e], index: e });
143
+ return r;
137
144
  }, globalThis.$getType = (o) => Object.prototype.toString.call(o).slice(8, -1);
138
145
  const m = (o, r) => {
139
146
  if (!o) {
@@ -204,7 +211,7 @@ const N = (s) => {
204
211
  tag: "background-color:#20c997; color:#f6fffc; border-radius: 2px 0 0 2px;",
205
212
  style: "background-color:#f6fffc; color:#20c997;"
206
213
  }
207
- }, O = (o) => {
214
+ }, A = (o) => {
208
215
  let r = !1;
209
216
  for (let e in o)
210
217
  if (globalThis.$getType(o[e]) === "Object") {
@@ -212,11 +219,11 @@ const N = (s) => {
212
219
  break;
213
220
  }
214
221
  return r;
215
- }, A = ["info", "log", "warn", "error", "success"];
216
- globalThis.$c = {}, A.forEach((o) => {
222
+ }, E = ["info", "log", "warn", "error", "success"];
223
+ globalThis.$c = {}, E.forEach((o) => {
217
224
  globalThis.$c[o] = (...r) => {
218
225
  const e = o.toUpperCase();
219
- O(r) ? (console.groupCollapsed(`%c ${e} `, `${i[o].tag}`), console[o](r), console.groupEnd()) : console.info(
226
+ A(r) ? (console.groupCollapsed(`%c ${e} `, `${i[o].tag}`), console[o](r), console.groupEnd()) : console.info(
220
227
  `%c ${e} %c┆${r}┆`,
221
228
  `${i[o].tag}`,
222
229
  `${i[o].style}`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "magtool",
3
3
  "packageManager": "yarn@4.4.1",
4
- "version": "1.3.9",
4
+ "version": "1.4.0",
5
5
  "author": "matt avis",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",