File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const moment = require('moment');
66moment . locale ( 'zh-cn' ) ; // 使用中文
77
88// 格式化时间
9- exports . formatDate = function ( date , friendly ) {
9+ exports . formatDate = ( date , friendly ) => {
1010 date = moment ( date ) ;
1111
1212 if ( friendly ) {
@@ -16,14 +16,14 @@ exports.formatDate = function(date, friendly) {
1616 return date . format ( 'YYYY-MM-DD HH:mm' ) ;
1717} ;
1818
19- exports . validateId = function ( str ) {
19+ exports . validateId = str => {
2020 return / ^ [ a - z A - Z 0 - 9 \- _ ] + $ / i. test ( str ) ;
2121} ;
2222
23- exports . bhash = function ( str , callback ) {
24- bcrypt . hash ( str , 10 , callback ) ;
23+ exports . bhash = str => {
24+ return bcrypt . hashSync ( str , 10 ) ;
2525} ;
2626
27- exports . bcompare = function ( str , hash , callback ) {
28- bcrypt . compare ( str , hash , callback ) ;
27+ exports . bcompare = ( str , hash ) => {
28+ return bcrypt . compareSync ( str , hash ) ;
2929} ;
You can’t perform that action at this time.
0 commit comments