mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
19 lines
457 B
TypeScript
19 lines
457 B
TypeScript
import { PipeTransform, Pipe } from '@angular/core';
|
|
|
|
@Pipe({name: 'dsObjectKeys'})
|
|
/**
|
|
* Pipe for parsing all keys of an object to an array of key-value pairs
|
|
*/
|
|
export class ObjectKeysPipe implements PipeTransform {
|
|
|
|
/**
|
|
* @param value An object
|
|
* @returns {any} Array with all keys the input object
|
|
*/
|
|
transform(value, args: string[]): any {
|
|
const keys = [];
|
|
Object.keys(value).forEach((k) => keys.push(k));
|
|
return keys;
|
|
}
|
|
}
|