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/wire/package.json | 2 +- recipes/wire/webview.js | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'recipes/wire') diff --git a/recipes/wire/package.json b/recipes/wire/package.json index fdd8616..4a85ade 100644 --- a/recipes/wire/package.json +++ b/recipes/wire/package.json @@ -1,7 +1,7 @@ { "id": "wire", "name": "Wire", - "version": "1.0.2", + "version": "1.0.3", "license": "MIT", "config": { "serviceURL": "https://app.wire.com/", diff --git a/recipes/wire/webview.js b/recipes/wire/webview.js index efd37f3..b099eee 100644 --- a/recipes/wire/webview.js +++ b/recipes/wire/webview.js @@ -7,10 +7,7 @@ module.exports = (Ferdi) => { const conversationElems = document.querySelectorAll('[data-uie-name="conversation-folder-badge"]'); if (conversationElems) { for (const conversationElem of conversationElems) { - const count = parseInt(conversationElem.innerText); - if (count) { - direct += count; - } + direct += Ferdi.safeParseInt(conversationElem.innerText); } } @@ -18,8 +15,8 @@ module.exports = (Ferdi) => { const pendingElem = document.querySelector('[data-uie-name="item-pending-requests"]'); if (pendingElem) { const matches = pendingElem.innerText.match(/^([1-9][0-9]*)/); - if (matches && matches.length > 0) { - indirect += parseInt(matches[1]); + if (matches && matches.length > 1) { + indirect += Ferdi.safeParseInt(matches[1]); } } -- cgit v1.2.3-54-g00ecf