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

Method indexOf

lib/internal/streams/iter/ringbuffer.js:100–107  ·  view source on GitHub ↗

* Find the logical index of `item` (reference equality). O(n). * Returns -1 if not found. * @returns {number}

(item)

Source from the content-addressed store, hash-verified

98 * @returns {number}
99 */
100 indexOf(item) {
101 for (let i = 0; i < this.#size; i++) {
102 if (this.#backing[(this.#head + i) & this.#mask] === item) {
103 return i;
104 }
105 }
106 return -1;
107 }
108
109 /**
110 * Remove the item at logical `index`, shifting later elements. O(n) worst case.

Callers 15

replaceCloseCodeFunction · 0.45
ClientRequestFunction · 0.45
url.jsFile · 0.45
splitEscapedAltNamesFunction · 0.45
bidirectionalIndexOfFunction · 0.45
calculateServerNameFunction · 0.45
_http_agent.jsFile · 0.45
onProxyDataFunction · 0.45
readlineFunction · 0.45
#processRawBufferMethod · 0.45
onAbortFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected