Skip to content

Instantly share code, notes, and snippets.

@junqueira
Created March 24, 2017 11:42
Show Gist options
  • Save junqueira/3ebe206fe46c6a63a2da092f58655821 to your computer and use it in GitHub Desktop.
Save junqueira/3ebe206fe46c6a63a2da092f58655821 to your computer and use it in GitHub Desktop.
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'cep' })
export class CepPipe implements PipeTransform {
transform(value: string): string {
return value.substr(0, 5) + '-' + value.substr(5, 3);
}
}
@Pipe({ name: 'iterable', pure: false })
export class IterableMapPipe implements PipeTransform {
transform(value: Map<any, any>, args: any[] = null): any {
const lista = [];
value.forEach((value, key) => lista.push(value));
return lista;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment