Download node_modules/axios/lib/core/InterceptorManager.js from khoadang31/uptimerobot: direct link, hf CLI and curl.
- Browser
- Download file 1.36 kB
-
https://huggingface.co/khoadang31/uptimerobot/resolve/main/node_modules/axios/lib/core/InterceptorManager.js
- Command line
-
hf download hf://khoadang31/uptimerobot/node_modules/axios/lib/core/InterceptorManager.js
-
curl -L -o InterceptorManager.js https://huggingface.co/khoadang31/uptimerobot/resolve/main/node_modules/axios/lib/core/InterceptorManager.js
1.36 kB
| ; | |
| var utils = require('./../utils'); | |
| function InterceptorManager() { | |
| this.handlers = []; | |
| } | |
| /** | |
| * Add a new interceptor to the stack | |
| * | |
| * @param {Function} fulfilled The function to handle `then` for a `Promise` | |
| * @param {Function} rejected The function to handle `reject` for a `Promise` | |
| * | |
| * @return {Number} An ID used to remove interceptor later | |
| */ | |
| InterceptorManager.prototype.use = function use(fulfilled, rejected, options) { | |
| this.handlers.push({ | |
| fulfilled: fulfilled, | |
| rejected: rejected, | |
| synchronous: options ? options.synchronous : false, | |
| runWhen: options ? options.runWhen : null | |
| }); | |
| return this.handlers.length - 1; | |
| }; | |
| /** | |
| * Remove an interceptor from the stack | |
| * | |
| * @param {Number} id The ID that was returned by `use` | |
| */ | |
| InterceptorManager.prototype.eject = function eject(id) { | |
| if (this.handlers[id]) { | |
| this.handlers[id] = null; | |
| } | |
| }; | |
| /** | |
| * Iterate over all the registered interceptors | |
| * | |
| * This method is particularly useful for skipping over any | |
| * interceptors that may have become `null` calling `eject`. | |
| * | |
| * @param {Function} fn The function to call for each interceptor | |
| */ | |
| InterceptorManager.prototype.forEach = function forEach(fn) { | |
| utils.forEach(this.handlers, function forEachHandler(h) { | |
| if (h !== null) { | |
| fn(h); | |
| } | |
| }); | |
| }; | |
| module.exports = InterceptorManager; | |