src/lib/delete-identifier.pipe.ts
| Name | deleteIdentifier |
| Standalone | true |
| Public transform | ||||||
transform(value: | null)
|
||||||
|
Defined in src/lib/delete-identifier.pipe.ts:18
|
||||||
Type parameters :
|
||||||
|
Parameters :
Returns :
T | null
|
import {
Pipe,
PipeTransform,
} from '@angular/core';
import {
clone,
getIdentifierProperties,
hasIdentifierProperty,
WithIdentifier,
} from '@rxap/utilities';
@Pipe({
name: 'deleteIdentifier',
standalone: true,
})
export class DeleteIdentifierPipe implements PipeTransform {
public transform<T>(value: (WithIdentifier & T) | null): T | null {
if (!value) {
return value;
}
const copy: any = clone(value);
if (hasIdentifierProperty(copy)) {
for (const pk of getIdentifierProperties(copy)) {
delete copy[pk];
}
}
return copy;
}
}