Skip to content

Commit fe28d05

Browse files
gingerbenwlemnik
andauthored
Apply suggestions from code review
Co-authored-by: Jason <lemnik@users.noreply.github.com>
1 parent 84f3e8d commit fe28d05

3 files changed

Lines changed: 13 additions & 14 deletions

File tree

packages/plugin-network-instrumentation/lib/should-capture-status-code.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
* Check if a status code should be captured
3-
* @param {number[]} codes - Array of HTTP status codes
4-
* @param {number} statusCode - HTTP status code
5-
* @returns {boolean} True if should be captured
6-
*/
2+
* Check if a status code should be captured
3+
* @param {number[]} codes - Array of HTTP status codes
4+
* @param {number} statusCode - HTTP status code
5+
* @returns {boolean} True if should be captured
6+
*/
77
module.exports = function (codes, statusCode) {
88
return codes.some(code => {
99
if (typeof code === 'number') {

packages/plugin-network-instrumentation/lib/truncate.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
2-
* Truncate string to max length
3-
* @param {string} str - String to truncate
4-
* @param {number} maxLength - Maximum length
5-
* @returns {string} Truncated string
6-
*/
2+
* Truncate string to max length
3+
* @param {string} str - String to truncate
4+
* @param {number} maxLength - Maximum length
5+
* @returns {string} Truncated string
6+
*/
77
module.exports = function (str, maxLength) {
88
if (!str || str.length <= maxLength) return str
99
return str.substring(0, maxLength)

packages/request-tracker/lib/headers-to-object.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ module.exports = function (headers) {
88

99
const obj = {}
1010
if (typeof headers.entries === 'function') {
11-
var iterator = headers.entries()
12-
var entry = iterator.next()
11+
const iterator = headers.entries()
12+
let entry = iterator.next()
1313
while (!entry.done) {
14-
var key = entry.value[0]
15-
var value = entry.value[1]
14+
const [key, value] = entry.value
1615
obj[key] = value
1716
entry = iterator.next()
1817
}

0 commit comments

Comments
 (0)