2020-07-13 10:52:10 +02:00
|
|
|
import { Pipe, PipeTransform } from '@angular/core';
|
2020-07-30 14:23:51 +02:00
|
|
|
import omit from 'lodash/omit';
|
2020-07-13 10:52:10 +02:00
|
|
|
|
|
|
|
@Pipe({
|
2020-07-22 10:45:34 +02:00
|
|
|
name: 'object',
|
|
|
|
pure: true
|
2020-07-13 10:52:10 +02:00
|
|
|
})
|
|
|
|
export class ObjectPipe implements PipeTransform {
|
|
|
|
|
2020-07-30 14:23:51 +02:00
|
|
|
transform(value: object, omitValue: string[] = []): string {
|
|
|
|
const res = omit(value, omitValue);
|
2020-07-27 17:52:03 +02:00
|
|
|
return res && Object.keys(res).length ? JSON.stringify(res) : '';
|
2020-07-13 10:52:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|