import { Pipe , PipeTransform } from '@angular/core' ; @ Pipe ( { name : 'sharedProductProperty' } ) export class ProductPropertyPipe implements PipeTransform { param product param names return { any } transform ( product , ... names ) { if ( ! product || ! product . properties ) { return null ; } const properties = product . properties ; let property = null ; names . some ( name => { if ( properties . hasOwnProperty ( name ) ) { property = properties [ name ] ; return true ; } } ) ; return property ; } }