From dfae2d231e39c81827d08fd8834d736c5b3005b1 Mon Sep 17 00:00:00 2001 From: Vijay A Date: Tue, 31 Aug 2021 16:25:57 +0530 Subject: refactor: Use Ferdi.safeParseInt to ensure that parsing is done consistently in all recipes. --- recipes/google-voice/webview.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'recipes/google-voice/webview.js') diff --git a/recipes/google-voice/webview.js b/recipes/google-voice/webview.js index 7d9602c..53d34a1 100644 --- a/recipes/google-voice/webview.js +++ b/recipes/google-voice/webview.js @@ -1,7 +1,7 @@ module.exports = Ferdi => { function parseQuery(query) { const el = document.querySelector(query); - return el && parseInt(el.innerHTML) || 0; + return el && Ferdi.safeParseInt(el.innerHTML); } function getMessages() { @@ -9,7 +9,7 @@ module.exports = Ferdi => { let count; if (el) { - count = parseInt(el.innerHTML.replace(/[\(\) ]/gi, '')) || 0; + count = Ferdi.safeParseInt(el.innerHTML.replace(/[\(\) ]/gi, '')); } else { const count_messages = parseQuery('gv-nav-tab[tooltip="Messages"] div[aria-label="Unread count"]'); const count_calls = parseQuery('gv-nav-tab[tooltip="Calls"] div[aria-label="Unread count"]'); -- cgit v1.2.3-54-g00ecf