@icreate/core
Advanced tools
Comparing version 0.0.24 to 0.0.25
@@ -468,5 +468,50 @@ /* | ||
}; | ||
/** | ||
* @description:md5加密 | ||
* @param {string} message 字符串 | ||
* @return {sting} MD5加密字符串 | ||
*/ | ||
Utils.md5 = function (message) { | ||
return md5(message); | ||
}; | ||
/** | ||
* @description:格式化日期 | ||
* @param {Date} date 日期 | ||
* @param {string} fmt 源对象 yyyy-MM-dd HH:mm:ss | ||
* @return {sting} 日期字符串 | ||
*/ | ||
Utils.formatDate = function (date, fmt) { | ||
var o = { | ||
'M+': date.getMonth() + 1, | ||
'd+': date.getDate(), | ||
'h+': date.getHours() % 12 == 0 ? 12 : date.getHours() % 12, | ||
'H+': date.getHours(), | ||
'm+': date.getMinutes(), | ||
's+': date.getSeconds(), | ||
'q+': Math.floor((date.getMonth() + 3) / 3), | ||
S: date.getMilliseconds() //毫秒 | ||
}; | ||
var week = { | ||
'0': '/u65e5', | ||
'1': '/u4e00', | ||
'2': '/u4e8c', | ||
'3': '/u4e09', | ||
'4': '/u56db', | ||
'5': '/u4e94', | ||
'6': '/u516d' | ||
}; | ||
if (/(y+)/.test(fmt)) { | ||
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length)); | ||
} | ||
if (/(E+)/.test(fmt)) { | ||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length > 1 ? (RegExp.$1.length > 2 ? '/u661f/u671f' : '/u5468') : '') + | ||
week[date.getDay() + '']); | ||
} | ||
for (var k in o) { | ||
if (new RegExp('(' + k + ')').test(fmt)) { | ||
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)); | ||
} | ||
} | ||
return fmt; | ||
}; | ||
Utils.function = function (opts) { | ||
@@ -473,0 +518,0 @@ var _this = this; |
@@ -473,5 +473,50 @@ (function (global, factory) { | ||
}; | ||
/** | ||
* @description:md5加密 | ||
* @param {string} message 字符串 | ||
* @return {sting} MD5加密字符串 | ||
*/ | ||
Utils.md5 = function (message) { | ||
return md5(message); | ||
}; | ||
/** | ||
* @description:格式化日期 | ||
* @param {Date} date 日期 | ||
* @param {string} fmt 源对象 yyyy-MM-dd HH:mm:ss | ||
* @return {sting} 日期字符串 | ||
*/ | ||
Utils.formatDate = function (date, fmt) { | ||
var o = { | ||
'M+': date.getMonth() + 1, | ||
'd+': date.getDate(), | ||
'h+': date.getHours() % 12 == 0 ? 12 : date.getHours() % 12, | ||
'H+': date.getHours(), | ||
'm+': date.getMinutes(), | ||
's+': date.getSeconds(), | ||
'q+': Math.floor((date.getMonth() + 3) / 3), | ||
S: date.getMilliseconds() //毫秒 | ||
}; | ||
var week = { | ||
'0': '/u65e5', | ||
'1': '/u4e00', | ||
'2': '/u4e8c', | ||
'3': '/u4e09', | ||
'4': '/u56db', | ||
'5': '/u4e94', | ||
'6': '/u516d' | ||
}; | ||
if (/(y+)/.test(fmt)) { | ||
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length)); | ||
} | ||
if (/(E+)/.test(fmt)) { | ||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length > 1 ? (RegExp.$1.length > 2 ? '/u661f/u671f' : '/u5468') : '') + | ||
week[date.getDay() + '']); | ||
} | ||
for (var k in o) { | ||
if (new RegExp('(' + k + ')').test(fmt)) { | ||
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)); | ||
} | ||
} | ||
return fmt; | ||
}; | ||
Utils.function = function (opts) { | ||
@@ -478,0 +523,0 @@ var _this = this; |
@@ -18,3 +18,3 @@ "use strict"; | ||
* @LastEditors: 文贝 | ||
* @LastEditTime: 2022-03-28 13:17:46 | ||
* @LastEditTime: 2022-04-26 17:38:48 | ||
* @Descripttion: | ||
@@ -213,5 +213,50 @@ * @FilePath: \src\core\utils.ts | ||
}; | ||
/** | ||
* @description:md5加密 | ||
* @param {string} message 字符串 | ||
* @return {sting} MD5加密字符串 | ||
*/ | ||
Utils.md5 = function (message) { | ||
return md5(message); | ||
}; | ||
/** | ||
* @description:格式化日期 | ||
* @param {Date} date 日期 | ||
* @param {string} fmt 源对象 yyyy-MM-dd HH:mm:ss | ||
* @return {sting} 日期字符串 | ||
*/ | ||
Utils.formatDate = function (date, fmt) { | ||
var o = { | ||
'M+': date.getMonth() + 1, | ||
'd+': date.getDate(), | ||
'h+': date.getHours() % 12 == 0 ? 12 : date.getHours() % 12, | ||
'H+': date.getHours(), | ||
'm+': date.getMinutes(), | ||
's+': date.getSeconds(), | ||
'q+': Math.floor((date.getMonth() + 3) / 3), | ||
S: date.getMilliseconds() //毫秒 | ||
}; | ||
var week = { | ||
'0': '/u65e5', | ||
'1': '/u4e00', | ||
'2': '/u4e8c', | ||
'3': '/u4e09', | ||
'4': '/u56db', | ||
'5': '/u4e94', | ||
'6': '/u516d' | ||
}; | ||
if (/(y+)/.test(fmt)) { | ||
fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length)); | ||
} | ||
if (/(E+)/.test(fmt)) { | ||
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length > 1 ? (RegExp.$1.length > 2 ? '/u661f/u671f' : '/u5468') : '') + | ||
week[date.getDay() + '']); | ||
} | ||
for (var k in o) { | ||
if (new RegExp('(' + k + ')').test(fmt)) { | ||
fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)); | ||
} | ||
} | ||
return fmt; | ||
}; | ||
Utils.function = function (opts) { | ||
@@ -218,0 +263,0 @@ var _this = this; |
@@ -48,3 +48,15 @@ import { ExecOptons } from '../interfaces/interfaces'; | ||
static command(opts: ExecOptons): void; | ||
/** | ||
* @description:md5加密 | ||
* @param {string} message 字符串 | ||
* @return {sting} MD5加密字符串 | ||
*/ | ||
static md5(message: string): string; | ||
/** | ||
* @description:格式化日期 | ||
* @param {Date} date 日期 | ||
* @param {string} fmt 源对象 yyyy-MM-dd HH:mm:ss | ||
* @return {sting} 日期字符串 | ||
*/ | ||
static formatDate(date: Date, fmt: string): string; | ||
static function(opts: ExecOptons): Promise<any>; | ||
@@ -51,0 +63,0 @@ private static _ajax; |
{ | ||
"name": "@icreate/core", | ||
"version": "0.0.24", | ||
"version": "0.0.25", | ||
"description": "Ics核心包封装", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
176003
2146