16 lines
360 B
TypeScript
16 lines
360 B
TypeScript
import { Pipe, PipeTransform } from '@angular/core';
|
|
import omit from 'lodash/omit';
|
|
|
|
@Pipe({
|
|
name: 'object',
|
|
pure: true
|
|
})
|
|
export class ObjectPipe implements PipeTransform {
|
|
|
|
transform(value: object, omitValue: string[] = []): string {
|
|
const res = omit(value, omitValue);
|
|
return res && Object.keys(res).length ? JSON.stringify(res) : '';
|
|
}
|
|
|
|
}
|