ng-pipes
ng-pipes copied to clipboard
Pipe aliases
In recent events the SnakeCasePipe
is renamed to UnderscorePipe
(https://github.com/a8m/ng-pipes/commit/a103dd8b3bd15a64aaa0850b23cbb1a6d1afc944).
In my opinion the name SnakeCasePipe
makes a lot of sense.
@rafaelss95 apparently thinks UnderscorePipe
to be more suitable.
But looking at it from the user perspective both are equally correct names. I suggest we allow multiple names for the same pipes by creating aliases.
Alias suggestions
capitalize
-- ucFirst
snakeCase
-- underscore
camelCase
-- camelize
I like it.
Also, there are several more aliases in angular-filter
that I like to add:
I agree with these aliases, but... is it allowed to use multiple names in the @Pipe
decorator?
Something in the form of the following should be possible (untested code):
import {Pipe, PipeTransform} from '@angular/core';
@Pipe({name: 'somePipe'})
export class SomePipe implements PipeTransform {
transform() {}
}
@Pipe({name: 'someOtherPipe'})
export class SomeOtherPipe implements PipeTransform {
somePipe = new SomePipe();
transform() {
return somePipe.transform();
}
}