src/resource/resource-refs.pipe.ts
Returns a list (ResourceRefs) that match either the ID or the Name specified in the filter.
Supports Regular Expressions.
name | arResourceRefs |
transform | ||||||||||||
transform(refs: ResourceRefs, target: IRefFilter)
|
||||||||||||
Defined in src/resource/resource-refs.pipe.ts:15
|
||||||||||||
Parameters :
Returns :
ResourceRefs
|
import { Pipe, PipeTransform } from '@angular/core';
import { ResourceRefs } from '../models/index';
import { IRefFilter } from './ref-filter';
/**
* Returns a list (ResourceRefs) that match either the ID or the Name specified
* in the filter.
*
* Supports Regular Expressions.
*/
@Pipe({name: 'arResourceRefs'})
export class ResourceRefsPipe implements PipeTransform {
transform(refs: ResourceRefs, target: IRefFilter): ResourceRefs {
let id = new RegExp(target.id || '.*');
let name = new RegExp(target.name || '.*');
return refs.filter(r => {
return (id.test(r.id) && name.test(r.name));
});
}
}