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

Method bind

lib/async_hooks.js:250–272  ·  view source on GitHub ↗
(fn, thisArg)

Source from the content-addressed store, hash-verified

248 }
249
250 bind(fn, thisArg) {
251 validateFunction(fn, 'fn');
252 let bound;
253 if (thisArg === undefined) {
254 const resource = this;
255 bound = function(...args) {
256 ArrayPrototypeUnshift(args, fn, this);
257 return ReflectApply(resource.runInAsyncScope, resource, args);
258 };
259 } else {
260 bound = FunctionPrototypeBind(this.runInAsyncScope, this, fn, thisArg);
261 }
262 ObjectDefineProperties(bound, {
263 'length': {
264 __proto__: null,
265 configurable: true,
266 enumerable: false,
267 value: fn.length,
268 writable: false,
269 },
270 });
271 return bound;
272 }
273
274 static bind(fn, type, thisArg) {
275 type ||= fn.name;

Callers 15

requestMethod · 0.95
constructorMethod · 0.45
internalConnectFunction · 0.45
internalConnectMultipleFunction · 0.45
createServerHandleFunction · 0.45
_http_outgoing.jsFile · 0.45
dgram.jsFile · 0.45
zlib.jsFile · 0.45
_onceWrapFunction · 0.45
setupConnectionsTrackingFunction · 0.45
parserOnIncomingFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected