hasIndex
The hasIndex
method returns a boolean indicating whether a given Index
exists in the Indexes
object.
hasIndex(indexId: string): boolean
Type | Description | |
---|---|---|
indexId | string | |
returns | boolean |
Example
This example shows two simple Index
existence checks.
import {createIndexes, createStore} from 'tinybase';
const indexes = createIndexes(createStore());
indexes.setIndexDefinition('bySpecies', 'pets', 'species');
console.log(indexes.hasIndex('bySpecies'));
// -> true
console.log(indexes.hasIndex('byColor'));
// -> false
Since
v1.0.0