-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added support for fieldNameSize #59
base: master
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
*.DS_Store |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ var RE_ENCODED = /%([a-fA-F0-9]{2})/g; | |
function encodedReplacer(match, byte) { | ||
return String.fromCharCode(parseInt(byte, 16)); | ||
} | ||
function parseParams(str) { | ||
function parseParams(str,fieldNameSize) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. missing space after the comma |
||
var res = [], | ||
state = 'key', | ||
charset = '', | ||
|
@@ -73,7 +73,12 @@ function parseParams(str) { | |
} else if (!inquote && (str[i] === ' ' || str[i] === '\t')) | ||
continue; | ||
} | ||
tmp += str[i]; | ||
|
||
if (state !== 'value' || fieldNameSize === undefined) { | ||
tmp += str[i]; | ||
} else if ( tmp.length < fieldNameSize ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't this be combined with the other two conditions above this? Also the curly braces are dropped for single line blocks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, line 79 could be combined with 77. I had a console.log checks writing out characters here to verify I wasn't truncating the wrong fields. Yes, I can drop the curly braces too. |
||
tmp += str[i]; | ||
} | ||
} | ||
if (charset && tmp.length) { | ||
tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alignment is off here