From 757e3dd86d723245201ede9d4f8a76d515284430 Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Tue, 9 Jan 2018 13:39:43 -0500 Subject: [PATCH] Only list top 5 wifi hotspots --- lib/wifi/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/wifi/index.js b/lib/wifi/index.js index c28a6d8..193f4d7 100644 --- a/lib/wifi/index.js +++ b/lib/wifi/index.js @@ -36,12 +36,14 @@ class Wifi { const lines = stdout.split('\n') let output = [] let line + let i = 0 for (let l of lines) { line = l.replace('ESSID:', '').trim() - if (line !== '""') { + if (line !== '""' && i < 5) { line = line.replace(quoteRe, '') output.push(line) } + i++ } output = output.filter(ap => { if (ap !== '') return ap