import { Pipe , PipeTransform } from '@angular/core' ; import * as _ from 'lodash' ; import { TreeviewItem } from './treeview-item' ; @ Pipe ( { name : 'leoTreeview' } ) export class TreeviewPipe implements PipeTransform { transform ( objects , textField ) { if ( _ . isNil ( objects ) ) { return undefined ; } return objects . map ( object => new TreeviewItem ( { text : object [ textField ] , value : object } ) ) ; } }