@loopback/docs
Version:
Documentation for LoopBack 4
39 lines (24 loc) • 1.4 kB
Markdown
---
lang: en
title: 'API docs: context.mergeinterceptors'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.context.mergeinterceptors.html
---
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/context](./context.md) > [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\] =<!-- -->> \[cache, log\] - \[log\] + \[log, cache\] =<!-- -->> \[log, cache\] - \[\] + \[cache, log\] =<!-- -->> \[cache, log\] - \[cache, log\] + \[\] =<!-- -->> \[cache, log\] - \[log\] + \[cache\] =<!-- -->> \[log, cache\]
<b>Signature:</b>
```typescript
export declare function mergeInterceptors(interceptorsFromSpec: InterceptorOrKey[], existingInterceptors: InterceptorOrKey[]): GenericInterceptorOrKey<InvocationContext>[];
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| interceptorsFromSpec | <code>InterceptorOrKey[]</code> | Interceptors from <code>@intercept</code> |
| existingInterceptors | <code>InterceptorOrKey[]</code> | Interceptors already applied for the method |
<b>Returns:</b>
`GenericInterceptorOrKey<InvocationContext>[]`