pipes
This commit is contained in:
@@ -1,2 +1,7 @@
|
||||
import { ObjectKeys } from "./object-keys";
|
||||
import { stringPrettify } from "./string-prettify";
|
||||
|
||||
export const PIPES = [
|
||||
ObjectKeys,
|
||||
stringPrettify
|
||||
];
|
||||
|
||||
8
@overflow/commons/ui/pipe/object-keys.ts
Normal file
8
@overflow/commons/ui/pipe/object-keys.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({ name: 'objectKeys' })
|
||||
export class ObjectKeys implements PipeTransform {
|
||||
transform(value: any, args: any[] = null): any {
|
||||
return Object.keys(value);
|
||||
}
|
||||
}
|
||||
10
@overflow/commons/ui/pipe/string-prettify.ts
Normal file
10
@overflow/commons/ui/pipe/string-prettify.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({ name: 'stringPrettify' })
|
||||
export class stringPrettify implements PipeTransform {
|
||||
transform(value: string): any {
|
||||
value = value.replace('-', ' ');
|
||||
value = value.replace('_', ' ');
|
||||
return value.charAt(0).toUpperCase() + value.slice(1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user