@loopback/docs
Version:
Documentation for LoopBack 4
32 lines (19 loc) • 707 B
Markdown
lang: en
title: 'API docs: context.bindingcomparator'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.context.bindingcomparator.html
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [@loopback/context](./context.md) > [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);
```