defaultFilter

Commons
stable

Case-insensitive substring search. Returns the index of the query inside the stringified value, or -1 when there is no match or either argument is null.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

value
required
string | number
The item value to search within. Converted to lowercase string before comparison.
query
required
string | number
The search term. Converted to lowercase string before comparison.

API

Return value

The value returned by this util.

The index of the first occurrence of query in value (locale-insensitive), or -1 when not found or when either argument is null.

Usage

Examples

Ready-to-paste usage snippets.

Substring match

typescript