Skip to content

Commit 01171f7

Browse files
committed
[REFACTOR] renames google function and exports it by default
1 parent 9dbe802 commit 01171f7

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/commands/lyric.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Lyric {
4747
throw new Error('Nenhum nome foi passado');
4848
}
4949

50-
const results = await search.google(text, 'https://www.letras.mus.br');
50+
const results = await search(text, 'https://www.letras.mus.br');
5151
const { link } = results[0];
5252
const soup = await makeSoup(link);
5353
const title = soup.find('div', { class: 'cnt-head_title' }).find('h1');

src/commands/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Search {
2929
throw new Error('Nenhum texto para pesquisa foi especificado.');
3030
}
3131

32-
const results = await search.google(text, undefined, 1);
32+
const results = await search(text);
3333

3434
if (results.length > 0) {
3535
const stringResult = results

src/utils/search.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const googleIt = require('google-it');
77
* @param {number} [limit=0] Max number of results that must be returned.
88
* @returns {object[]} Array of results found.
99
*/
10-
async function google(query, target = '', limit = 0) {
10+
async function search(query, target = '', limit = 1) {
1111
const result = await googleIt({
1212
query,
1313
includeSites: target,
@@ -21,6 +21,4 @@ async function google(query, target = '', limit = 0) {
2121
return result;
2222
}
2323

24-
module.exports = {
25-
google,
26-
};
24+
module.exports = search;

0 commit comments

Comments
 (0)