spongebobmock
Version:
Angular Pipe to alternate between lowercase and uppercase characters.
18 lines (14 loc) • 394 B
text/typescript
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'spongeBobMock'
})
export class SpongeBobMockPipe implements PipeTransform {
transform(value: string): string {
return value.split('').map((x, index) => {
if(index % 2 === 0)
return x.toLowerCase();
else if(index % 2 === 1)
return x.toUpperCase();
}).join('');
}
}