@@ -66,7 +66,7 @@ module.exports = function(AV) {
6666 } ;
6767
6868 // 判断是否是国内节点
69- const isCnNode = function ( ) {
69+ const isCnNode = ( ) => {
7070 return avConfig . region === 'cn' ;
7171 } ;
7272
@@ -349,7 +349,7 @@ module.exports = function(AV) {
349349 console . warn ( 'Get current user failed. It seems this runtime use an async storage system, please new AV.File in the callback of AV.User.currentAsync().' ) ;
350350 }
351351 this . _metaData = {
352- owner : ( currentUser !== null ? currentUser . id : 'unknown' )
352+ owner : ( currentUser ? currentUser . id : 'unknown' )
353353 } ;
354354
355355 // Guess the content type from the extension if we need to.
@@ -479,10 +479,10 @@ module.exports = function(AV) {
479479 * @param {Object } value an optional metadata value.
480480 **/
481481 metaData : function ( attr , value ) {
482- if ( attr !== null && value !== null ) {
482+ if ( attr && value ) {
483483 this . _metaData [ attr ] = value ;
484484 return this ;
485- } else if ( attr !== null ) {
485+ } else if ( attr && ! value ) {
486486 return this . _metaData [ attr ] ;
487487 } else {
488488 return this . _metaData ;
@@ -506,7 +506,7 @@ module.exports = function(AV) {
506506 throw "Invalid width or height value." ;
507507 }
508508 quality = quality || 100 ;
509- scaleToFit = ( scaleToFit === null ) ? true : scaleToFit ;
509+ scaleToFit = ! scaleToFit ? true : scaleToFit ;
510510 if ( quality <= 0 || quality > 100 ) {
511511 throw "Invalid quality value." ;
512512 }
@@ -564,7 +564,7 @@ module.exports = function(AV) {
564564 mime_type : type ,
565565 metaData : self . _metaData
566566 } ;
567- if ( type && self . _metaData . mime_type === null )
567+ if ( type && ! self . _metaData . mime_type )
568568 self . _metaData . mime_type = type ;
569569 self . _qiniu_key = key ;
570570 return AV . _request ( "qiniu" , null , null , 'POST' , data ) ;
0 commit comments