This commit is contained in:
insanity
2018-09-12 11:53:28 +09:00
parent f5e98b36dc
commit 57ae73ea43
5 changed files with 28 additions and 7 deletions

View File

@@ -1,2 +1,7 @@
import { ObjectKeys } from "./object-keys";
import { stringPrettify } from "./string-prettify";
export const PIPES = [
ObjectKeys,
stringPrettify
];

View 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);
}
}

View 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);
}
}