MCPcopy Index your code
hub / github.com/nodejs/node / set

Method set

deps/undici/undici.js:6228–6252  ·  view source on GitHub ↗
(name, value, filename = void 0)

Source from the content-addressed store, hash-verified

6226 return this.#state.findIndex((entry) => entry.name === name) !== -1;
6227 }
6228 set(name, value, filename = void 0) {
6229 webidl.brandCheck(this, _FormData);
6230 const prefix = "FormData.set";
6231 webidl.argumentLengthCheck(arguments, 2, prefix);
6232 name = webidl.converters.USVString(name);
6233 if (arguments.length === 3 || webidl.is.Blob(value)) {
6234 value = webidl.converters.Blob(value, prefix, "value");
6235 if (filename !== void 0) {
6236 filename = webidl.converters.USVString(filename);
6237 }
6238 } else {
6239 value = webidl.converters.USVString(value);
6240 }
6241 const entry = makeEntry(name, value, filename);
6242 const idx = this.#state.findIndex((entry2) => entry2.name === name);
6243 if (idx !== -1) {
6244 this.#state = [
6245 ...this.#state.slice(0, idx),
6246 entry,
6247 ...this.#state.slice(idx + 1).filter((entry2) => entry2.name !== name)
6248 ];
6249 } else {
6250 this.#state.push(entry);
6251 }
6252 }
6253 [nodeUtil.inspect.custom](depth, options) {
6254 const state = this.#state.reduce((a, b) => {
6255 if (a[b.name]) {

Callers

nothing calls this directly

Calls 7

brandCheckMethod · 0.80
argumentLengthCheckMethod · 0.80
USVStringMethod · 0.80
makeEntryFunction · 0.70
sliceMethod · 0.65
filterMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected