tools-for-js 1.2.6 → 1.2.7
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.md +1 -0
- package/lib/index.js +6 -0
- package/lib/utils/string.js +11 -0
- package/lib/utils/time.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/index.js
CHANGED
|
@@ -153,6 +153,12 @@ Object.defineProperty(exports, "objectToQs", {
|
|
|
153
153
|
return _object.objectToQs;
|
|
154
154
|
}
|
|
155
155
|
});
|
|
156
|
+
Object.defineProperty(exports, "replacePath", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function get() {
|
|
159
|
+
return _string.replacePath;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
156
162
|
Object.defineProperty(exports, "shuffleArray", {
|
|
157
163
|
enumerable: true,
|
|
158
164
|
get: function get() {
|
package/lib/utils/string.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getStrLength = exports.encode = exports.decode = exports.checkPwdStrength = void 0;
|
|
7
|
+
exports.replacePath = replacePath;
|
|
7
8
|
exports.splitString = splitString;
|
|
8
9
|
var _utf8_encode = function _utf8_encode(string) {
|
|
9
10
|
string = string.replace(/\r\n/g, '\n');
|
|
@@ -181,4 +182,14 @@ function splitString(str, num) {
|
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
return array;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/*******
|
|
188
|
+
* @description: 将路径中的反斜杠字符 \ 替换为斜杠 /
|
|
189
|
+
* @author: 琴时
|
|
190
|
+
* @param {*} path
|
|
191
|
+
* @return {*}
|
|
192
|
+
*/
|
|
193
|
+
function replacePath(path) {
|
|
194
|
+
return path.replace(/\\/g, '/');
|
|
184
195
|
}
|
package/lib/utils/time.js
CHANGED
|
@@ -11,7 +11,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
11
11
|
// ES 2015
|
|
12
12
|
|
|
13
13
|
_dayjs["default"].locale('zh-cn'); // 全局使用
|
|
14
|
-
_dayjs["default"].extend(_relativeTime["default"]);
|
|
15
14
|
|
|
16
15
|
/*******
|
|
17
16
|
* @description: 生成时间格式化
|
|
@@ -150,6 +149,7 @@ var countDown = exports.countDown = function countDown(params) {
|
|
|
150
149
|
* @return {String}
|
|
151
150
|
*/
|
|
152
151
|
var transformDate = exports.transformDate = function transformDate(date, diff) {
|
|
152
|
+
_dayjs["default"].extend(_relativeTime["default"]);
|
|
153
153
|
var transDay = (0, _dayjs["default"])(date).fromNow().replace(/\s+/g, '');
|
|
154
154
|
if (transDay === '几秒前') transDay = '刚刚';
|
|
155
155
|
if (diff) {
|