OpenSlides/client/src/app/shared/models/base/searchable.ts
2018-12-13 12:40:51 +01:00

22 lines
610 B
TypeScript

import { DetailNavigable } from './detail-navigable';
import { SearchRepresentation } from '../../../core/services/search.service';
/**
* 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;
}