---
lang: en
title: 'API docs: context.bindingcomparator'
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.bindingcomparator.html
---

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

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [BindingComparator](./context.bindingcomparator.md)

## BindingComparator interface

Compare function to sort an array of bindings. It is used by `Array.prototype.sort()`<!-- -->.

<b>Signature:</b>

```typescript
export interface BindingComparator 
```

## Example


```ts
const compareByKey: BindingComparator = (a, b) => a.key.localeCompare(b.key);
```


