OpenSlides/client/src/app/shared/models/base/searchable.ts

22 lines
613 B
TypeScript
Raw Normal View History

2018-11-07 08:43:48 +01:00
import { DetailNavigable } from './detail-navigable';
import { SearchRepresentation } from '../../../core/ui-services/search.service';
2018-11-07 08:43:48 +01:00
/**
* Asserts, if the given object is searchable.
*
* @param object The object to check
*/
export function isSearchable(object: any): object is Searchable {
return (<Searchable>object).formatForSearch !== undefined;
}
/**
* One can search for every object implementing this interface.
*/
export interface Searchable extends DetailNavigable {
/**
* Should return strings that represents the object.
*/
formatForSearch: () => SearchRepresentation;
}