@@ -244,7 +244,7 @@ module.exports = function(AV) {
244244 * Returns a JSON version of the object.
245245 * @return {Object }
246246 */
247- toJSON : function ( key , holder , seenObjects = [ this ] ) {
247+ toJSON ( key , holder , seenObjects = [ this ] ) {
248248 return this . _toFullJSON ( seenObjects , false ) ;
249249 } ,
250250
@@ -264,15 +264,15 @@ module.exports = function(AV) {
264264 * Returns the ACL for this file.
265265 * @returns {AV.ACL } An instance of AV.ACL.
266266 */
267- getACL : function ( ) {
267+ getACL ( ) {
268268 return this . _acl ;
269269 } ,
270270
271271 /**
272272 * Sets the ACL to be used for this file.
273273 * @param {AV.ACL } acl An instance of AV.ACL.
274274 */
275- setACL : function ( acl ) {
275+ setACL ( acl ) {
276276 if ( ! ( acl instanceof AV . ACL ) ) {
277277 return new AVError ( AVError . OTHER_CAUSE , 'ACL must be a AV.ACL.' ) ;
278278 }
@@ -284,7 +284,7 @@ module.exports = function(AV) {
284284 * given by the user. After save is called, that name gets prefixed with a
285285 * unique identifier.
286286 */
287- name : function ( ) {
287+ name ( ) {
288288 return this . get ( 'name' ) ;
289289 } ,
290290
@@ -293,7 +293,7 @@ module.exports = function(AV) {
293293 * after you get the file from a AV.Object.
294294 * @return {String }
295295 */
296- url : function ( ) {
296+ url ( ) {
297297 return this . get ( 'url' ) ;
298298 } ,
299299
@@ -302,7 +302,7 @@ module.exports = function(AV) {
302302 * @param {String } The attribute name which want to get.
303303 * @returns {Any }
304304 */
305- get : function ( attrName ) {
305+ get ( attrName ) {
306306 switch ( attrName ) {
307307 case 'objectId' :
308308 return this . id ;
@@ -325,7 +325,7 @@ module.exports = function(AV) {
325325 * @param {Object } value is an optional metadata value.
326326 * @returns {String|Number|Array|Object }
327327 */
328- set : function ( ...args ) {
328+ set ( ...args ) {
329329 const set = ( attrName , value ) => {
330330 switch ( attrName ) {
331331 case 'name' :
@@ -380,7 +380,7 @@ module.exports = function(AV) {
380380 * @param {String } attr an optional metadata key.
381381 * @param {Object } value an optional metadata value.
382382 **/
383- metaData : function ( attr , value ) {
383+ metaData ( attr , value ) {
384384 if ( attr && value ) {
385385 this . attributes . metaData [ attr ] = value ;
386386 return this ;
@@ -401,20 +401,23 @@ module.exports = function(AV) {
401401 * @param {String } fmt 格式,默认为png,也可以为jpeg,gif等格式。
402402 */
403403
404- thumbnailURL : function ( width , height , quality , scaleToFit , fmt ) {
404+ thumbnailURL (
405+ width ,
406+ height ,
407+ quality = 100 ,
408+ scaleToFit = true ,
409+ fmt = 'png'
410+ ) {
405411 const url = this . attributes . url ;
406412 if ( ! url ) {
407413 throw new Error ( 'Invalid url.' ) ;
408414 }
409415 if ( ! width || ! height || width <= 0 || height <= 0 ) {
410416 throw new Error ( 'Invalid width or height value.' ) ;
411417 }
412- quality = quality || 100 ;
413- scaleToFit = ! scaleToFit ? true : scaleToFit ;
414418 if ( quality <= 0 || quality > 100 ) {
415419 throw new Error ( 'Invalid quality value.' ) ;
416420 }
417- fmt = fmt || 'png' ;
418421 const mode = scaleToFit ? 2 : 1 ;
419422 return (
420423 url +
@@ -435,15 +438,15 @@ module.exports = function(AV) {
435438 * Returns the file's size.
436439 * @return {Number } The file's size in bytes.
437440 **/
438- size : function ( ) {
441+ size ( ) {
439442 return this . metaData ( ) . size ;
440443 } ,
441444
442445 /**
443446 * Returns the file's owner.
444447 * @return {String } The file's owner id.
445448 */
446- ownerId : function ( ) {
449+ ownerId ( ) {
447450 return this . metaData ( ) . owner ;
448451 } ,
449452
@@ -453,7 +456,7 @@ module.exports = function(AV) {
453456 * @return {Promise } A promise that is fulfilled when the destroy
454457 * completes.
455458 */
456- destroy : function ( options ) {
459+ destroy ( options ) {
457460 if ( ! this . id ) {
458461 return Promise . reject ( new Error ( 'The file id does not eixst.' ) ) ;
459462 }
@@ -631,7 +634,7 @@ module.exports = function(AV) {
631634 * @return {Promise } A promise that is fulfilled when the fetch
632635 * completes.
633636 */
634- fetch : function ( fetchOptions , options ) {
637+ fetch ( fetchOptions , options ) {
635638 var request = AVRequest (
636639 'files' ,
637640 null ,
@@ -642,7 +645,7 @@ module.exports = function(AV) {
642645 ) ;
643646 return request . then ( this . _finishFetch . bind ( this ) ) ;
644647 } ,
645- _finishFetch : function ( response ) {
648+ _finishFetch ( response ) {
646649 var value = AV . Object . prototype . parse ( response ) ;
647650 value . attributes = {
648651 name : value . name ,
0 commit comments