HaithemMosbahi / ngx-avatar

Universal avatar component for angular 2+ applications makes it possible to fetch / generate avatar from different sources
MIT License
236 stars 91 forks source link

Explicitly support `null` as source value #97

Closed PowerKiKi closed 4 years ago

PowerKiKi commented 4 years ago

I thought a bit more about supporting null input, and now believe we should support null values. This is typically useful for emails used for gravatar. The absence of email would typically be a null and not an empty string, because empty string is not a valid email. So we should expect to receive null values.

Luckily the code was almost ready for that and changes are kept minimal.

A null value is accepted as input, but source objects will only be created if value is a string. This allow us a flexible input while keeping our code clean.