@olakai/sdk
Version:
This document demonstrates how to use the Olakai SDK with all its features.
23 lines • 958 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createCustomMiddleware = void 0;
/**
* Create a custom middleware
* This middleware is a generic middleware that can be used to create any middleware.
* @param options - The options for the middleware
* @param options.name - The name of the middleware
* @param options.beforeCall - The function to call before the function is called
* @param options.afterCall - The function to call after the function is called
* @param options.onError - The function to call if the function throws an error. This is useful for error handling.
* @returns A middleware function
*/
const createCustomMiddleware = (options) => {
return {
name: options.name,
beforeCall: options.beforeCall,
afterCall: options.afterCall,
onError: options.onError,
};
};
exports.createCustomMiddleware = createCustomMiddleware;
//# sourceMappingURL=custom.js.map