definma-ui/src/app/exists.pipe.ts

15 lines
309 B
TypeScript
Raw Normal View History

2020-07-22 10:45:34 +02:00
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'exists',
pure: true
})
export class ExistsPipe implements PipeTransform {
transform(value: unknown, key?): unknown {
// console.log(new Date().getTime());
return value || value === 0 ? (key ? value[key] : value) : '';
}
}