Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf27f2ce

Browse files
perf: refactorparameterCount to optimize performance (#591)
Co-authored-by: Ulises Gascón <ulisesgascongonzalez@gmail.com>
1 parentccad155 commitf27f2ce

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

‎lib/types/urlencoded.js‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -208,19 +208,9 @@ function getCharset (req) {
208208
*/
209209

210210
functionparameterCount(body,limit){
211-
varcount=0
212-
varindex=0
211+
varlen=body.split('&').length
213212

214-
while((index=body.indexOf('&',index))!==-1){
215-
count++
216-
index++
217-
218-
if(count===limit){
219-
returnundefined
220-
}
221-
}
222-
223-
returncount
213+
returnlen>limit ?undefined :len-1
224214
}
225215

226216
/**

‎package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
"lint":"eslint .",
4545
"test":"mocha --reporter spec --check-leaks test/",
4646
"test-ci":"nyc --reporter=lcovonly --reporter=text npm test",
47-
4847
"test-cov":"nyc --reporter=html --reporter=text npm test"
4948
}
5049
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp