Permalink
Browse files

Update implementation of the parameters definition.

  • Loading branch information...
1 parent 0711937 commit fecf825920670ff772020427b78a0fd23264aa7c @Math- Math- committed Feb 22, 2012
Showing with 12 additions and 17 deletions.
  1. +12 −17 lib/incoming_form.js
View
29 lib/incoming_form.js
@@ -15,23 +15,18 @@ function IncomingForm(opts) {
opts=opts||{};
- var defParams={
- error: null,
- ended: false,
- maxFieldsSize: 2 * 1024 * 1024,
- keepExtensions: false,
- uploadDir: IncomingForm.UPLOAD_DIR,
- encoding: 'utf-8',
- headers: null,
- type: null,
- bytesReceived: null,
- bytesExpected: null
- }
-
- var self=this;
- Object.keys(defParams).forEach(function(v){
- self[v]=typeof opts[v]!='undefined' ? opts[v] : defParams[v];
- });
+ this.error = null;
+ this.ended = false;
+
+ this.maxFieldsSize = opts.maxFieldsSize || 2 * 1024 * 1024;
+ this.keepExtensions = opts.keepExtensions || false;
+ this.uploadDir = opts.uploadDir || IncomingForm.UPLOAD_DIR;
+ this.encoding = opts.encoding || 'utf-8';
+ this.headers = null;
+ this.type = null;
+
+ this.bytesReceived = null;
+ this.bytesExpected = null;
this._parser = null;
this._flushing = 0;

0 comments on commit fecf825

Please sign in to comment.