Comparing version 1.5.2 to 1.5.3
@@ -63,6 +63,7 @@ "use strict"; | ||
function getSnippet(elem) { | ||
return elem.children.map(function (child) { | ||
// recursive function to get "all" the returned data from Google | ||
function findData(child) { | ||
if (!child.data) { | ||
return child.children.map(function (c) { | ||
return c.data; | ||
return c.data || findData(c); | ||
}); | ||
@@ -72,3 +73,7 @@ } | ||
return child.data; | ||
}).join(''); | ||
} | ||
return elem.children && elem.children.length > 0 ? elem.children.map(function (child) { | ||
return new Array(findData(child)).join(''); | ||
}).join('') : ''; | ||
} | ||
@@ -192,3 +197,3 @@ | ||
}); | ||
request(_objectSpread({}, defaultOptions, {}, options), function (error, response, body) { | ||
request(_objectSpread(_objectSpread({}, defaultOptions), options), function (error, response, body) { | ||
if (error) { | ||
@@ -195,0 +200,0 @@ return reject(new Error("Error making web request: ".concat(error))); |
"use strict"; | ||
/* eslint-disable no-extra-parens */ | ||
/* eslint-disable no-console */ | ||
@@ -4,0 +6,0 @@ var fs = require('fs'); |
{ | ||
"name": "google-it", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"description": "A CLI and Node.js library to help retrieve, display, and store Google search results", | ||
@@ -46,10 +46,10 @@ "main": "./lib/main.js", | ||
"amex-jest-preset": "^5.0.0", | ||
"babel-preset-amex": "^3.3.0", | ||
"babel-preset-amex": "^3.4.1", | ||
"codecov": "^3.6.2", | ||
"eslint": "^6.8.0", | ||
"eslint-config-amex": "^11.1.0", | ||
"jest": "^24.9.0", | ||
"mocha": "^7.0.1", | ||
"jest": "^26.4.2", | ||
"mocha": "^8.1.3", | ||
"prettier": "2.0.0" | ||
} | ||
} |
@@ -39,10 +39,10 @@ /* eslint-disable no-console */ | ||
export function getSnippet(elem) { | ||
return elem.children | ||
.map((child) => { | ||
if (!child.data) { | ||
return child.children.map((c) => c.data); | ||
} | ||
return child.data; | ||
}) | ||
.join(''); | ||
// recursive function to get "all" the returned data from Google | ||
function findData(child) { | ||
if (!child.data) { | ||
return child.children.map((c) => c.data || findData(c)); | ||
} | ||
return child.data; | ||
} | ||
return elem.children && elem.children.length > 0 ? elem.children.map((child) => new Array(findData(child)).join('')).join('') : ''; | ||
} | ||
@@ -49,0 +49,0 @@ |
@@ -0,1 +1,2 @@ | ||
/* eslint-disable no-extra-parens */ | ||
/* eslint-disable no-console */ | ||
@@ -2,0 +3,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36456
872