pnpm 7.9.1 → 7.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +22 -7
  2. package/bin/pnpm.cjs +3 -0
  3. package/bin/pnpx.cjs +1 -15
  4. package/dist/node_modules/.modules.yaml +3 -3
  5. package/dist/node_modules/.pnpm/lock.yaml +76 -42
  6. package/dist/node_modules/@npmcli/fs/lib/common/owner-sync.js +96 -0
  7. package/dist/node_modules/@npmcli/fs/lib/common/owner.js +8 -4
  8. package/dist/node_modules/@npmcli/fs/lib/copy-file.js +3 -9
  9. package/dist/node_modules/@npmcli/fs/lib/fs.js +9 -3
  10. package/dist/node_modules/@npmcli/fs/lib/index.js +3 -1
  11. package/dist/node_modules/@npmcli/fs/lib/mkdir.js +19 -0
  12. package/dist/node_modules/@npmcli/fs/lib/mkdtemp.js +3 -8
  13. package/dist/node_modules/@npmcli/fs/lib/with-owner-sync.js +21 -0
  14. package/dist/node_modules/@npmcli/fs/lib/with-owner.js +21 -0
  15. package/dist/node_modules/@npmcli/fs/lib/with-temp-dir.js +4 -2
  16. package/dist/node_modules/@npmcli/fs/lib/write-file.js +3 -8
  17. package/dist/node_modules/@npmcli/fs/package.json +21 -9
  18. package/dist/node_modules/@npmcli/move-file/{index.js → lib/index.js} +50 -27
  19. package/dist/node_modules/@npmcli/move-file/package.json +20 -7
  20. package/dist/node_modules/@tootallnate/once/LICENSE +21 -0
  21. package/dist/node_modules/@tootallnate/once/dist/index.js +21 -36
  22. package/dist/node_modules/@tootallnate/once/dist/index.js.map +1 -1
  23. package/dist/node_modules/@tootallnate/once/dist/overloaded-parameters.js +3 -0
  24. package/dist/node_modules/@tootallnate/once/dist/overloaded-parameters.js.map +1 -0
  25. package/dist/node_modules/@tootallnate/once/dist/types.js +3 -0
  26. package/dist/node_modules/@tootallnate/once/dist/types.js.map +1 -0
  27. package/dist/node_modules/@tootallnate/once/package.json +22 -15
  28. package/dist/node_modules/cacache/lib/content/read.js +99 -102
  29. package/dist/node_modules/cacache/lib/content/rm.js +9 -8
  30. package/dist/node_modules/cacache/lib/content/write.js +67 -67
  31. package/dist/node_modules/cacache/lib/entry-index.js +128 -118
  32. package/dist/node_modules/cacache/{get.js → lib/get.js} +88 -100
  33. package/dist/node_modules/cacache/{index.js → lib/index.js} +5 -6
  34. package/dist/node_modules/cacache/lib/memoization.js +10 -11
  35. package/dist/node_modules/cacache/{put.js → lib/put.js} +23 -26
  36. package/dist/node_modules/cacache/{rm.js → lib/rm.js} +3 -3
  37. package/dist/node_modules/cacache/lib/util/fix-owner.js +41 -38
  38. package/dist/node_modules/cacache/lib/util/move-file.js +36 -47
  39. package/dist/node_modules/cacache/lib/util/tmp.js +5 -7
  40. package/dist/node_modules/cacache/lib/verify.js +160 -190
  41. package/dist/node_modules/cacache/node_modules/brace-expansion/.github/FUNDING.yml +2 -0
  42. package/dist/node_modules/cacache/node_modules/brace-expansion/LICENSE +21 -0
  43. package/dist/node_modules/cacache/node_modules/brace-expansion/index.js +203 -0
  44. package/dist/node_modules/cacache/node_modules/brace-expansion/package.json +46 -0
  45. package/dist/node_modules/cacache/node_modules/glob/LICENSE +15 -0
  46. package/dist/node_modules/cacache/node_modules/glob/common.js +240 -0
  47. package/dist/node_modules/cacache/node_modules/glob/glob.js +790 -0
  48. package/dist/node_modules/cacache/node_modules/glob/package.json +55 -0
  49. package/dist/node_modules/cacache/node_modules/glob/sync.js +486 -0
  50. package/dist/node_modules/cacache/node_modules/minimatch/LICENSE +15 -0
  51. package/dist/node_modules/cacache/node_modules/minimatch/lib/path.js +4 -0
  52. package/dist/node_modules/cacache/node_modules/minimatch/minimatch.js +906 -0
  53. package/dist/node_modules/cacache/node_modules/minimatch/package.json +32 -0
  54. package/dist/node_modules/cacache/package.json +34 -30
  55. package/dist/node_modules/http-proxy-agent/dist/agent.js +3 -3
  56. package/dist/node_modules/http-proxy-agent/dist/agent.js.map +1 -1
  57. package/dist/node_modules/http-proxy-agent/package.json +4 -4
  58. package/dist/node_modules/lru-cache/LICENSE +1 -1
  59. package/dist/node_modules/lru-cache/index.js +921 -247
  60. package/dist/node_modules/lru-cache/package.json +49 -9
  61. package/dist/node_modules/make-fetch-happen/LICENSE +1 -1
  62. package/dist/node_modules/make-fetch-happen/lib/agent.js +34 -14
  63. package/dist/node_modules/make-fetch-happen/lib/cache/entry.js +90 -106
  64. package/dist/node_modules/make-fetch-happen/lib/cache/errors.js +1 -0
  65. package/dist/node_modules/make-fetch-happen/lib/cache/index.js +10 -6
  66. package/dist/node_modules/make-fetch-happen/lib/cache/policy.js +21 -21
  67. package/dist/node_modules/make-fetch-happen/lib/dns.js +49 -0
  68. package/dist/node_modules/make-fetch-happen/lib/fetch.js +40 -22
  69. package/dist/node_modules/make-fetch-happen/lib/index.js +4 -3
  70. package/dist/node_modules/make-fetch-happen/lib/options.js +17 -9
  71. package/dist/node_modules/make-fetch-happen/lib/pipeline.js +41 -0
  72. package/dist/node_modules/make-fetch-happen/lib/remote.js +28 -9
  73. package/dist/node_modules/make-fetch-happen/package.json +36 -33
  74. package/dist/node_modules/minipass-fetch/lib/blob.js +4 -4
  75. package/dist/node_modules/minipass-fetch/lib/body.js +63 -49
  76. package/dist/node_modules/minipass-fetch/lib/fetch-error.js +2 -1
  77. package/dist/node_modules/minipass-fetch/lib/headers.js +38 -21
  78. package/dist/node_modules/minipass-fetch/lib/index.js +130 -106
  79. package/dist/node_modules/minipass-fetch/lib/request.js +46 -28
  80. package/dist/node_modules/minipass-fetch/lib/response.js +3 -2
  81. package/dist/node_modules/minipass-fetch/package.json +27 -14
  82. package/dist/node_modules/node-gyp/.github/workflows/release-please.yml +1 -1
  83. package/dist/node_modules/node-gyp/.github/workflows/tests.yml +16 -9
  84. package/dist/node_modules/node-gyp/.github/workflows/visual-studio.yml +16 -8
  85. package/dist/node_modules/node-gyp/lib/build.js +7 -0
  86. package/dist/node_modules/node-gyp/lib/configure.js +26 -1
  87. package/dist/node_modules/node-gyp/lib/create-config-gypi.js +2 -1
  88. package/dist/node_modules/node-gyp/lib/find-visualstudio.js +9 -8
  89. package/dist/node_modules/node-gyp/lib/node-gyp.js +4 -0
  90. package/dist/node_modules/node-gyp/package.json +4 -4
  91. package/dist/node_modules/semver/node_modules/lru-cache/LICENSE +15 -0
  92. package/dist/node_modules/semver/node_modules/lru-cache/index.js +334 -0
  93. package/dist/node_modules/semver/node_modules/lru-cache/package.json +34 -0
  94. package/dist/node_modules/socks-proxy-agent/dist/index.js +3 -3
  95. package/dist/node_modules/socks-proxy-agent/dist/index.js.map +1 -1
  96. package/dist/node_modules/socks-proxy-agent/package.json +2 -2
  97. package/dist/node_modules/ssri/{index.js → lib/index.js} +78 -24
  98. package/dist/node_modules/ssri/package.json +27 -16
  99. package/dist/pnpm.cjs +67042 -65886
  100. package/package.json +6 -6
  101. package/dist/node_modules/@npmcli/fs/lib/common/file-url-to-path/index.js +0 -17
  102. package/dist/node_modules/@npmcli/fs/lib/common/file-url-to-path/polyfill.js +0 -121
  103. package/dist/node_modules/@npmcli/fs/lib/mkdir/index.js +0 -32
  104. package/dist/node_modules/@npmcli/fs/lib/mkdir/polyfill.js +0 -81
  105. package/dist/node_modules/cacache/lib/util/disposer.js +0 -30
  106. package/dist/node_modules/cacache/ls.js +0 -6
  107. package/dist/node_modules/cacache/verify.js +0 -3
  108. package/dist/node_modules/minipass-fetch/index.js +0 -1
