Newer
Older
/**
* This file is part of Anis Client.
*
* @copyright Laboratoire d'Astrophysique de Marseille / CNRS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
import { Pipe, PipeTransform } from '@angular/core';
import { SelectOption } from 'src/app/metamodel/models';
/**
* @class
* @classdesc Returns options corresponding to the given select name.
*
* @example
* // returns options that matching with the select name among the option list
* {{ optionList | optionListBySelect:'search_flag' }}
*/
@Pipe({ name: 'optionListBySelect' })
export class OptionListBySelectPipe implements PipeTransform {
transform(optionList: SelectOption[], selectName: string): SelectOption[] {
return optionList.filter(option => option.select_name === selectName);
}
}