---
lang: en
title: 'API docs: context.filterbykey'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/strongloop/loopback-next/tree/master/packages/context
permalink: /doc/en/lb4/apidocs.context.filterbykey.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [filterByKey](./context.filterbykey.md)

## filterByKey() function

Create a binding filter from key pattern

<b>Signature:</b>

```typescript
export declare function filterByKey(keyPattern?: string | RegExp | BindingFilter): BindingFilter;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  keyPattern | string \| RegExp \| [BindingFilter](./context.bindingfilter.md) | Binding key/wildcard, regexp, or a filter function |

<b>Returns:</b>

[BindingFilter](./context.bindingfilter.md)