@@ -3,7 +3,7 @@ const Minipass = require('minipass')
3
3
  const MinipassSized = require('minipass-sized')
4
4
 
5
5
  const Blob = require('./blob.js')
6
- const {BUFFER} = Blob
6
+ const { BUFFER } = Blob
7
7
  const FetchError = require('./fetch-error.js')
8
8
 
9
9
  // optional dependency on 'encoding'
@@ -24,10 +24,10 @@ class Body {
24
24
  : Buffer.isBuffer(bodyArg) ? bodyArg
25
25
  : Object.prototype.toString.call(bodyArg) === '[object ArrayBuffer]'
26
26
  ? Buffer.from(bodyArg)
27
- : ArrayBuffer.isView(bodyArg)
28
- ? Buffer.from(bodyArg.buffer, bodyArg.byteOffset, bodyArg.byteLength)
29
- : Minipass.isStream(bodyArg) ? bodyArg
30
- : Buffer.from(String(bodyArg))
27
+ : ArrayBuffer.isView(bodyArg)
28
+ ? Buffer.from(bodyArg.buffer, bodyArg.byteOffset, bodyArg.byteLength)
29
+ : Minipass.isStream(bodyArg) ? bodyArg
30
+ : Buffer.from(String(bodyArg))
31
31
 
32
32
  this[INTERNALS] = {
33
33
  body,
@@ -94,28 +94,32 @@ class Body {
94
94
  }
95
95
 
96
96
  [CONSUME_BODY] () {
97
- if (this[INTERNALS].disturbed)
97
+ if (this[INTERNALS].disturbed) {
98
98
  return Promise.reject(new TypeError(`body used already for: ${
99
99
  this.url}`))
100
+ }
100
101
 
101
102
  this[INTERNALS].disturbed = true
102
103
 
103
- if (this[INTERNALS].error)
104
+ if (this[INTERNALS].error) {
104
105
  return Promise.reject(this[INTERNALS].error)
106
+ }
105
107
 
106
108
  // body is null
107
109
  if (this.body === null) {
108
110
  return Promise.resolve(Buffer.alloc(0))
109
111
  }
110
112
 
111
- if (Buffer.isBuffer(this.body))
113
+ if (Buffer.isBuffer(this.body)) {
112
114
  return Promise.resolve(this.body)
115
+ }
113
116
 
114
117
  const upstream = isBlob(this.body) ? this.body.stream() : this.body
115
118
 
116
119
  /* istanbul ignore if: should never happen */
117
- if (!Minipass.isStream(upstream))
120
+ if (!Minipass.isStream(upstream)) {
118
121
  return Promise.resolve(Buffer.alloc(0))
122
+ }
119
123
 
120
124
  const stream = this.size && upstream instanceof MinipassSized ? upstream
121
125
  : !this.size && upstream instanceof Minipass &&
@@ -123,8 +127,10 @@ class Body {
123
127
  : this.size ? new MinipassSized({ size: this.size })
124
128
  : new Minipass()
125
129
 
126
- // allow timeout on slow response body
127
- const resTimeout = this.timeout ? setTimeout(() => {
130
+ // allow timeout on slow response body, but only if the stream is still writable. this
131
+ // makes the timeout center on the socket stream from lib/index.js rather than the
132
+ // intermediary minipass stream we create to receive the data
133
+ const resTimeout = this.timeout && stream.writable ? setTimeout(() => {
128
134
  stream.emit('error', new FetchError(
129
135
  `Response timeout while trying to fetch ${
130
136
  this.url} (over ${this.timeout}ms)`, 'body-timeout'))
@@ -132,7 +138,7 @@ class Body {
132
138
 
133
139
  // do not keep the process open just for this timeout, even
134
140
  // though we expect it'll get cleared eventually.
135
- if (resTimeout) {
141
+ if (resTimeout && resTimeout.unref) {
136
142
  resTimeout.unref()
137
143
  }
138
144
 
@@ -152,21 +158,23 @@ class Body {
152
158
  }).catch(er => {
153
159
  clearTimeout(resTimeout)
154
160
  // request was aborted, reject with this Error
155
- if (er.name === 'AbortError' || er.name === 'FetchError')
161
+ if (er.name === 'AbortError' || er.name === 'FetchError') {
156
162
  throw er
157
- else if (er.name === 'RangeError')
163
+ } else if (er.name === 'RangeError') {
158
164
  throw new FetchError(`Could not create Buffer from response body for ${
159
165
  this.url}: ${er.message}`, 'system', er)
160
- else
166
+ } else {
161
167
  // other errors, such as incorrect content-encoding or content-length
162
168
  throw new FetchError(`Invalid response body while trying to fetch ${
163
169
  this.url}: ${er.message}`, 'system', er)
170
+ }
164
171
  })
165
172
  }
166
173
 
167
174
  static clone (instance) {
168
- if (instance.bodyUsed)
175
+ if (instance.bodyUsed) {
169
176
  throw new Error('cannot clone body after it is used')
177
+ }
170
178
 
171
179
  const body = instance.body
172
180
 
@@ -190,8 +198,9 @@ class Body {
190
198
  // set instance body to one fork, return the other
191
199
  instance[INTERNALS].body = p1
192
200
  return p2
193
- } else
201
+ } else {
194
202
  return instance.body
203
+ }
195
204
  }
196
205
 
197
206
  static extractContentType (body) {
@@ -199,38 +208,38 @@ class Body {
199
208
  : typeof body === 'string' ? 'text/plain;charset=UTF-8'
200
209
  : isURLSearchParams(body)
201
210
  ? 'application/x-www-form-urlencoded;charset=UTF-8'
202
- : isBlob(body) ? body.type || null
203
- : Buffer.isBuffer(body) ? null
204
- : Object.prototype.toString.call(body) === '[object ArrayBuffer]' ? null
205
- : ArrayBuffer.isView(body) ? null
206
- : typeof body.getBoundary === 'function'
207
- ? `multipart/form-data;boundary=${body.getBoundary()}`
208
- : Minipass.isStream(body) ? null
209
- : 'text/plain;charset=UTF-8'
211
+ : isBlob(body) ? body.type || null
212
+ : Buffer.isBuffer(body) ? null
213
+ : Object.prototype.toString.call(body) === '[object ArrayBuffer]' ? null
214
+ : ArrayBuffer.isView(body) ? null
215
+ : typeof body.getBoundary === 'function'
216
+ ? `multipart/form-data;boundary=${body.getBoundary()}`
217
+ : Minipass.isStream(body) ? null
218
+ : 'text/plain;charset=UTF-8'
210
219
  }
211
220
 
212
221
  static getTotalBytes (instance) {
213
- const {body} = instance
222
+ const { body } = instance
214
223
  return (body === null || body === undefined) ? 0
215
- : isBlob(body) ? body.size
216
- : Buffer.isBuffer(body) ? body.length
217
- : body && typeof body.getLengthSync === 'function' && (
224
+ : isBlob(body) ? body.size
225
+ : Buffer.isBuffer(body) ? body.length
226
+ : body && typeof body.getLengthSync === 'function' && (
218
227
  // detect form data input from form-data module
219
228
  body._lengthRetrievers &&
220
- /* istanbul ignore next */ body._lengthRetrievers.length == 0 || // 1.x
229
+ /* istanbul ignore next */ body._lengthRetrievers.length === 0 || // 1.x
221
230
  body.hasKnownLength && body.hasKnownLength()) // 2.x
222
- ? body.getLengthSync()
223
- : null
231
+ ? body.getLengthSync()
232
+ : null
224
233
  }
225
234
 
226
235
  static writeToStream (dest, instance) {
227
- const {body} = instance
236
+ const { body } = instance
228
237
 
229
- if (body === null || body === undefined)
238
+ if (body === null || body === undefined) {
230
239
  dest.end()
231
- else if (Buffer.isBuffer(body) || typeof body === 'string')
240
+ } else if (Buffer.isBuffer(body) || typeof body === 'string') {
232
241
  dest.end(body)
233
- else {
242
+ } else {
234
243
  // body is stream or blob
235
244
  const stream = isBlob(body) ? body.stream() : body
236
245
  stream.on('error', er => dest.emit('error', er)).pipe(dest)
@@ -246,10 +255,9 @@ Object.defineProperties(Body.prototype, {
246
255
  arrayBuffer: { enumerable: true },
247
256
  blob: { enumerable: true },
248
257
  json: { enumerable: true },
249
- text: { enumerable: true }
258
+ text: { enumerable: true },
250
259
  })
251
260
 
252
-
253
261
  const isURLSearchParams = obj =>
254
262
  // Duck-typing as a necessary condition.
255
263
  (typeof obj !== 'object' ||
@@ -274,26 +282,28 @@ const isBlob = obj =>
274
282
  /^(Blob|File)$/.test(obj.constructor.name) &&
275
283
  /^(Blob|File)$/.test(obj[Symbol.toStringTag])
276
284
 
277
-
278
285
  const convertBody = (buffer, headers) => {
279
286
  /* istanbul ignore if */
280
- if (typeof convert !== 'function')
287
+ if (typeof convert !== 'function') {
281
288
  throw new Error('The package `encoding` must be installed to use the textConverted() function')
289
+ }
282
290
 
283
291
  const ct = headers && headers.get('content-type')
284
292
  let charset = 'utf-8'
285
- let res, str
293
+ let res
286
294
 
287
295
  // header
288
- if (ct)
296
+ if (ct) {
289
297
  res = /charset=([^;]*)/i.exec(ct)
298
+ }
290
299
 
291
300
  // no charset in content type, peek at response body for at most 1024 bytes
292
- str = buffer.slice(0, 1024).toString()
301
+ const str = buffer.slice(0, 1024).toString()
293
302
 
294
303
  // html5
295
- if (!res && str)
304
+ if (!res && str) {
296
305
  res = /<meta.+?charset=(['"])(.+?)\1/i.exec(str)
306
+ }
297
307
 
298
308
  // html4
299
309
  if (!res && str) {
@@ -301,17 +311,20 @@ const convertBody = (buffer, headers) => {
301
311
 
302
312
  if (!res) {
303
313
  res = /<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(str)
304
- if (res)
305
- res.pop() // drop last quote
314
+ if (res) {
315
+ res.pop()
316
+ } // drop last quote
306
317
  }
307
318
 
308
- if (res)
319
+ if (res) {
309
320
  res = /charset=(.*)/i.exec(res.pop())
321
+ }
310
322
  }
311
323
 
312
324
  // xml
313
- if (!res && str)
325
+ if (!res && str) {
314
326
  res = /<\?xml.+?encoding=(['"])(.+?)\1/i.exec(str)
327
+ }
315
328
 
316
329
  // found charset
317
330
  if (res) {
@@ -319,8 +332,9 @@ const convertBody = (buffer, headers) => {
319
332
 
320
333
  // prevent decode issues when sites use incorrect encoding
321
334
  // ref: https://hsivonen.fi/encoding-menu/
322
- if (charset === 'gb2312' || charset === 'gbk')
335
+ if (charset === 'gb2312' || charset === 'gbk') {
323
336
  charset = 'gb18030'
337
+ }
324
338
  }
325
339
 
326
340
  // turn raw buffers into a single utf-8 buffer
@@ -5,8 +5,9 @@ class FetchError extends Error {
5
5
  this.code = 'FETCH_ERROR'
6
6
 
7
7
  // pick up code, expected, path, ...
8
- if (systemError)
8
+ if (systemError) {
9
9
  Object.assign(this, systemError)
10
+ }
10
11
 
11
12
  this.errno = this.code
12
13
 
@@ -1,24 +1,27 @@
1
1
  'use strict'
2
- const invalidTokenRegex = /[^\^_`a-zA-Z\-0-9!#$%&'*+.|~]/
2
+ const invalidTokenRegex = /[^^_`a-zA-Z\-0-9!#$%&'*+.|~]/
3
3
  const invalidHeaderCharRegex = /[^\t\x20-\x7e\x80-\xff]/
4
4
 
5
5
  const validateName = name => {
6
6
  name = `${name}`
7
- if (invalidTokenRegex.test(name) || name === '')
7
+ if (invalidTokenRegex.test(name) || name === '') {
8
8
  throw new TypeError(`${name} is not a legal HTTP header name`)
9
+ }
9
10
  }
10
11
 
11
12
  const validateValue = value => {
12
13
  value = `${value}`
13
- if (invalidHeaderCharRegex.test(value))
14
+ if (invalidHeaderCharRegex.test(value)) {
14
15
  throw new TypeError(`${value} is not a legal HTTP header value`)
16
+ }
15
17
  }
16
18
 
17
19
  const find = (map, name) => {
18
20
  name = name.toLowerCase()
19
21
  for (const key in map) {
20
- if (key.toLowerCase() === name)
22
+ if (key.toLowerCase() === name) {
21
23
  return key
24
+ }
22
25
  }
23
26
  return undefined
24
27
  }
@@ -39,25 +42,29 @@ class Headers {
39
42
  }
40
43
 
41
44
  // no-op
42
- if (init === undefined || init === null)
45
+ if (init === undefined || init === null) {
43
46
  return
47
+ }
44
48
 
45
49
  if (typeof init === 'object') {
46
50
  const method = init[Symbol.iterator]
47
51
  if (method !== null && method !== undefined) {
48
- if (typeof method !== 'function')
52
+ if (typeof method !== 'function') {
49
53
  throw new TypeError('Header pairs must be iterable')
54
+ }
50
55
 
51
56
  // sequence<sequence<ByteString>>
52
57
  // Note: per spec we have to first exhaust the lists then process them
53
58
  const pairs = []
54
59
  for (const pair of init) {
55
60
  if (typeof pair !== 'object' ||
56
- typeof pair[Symbol.iterator] !== 'function')
61
+ typeof pair[Symbol.iterator] !== 'function') {
57
62
  throw new TypeError('Each header pair must be iterable')
63
+ }
58
64
  const arrPair = Array.from(pair)
59
- if (arrPair.length !== 2)
65
+ if (arrPair.length !== 2) {
60
66
  throw new TypeError('Each header pair must be a name/value tuple')
67
+ }
61
68
  pairs.push(arrPair)
62
69
  }
63
70
 
@@ -70,16 +77,18 @@ class Headers {
70
77
  this.append(key, init[key])
71
78
  }
72
79
  }
73
- } else
80
+ } else {
74
81
  throw new TypeError('Provided initializer must be an object')
82
+ }
75
83
  }
76
84
 
77
85
  get (name) {
78
86
  name = `${name}`
79
87
  validateName(name)
80
88
  const key = find(this[MAP], name)
81
- if (key === undefined)
89
+ if (key === undefined) {
82
90
  return null
91
+ }
83
92
 
84
93
  return this[MAP][key].join(', ')
85
94
  }
@@ -109,10 +118,11 @@ class Headers {
109
118
  validateName(name)
110
119
  validateValue(value)
111
120
  const key = find(this[MAP], name)
112
- if (key !== undefined)
121
+ if (key !== undefined) {
113
122
  this[MAP][key].push(value)
114
- else
123
+ } else {
115
124
  this[MAP][name] = [value]
125
+ }
116
126
  }
117
127
 
118
128
  has (name) {
@@ -125,8 +135,9 @@ class Headers {
125
135
  name = `${name}`
126
136
  validateName(name)
127
137
  const key = find(this[MAP], name)
128
- if (key !== undefined)
138
+ if (key !== undefined) {
129
139
  delete this[MAP][key]
140
+ }
130
141
  }
131
142
 
132
143
  raw () {
@@ -141,7 +152,7 @@ class Headers {
141
152
  return new HeadersIterator(this, 'value')
142
153
  }
143
154
 
144
- [Symbol.iterator]() {
155
+ [Symbol.iterator] () {
145
156
  return new HeadersIterator(this, 'key+value')
146
157
  }
147
158
 
@@ -159,8 +170,9 @@ class Headers {
159
170
  // http.request() only supports string as Host header. This hack makes
160
171
  // specifying custom Host header possible.
161
172
  const hostHeaderKey = find(headers[MAP], 'Host')
162
- if (hostHeaderKey !== undefined)
173
+ if (hostHeaderKey !== undefined) {
163
174
  obj[hostHeaderKey] = obj[hostHeaderKey][0]
175
+ }
164
176
 
165
177
  return obj
166
178
  }
@@ -168,21 +180,25 @@ class Headers {
168
180
  static createHeadersLenient (obj) {
169
181
  const headers = new Headers()
170
182
  for (const name of Object.keys(obj)) {
171
- if (invalidTokenRegex.test(name))
183
+ if (invalidTokenRegex.test(name)) {
172
184
  continue
185
+ }
173
186
 
174
187
  if (Array.isArray(obj[name])) {
175
188
  for (const val of obj[name]) {
176
- if (invalidHeaderCharRegex.test(val))
189
+ if (invalidHeaderCharRegex.test(val)) {
177
190
  continue
191
+ }
178
192
 
179
- if (headers[MAP][name] === undefined)
193
+ if (headers[MAP][name] === undefined) {
180
194
  headers[MAP][name] = [val]
181
- else
195
+ } else {
182
196
  headers[MAP][name].push(val)
197
+ }
183
198
  }
184
- } else if (!invalidHeaderCharRegex.test(obj[name]))
199
+ } else if (!invalidHeaderCharRegex.test(obj[name])) {
185
200
  headers[MAP][name] = [obj[name]]
201
+ }
186
202
  }
187
203
  return headers
188
204
  }
@@ -224,8 +240,9 @@ class HeadersIterator {
224
240
 
225
241
  next () {
226
242
  /* istanbul ignore if: should be impossible */
227
- if (!this || Object.getPrototypeOf(this) !== HeadersIterator.prototype)
243
+ if (!this || Object.getPrototypeOf(this) !== HeadersIterator.prototype) {
228
244
  throw new TypeError('Value of `this` is not a HeadersIterator')
245
+ }
229
246
 
230
247
  const { target, kind, index } = this[INTERNAL]
231
248
  const values = getHeaders(target, kind)