mm_expand 1.7.3 → 1.7.5

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 (3) hide show
  1. package/index.js +9 -13
  2. package/package.json +1 -1
  3. package/test.js +1 -1
package/index.js CHANGED
@@ -511,13 +511,13 @@ Eventer.prototype.on = function(key, func) {
511
511
  * @param {String} key 事件关键
512
512
  * @param {Object} params 传递参数
513
513
  */
514
- Eventer.prototype.run = function(key, params) {
514
+ Eventer.prototype.run = function(key, ...params) {
515
515
  var events = this.dict;
516
516
  var list = events[key];
517
517
  if (list) {
518
518
  for (var i = 0; i < list.length; i++) {
519
519
  try {
520
- list[i](params);
520
+ list[i](...params);
521
521
  } catch (e) {
522
522
  console.error(e);
523
523
  //TODO handle the exception
@@ -1108,23 +1108,19 @@ if (typeof($) === "undefined") {
1108
1108
  }
1109
1109
  };
1110
1110
  /**
1111
- * @description 转为时间对象
1112
- * @return {Date} 返回时间对象类型
1111
+ * @description Convert to time object
1112
+ * @return {Date} time object
1113
1113
  */
1114
1114
  String.prototype.toTime = function() {
1115
1115
  var str = this;
1116
1116
  var time;
1117
1117
  if (str.indexOf('T') !== -1) {
1118
- // str = this.replace('T', ' ').replaceAll('-', '/');
1119
- str = this.replace('T', ' ');
1120
- if (str.indexOf('Z') !== -1) {
1121
- str = str.replace('Z', '');
1122
- time = (new Date(str)).addSeconds(28800);
1123
- } else {
1124
- time = new Date(str);
1125
- }
1118
+ str = str.replace('T', ' ');
1119
+ }
1120
+ if (str.indexOf('Z') !== -1) {
1121
+ str = str.replace('Z', '');
1122
+ time = (new Date(str)).addSeconds(28800);
1126
1123
  } else {
1127
- // str = this.replaceAll('-', '/');
1128
1124
  time = new Date(str);
1129
1125
  }
1130
1126
  return time;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mm_expand",
3
- "version": "1.7.3",
3
+ "version": "1.7.5",
4
4
  "description": "这是超级美眉原型函数拓展模块,更有利于对string、array、object的操作,避免出错,简化业务逻辑。",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test.js CHANGED
@@ -8,7 +8,6 @@ require('./index.js');
8
8
  // console.log(t.toTimestamp());
9
9
  // console.log(t.toTimeStr('yyyy-MM-dd hh:mm:ss'));
10
10
  // console.log(t.toTimeStr('yyyy-MM-ddThh:mm:ssZ'));
11
-
12
11
  // var index = $.eventer.on('update_config', (conf) => {
13
12
  // console.log("事件示例", conf);
14
13
  // });
@@ -52,6 +51,7 @@ var time = now.toStr('yyyy-MM-dd hh:mm:ss');
52
51
  console.log("当前", time);
53
52
  console.log("时间", time.toTime().toStr("yyyy-MM-dd hh:mm:ss"));
54
53
  console.log("当前", new Date(time).toStr("yyyy-MM-dd hh:mm:ss"));
54
+ console.log(now.toString(), now.toString().toTime().toStr('yyyy-MM-dd hh:mm:ss'));
55
55
 
56
56
  // var time = now.toStr("yyyy-MM-ddThh:mm");
57
57
  // console.log("当前", time);