UNPKG

@loopback/docs

Version:

Documentation files rendered at [https://loopback.io](https://loopback.io)

40 lines (25 loc) 1.56 kB
--- lang: en title: 'API docs: context.mergeinterceptors' keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI sidebar: lb4_sidebar editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context permalink: /doc/en/lb4/apidocs.context.mergeinterceptors.html --- <!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [mergeInterceptors](./context.mergeinterceptors.md) ## mergeInterceptors() function Adding interceptors from the spec to the front of existing ones. Duplicate entries are eliminated from the spec side. For example: - \[log\] + \[cache, log\] =<!-- -->&gt; \[cache, log\] - \[log\] + \[log, cache\] =<!-- -->&gt; \[log, cache\] - \[\] + \[cache, log\] =<!-- -->&gt; \[cache, log\] - \[cache, log\] + \[\] =<!-- -->&gt; \[cache, log\] - \[log\] + \[cache\] =<!-- -->&gt; \[log, cache\] <b>Signature:</b> ```typescript export declare function mergeInterceptors(interceptorsFromSpec: InterceptorOrKey[], existingInterceptors: InterceptorOrKey[]): InterceptorOrKey[]; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | interceptorsFromSpec | [InterceptorOrKey](./context.interceptororkey.md)<!-- -->\[\] | Interceptors from <code>@intercept</code> | | existingInterceptors | [InterceptorOrKey](./context.interceptororkey.md)<!-- -->\[\] | Interceptors already applied for the method | <b>Returns:</b> [InterceptorOrKey](./context.interceptororkey.md)<!-- -->\[\]