2019-11-22 15:39:20 +00:00
|
|
|
import { QuickSearchAction } from "../types";
|
|
|
|
|
|
|
|
export function getActions(actions: QuickSearchAction[]): QuickSearchAction[] {
|
|
|
|
return actions.filter(action => action.type === "action");
|
|
|
|
}
|
|
|
|
export function hasActions(actions: QuickSearchAction[]): boolean {
|
|
|
|
return getActions(actions).length > 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getViews(actions: QuickSearchAction[]): QuickSearchAction[] {
|
|
|
|
return actions.filter(action => action.type === "view");
|
|
|
|
}
|
|
|
|
export function hasViews(actions: QuickSearchAction[]): boolean {
|
|
|
|
return getViews(actions).length > 0;
|
|
|
|
}
|
2019-11-25 11:29:07 +00:00
|
|
|
|
|
|
|
export function getCustomers(
|
|
|
|
actions: QuickSearchAction[]
|
|
|
|
): QuickSearchAction[] {
|
|
|
|
return actions.filter(action => action.type === "customer");
|
|
|
|
}
|
|
|
|
export function hasCustomers(actions: QuickSearchAction[]): boolean {
|
|
|
|
return getCustomers(actions).length > 0;
|
|
|
|
}
|
2019-11-25 14:32:10 +00:00
|
|
|
|
|
|
|
export function getCatalog(actions: QuickSearchAction[]): QuickSearchAction[] {
|
|
|
|
return actions.filter(action => action.type === "catalog");
|
|
|
|
}
|
|
|
|
export function hasCatalog(actions: QuickSearchAction[]): boolean {
|
|
|
|
return getCatalog(actions).length > 0;
|
|
|
|
}
|