From 67b01b986477fe11b6b832af68ea2233fb388f05 Mon Sep 17 00:00:00 2001 From: tommelo Date: Sun, 25 Jun 2017 20:06:37 -0300 Subject: [PATCH] Added the possibility of getting multiple results --- index.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 3cc12a8..fc79d7c 100644 --- a/index.js +++ b/index.js @@ -8,6 +8,7 @@ function search(options, callback) { var host = options.host || 'www.google.com'; var solver = options.solver; var params = options.params || {}; + var fullResult = options.fullResult || false; var results = []; params.hl = params.hl || options.lang || 'en'; @@ -35,9 +36,11 @@ function search(options, callback) { return results.indexOf(result) === -1; }); - newResults.forEach(function(result) { - callback(null, result); - }); + if (!fullResult) { + newResults.forEach(function(result) { + callback(null, result); + }); + } if(newResults.length === 0) { return; @@ -49,6 +52,9 @@ function search(options, callback) { params.start = results.length; getPage(params, onPage); } + + if (fullResult) + callback(null, results); });