cleanup: Don't use substring to check prefix

String.prototype.startsWith() is more idiomatic in that case.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3234>
This commit is contained in:
Florian Müllner 2024-03-05 20:37:15 +01:00 committed by Marge Bot
parent 0586158389
commit 193b6c129e

View File

@ -63,9 +63,9 @@ class FdoNotificationDaemon {
_iconForNotificationData(icon) {
if (icon) {
if (icon.substr(0, 7) === 'file://')
if (icon.startsWith('file://'))
return new Gio.FileIcon({file: Gio.File.new_for_uri(icon)});
else if (icon[0] === '/')
else if (icon.startsWith('/'))
return new Gio.FileIcon({file: Gio.File.new_for_path(icon)});
else
return new Gio.ThemedIcon({name: icon});