Permalink
Browse files

de-linting

  • Loading branch information...
1 parent 9ca2b4d commit 31c2c3f2808365f988724f24b6f13926f4dc89da @OrangeDog committed Jul 13, 2012
Showing with 8 additions and 7 deletions.
  1. +4 −3 lib/incoming_form.js
  2. +4 −4 lib/multipart_parser.js
View
@@ -11,7 +11,7 @@ var util = require('./util'),
Stream = require('stream').Stream;
function IncomingForm(opts) {
- if (!(this instanceof IncomingForm)) return new IncomingForm;
+ if (!(this instanceof IncomingForm)) return new IncomingForm(opts);
EventEmitter.call(this);
opts=opts||{};
@@ -33,6 +33,7 @@ function IncomingForm(opts) {
this._parser = null;
this._flushing = 0;
this._fieldsSize = 0;
+ return this;
@felixge

felixge Jul 13, 2012

Why? That's implicit in JS, no?

@OrangeDog

OrangeDog Jul 13, 2012

Owner

"function has inconsistent return points" was the warning

@felixge

felixge Jul 13, 2012

"I don't give a shit" would be my reply : p. (I see the point, I just don't agree with it).

@OrangeDog

OrangeDog Jul 13, 2012

Owner

That's cool. I'll just do the line 14 fix and remove the rest from the Pull if you want.

};
util.inherits(IncomingForm, EventEmitter);
exports.IncomingForm = IncomingForm;
@@ -336,7 +337,7 @@ IncomingForm.prototype._initMultipart = function(boundary) {
};
IncomingForm.prototype._fileName = function(headerValue) {
- var m = headerValue.match(/filename="(.*?)"($|; )/i)
+ var m = headerValue.match(/filename="(.*?)"($|; )/i);
if (!m) return;
var filename = m[1].substr(m[1].lastIndexOf('\\') + 1);
@@ -373,7 +374,7 @@ IncomingForm.prototype._uploadPath = function(filename) {
if (this.keepExtensions) {
var ext = path.extname(filename);
- ext = ext.replace(/(\.[a-z0-9]+).*/, '$1')
+ ext = ext.replace(/(\.[a-z0-9]+).*/, '$1');
name += ext;
}
View
@@ -13,13 +13,13 @@ var Buffer = require('buffer').Buffer,
PART_DATA_START: s++,
PART_DATA: s++,
PART_END: s++,
- END: s++,
+ END: s++
},
@felixge

felixge Jul 13, 2012

I like my trailing commas. They make it easier to edit and re-arrange things later.

@OrangeDog

OrangeDog Jul 13, 2012

Owner

I like warning-free code. Feel free to put them back, I don't really mind - and it's my fault anyway for using a strict IDE.

@felixge

felixge Jul 13, 2012

I also like warning free code. But I don't agree with the rules JSLint tries to enforce.

Either way, I merged it as I'd rather have the rest of your improvements (like the missing semicolons) as quick as possible : ).

f = 1,
F =
{ PART_BOUNDARY: f,
- LAST_BOUNDARY: f *= 2,
+ LAST_BOUNDARY: f *= 2
},
LF = 10,
@@ -34,7 +34,7 @@ var Buffer = require('buffer').Buffer,
return c | 0x20;
};
-for (var s in S) {
+for (s in S) {
exports[s] = S[s];
}
@@ -207,7 +207,7 @@ MultipartParser.prototype.write = function(buffer) {
state = S.PART_DATA_START;
break;
case S.PART_DATA_START:
- state = S.PART_DATA
+ state = S.PART_DATA;
mark('partData');
case S.PART_DATA:
prevIndex = index;

0 comments on commit 31c2c3f

Please sign in to comment.