Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Answer:8 Angular pure pipe #1107

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

gitmbints
Copy link

Hello guys,

I hope you're all doing well. I’ve been working on the challenge n°8 (pure pipe), and I would greatly appreciate it if someone could take a moment to review my code.

Your feedback is invaluable, and I'm open to any suggestions or improvements.

Thank you in advance for your time and assistance!

Best regards,

Ambinintsoa

@github-actions github-actions bot added 8 exercice simple pipe answer answer labels Sep 3, 2024
})
export class HeavyComputation implements PipeTransform {
transform(value: string, index: number): string {
return `${value} - ${index}`;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be on the safer side - can we add a null check here? Everything else is great!

Something like:

transform(name: string | null | undefined, index: number | null | undefined): string {
    if (name == null || index == null) {
      return '';
    }
    
    return `${name} - ${index}`;
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8 exercice simple pipe answer answer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants