Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!urls.size) {
return callback(null, {
statusCode: 200,
body: JSON.stringify({
text: text,
meta: null,
error: ["Empty url in text"]
})
});
}
// Retrieve first URL in text - urls are already normalized
const url = [...urls][0];
const options = { url };
ogs(options, (error, results) => {
const statusCode = results.success ? 200 : 500;
callback(null, buildResponseObject(statusCode, results, text));
});
}