Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Pipe aliases #12

Open
SteveVanOpstal opened this issue Feb 9, 2017 · 3 comments
Open

Pipe aliases #12

SteveVanOpstal opened this issue Feb 9, 2017 · 3 comments

Comments

@SteveVanOpstal
Copy link
Collaborator

In recent events the SnakeCasePipe is renamed to UnderscorePipe (a103dd8).

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

@a8m
Copy link
Owner

a8m commented Feb 9, 2017

I like it.
Also, there are several more aliases in angular-filter that I like to add:

@rafaelss95
Copy link
Collaborator

rafaelss95 commented Feb 15, 2017

I agree with these aliases, but... is it allowed to use multiple names in the @Pipe decorator?

@SteveVanOpstal
Copy link
Collaborator Author

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants