Page Contents

Home > @loopback/context > Context > find

Context.find() method

Find bindings using a key pattern or filter function

Signature:

find<ValueType = BoundValue>(pattern?: string | RegExp | BindingFilter): Readonly<Binding<ValueType>>[];

Parameters

Parameter Type Description
pattern string \| RegExp \| [BindingFilter](/doc/en/lb4/apidocs.context.bindingfilter.html) _(Optional)_ A filter function, a regexp or a wildcard pattern with optional `*` and `?`. Find returns such bindings where the key matches the provided pattern. For a wildcard: - `*` matches zero or more characters except `.` and `:` - `?` matches exactly one character except `.` and `:` For a filter function: - return `true` to include the binding in the results - return `false` to exclude it.

Returns:

Readonly<Binding<ValueType>>[]