MCPcopy Create free account
hub / github.com/nodejs/node / generateKeyValues

Function generateKeyValues

deps/undici/src/lib/mock/mock-utils.js:254–270  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

252}
253
254function generateKeyValues (data) {
255 const keys = Object.keys(data)
256 const result = []
257 for (let i = 0; i < keys.length; ++i) {
258 const key = keys[i]
259 const value = data[key]
260 const name = Buffer.from(`${key}`)
261 if (Array.isArray(value)) {
262 for (let j = 0; j < value.length; ++j) {
263 result.push(name, Buffer.from(`${value[j]}`))
264 }
265 } else {
266 result.push(name, Buffer.from(`${value}`))
267 }
268 }
269 return result
270}
271
272/**
273 * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

Callers 1

handleReplyFunction · 0.85

Calls 3

keysMethod · 0.65
fromMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected