Skip to content

Commit 450d885

Browse files
committed
style: fix some linting alerts
1 parent 6940bc9 commit 450d885

File tree

5 files changed

+22
-24
lines changed

5 files changed

+22
-24
lines changed

src/file.js

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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,

src/object.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ module.exports = function(AV) {
462462
* @private
463463
*/
464464
_cancelSave: function() {
465-
var self = this;
466465
var failedChanges = _.first(this._opSetQueue);
467466
this._opSetQueue = _.rest(this._opSetQueue);
468467
var nextChanges = _.first(this._opSetQueue);
@@ -728,7 +727,6 @@ module.exports = function(AV) {
728727

729728
options.changes = {};
730729
var escaped = this._escapedAttributes;
731-
var prev = this._previousAttributes || {};
732730

733731
// Update attributes.
734732
AV._arrayEach(_.keys(attrs), function(attr) {
@@ -984,7 +982,7 @@ module.exports = function(AV) {
984982
* @see AVError
985983
*/
986984
save: function(arg1, arg2, arg3) {
987-
var i, attrs, current, options, saved;
985+
var attrs, current, options;
988986
if (_.isObject(arg1) || isNullOrUndefined(arg1)) {
989987
attrs = arg1;
990988
options = arg2;
@@ -1720,7 +1718,6 @@ module.exports = function(AV) {
17201718
var method = object.id ? 'PUT' : 'POST';
17211719

17221720
var json = object._getSaveJSON();
1723-
var query = {};
17241721

17251722
_.extend(json, object._flags);
17261723

src/promise.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
var _ = require('underscore');
21
var Promise = require('es6-promise').Promise;
32

43
Promise._continueWhile = function(predicate, asyncFunction) {

src/user.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ module.exports = function(AV) {
497497
* @see AV.Object#save
498498
*/
499499
save: function(arg1, arg2, arg3) {
500-
var i, attrs, current, options, saved;
500+
var attrs, options;
501501
if (_.isObject(arg1) || _.isNull(arg1) || _.isUndefined(arg1)) {
502502
attrs = arg1;
503503
options = arg2;

src/utils/localstorage-browser.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
var _ = require('underscore');
2-
var Promise = require('../promise');
32

43
// interface Storage {
54
// readonly attribute boolean async;

0 commit comments

Comments
 (0)