Socket
Socket
Sign inDemoInstall

yaspeller

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yaspeller - npm Package Compare versions

Comparing version 6.0.2 to 6.0.3

126

lib/yaspeller.js

@@ -10,3 +10,3 @@ 'use strict';

const isutf8 = require('isutf8');
const request = require('request');
const fetch = require('node-fetch');
const pth = require('path');

@@ -233,27 +233,23 @@ const MarkdownIt = require('markdown-it');

request.get({
method: 'GET',
uri: url,
gzip: true
},
function(error, response, text) {
if (error) {
fetch(url)
.then(response => {
if (response.ok) {
return response.text();
} else {
throw Error(url + ': returns status code is ' + response.statusCode);
}
})
.then(text => {
const startTime = Date.now();
checkText(text, function(err, data, originalText) {
callback(
err,
err ? data : {resource: url, data: data, time: Date.now() - startTime},
originalText
);
}, settings);
})
.catch(error => {
callback(true, error);
return;
}
if (response.statusCode !== 200) {
callback(true, Error(url + ': returns status code is ' + response.statusCode));
return;
}
const startTime = Date.now();
checkText(text, function(err, data, originalText) {
callback(
err,
err ? data : {resource: url, data: data, time: Date.now() - startTime},
originalText
);
}, settings);
});
});
}

@@ -276,52 +272,46 @@

request.get(url, function(error, response, xml) {
let obj;
if (error) {
obj = [true, error];
results.push(obj);
callback && callback.apply(this, obj);
commonCallback(results);
return;
}
if (response.statusCode !== 200) {
obj = [true, Error(url + ': returns status code is ' + response.statusCode)];
results.push(obj);
callback && callback.apply(this, obj);
commonCallback(results);
return;
}
const parser = new xml2js.Parser();
parser.parseString(xml, function(err, result) {
if (err) {
let obj = [true, Error(url + ': error parsing xml')];
results.push(obj);
callback && callback.apply(this, obj);
commonCallback(results);
return;
fetch(url)
.then(res => {
if (res.ok) {
return res.text();
} else {
throw Error(url + ': returns status code is ' + res.statusCode);
}
})
.then(xml => {
const parser = new xml2js.Parser();
parser.parseString(xml, function(err, result) {
if (err) {
let obj = [true, Error(url + ': error parsing xml')];
results.push(obj);
callback && callback.apply(this, obj);
commonCallback(results);
return;
}
const tasks = [];
if (result && result.urlset && Array.isArray(result.urlset.url)) {
result.urlset.url.forEach(function(el) {
el.loc && el.loc.forEach(function(url) {
tasks.push(function(cb) {
checkUrl(url, function(err, data, originalText) {
callback && callback(err, data, originalText);
cb(null, [err, data]);
}, settings);
const tasks = [];
if (result && result.urlset && Array.isArray(result.urlset.url)) {
result.urlset.url.forEach(function(el) {
el.loc && el.loc.forEach(function(url) {
tasks.push(function(cb) {
checkUrl(url, function(err, data, originalText) {
callback && callback(err, data, originalText);
cb(null, [err, data]);
}, settings);
});
});
});
}
async.parallelLimit(tasks, getMaxRequest(settings), function(err, data) {
commonCallback(data);
});
}
async.parallelLimit(tasks, getMaxRequest(settings), function(err, data) {
commonCallback(data);
});
})
.catch((error) => {
const obj = [true, error];
results.push(obj);
callback && callback.apply(this, obj);
commonCallback(results);
});
});
}

@@ -328,0 +318,0 @@

@@ -13,3 +13,3 @@ {

"description": "Search tool typos in the text, files and websites",
"version": "6.0.2",
"version": "6.0.3",
"license": "MIT",

@@ -36,3 +36,3 @@ "homepage": "https://github.com/hcodes/yaspeller",

"dependencies": {
"async": "^3.1.0",
"async": "^3.2.0",
"chalk": "^2.4.2",

@@ -43,10 +43,10 @@ "commander": "^3.0.0",

"escape-html": "^1.0.3",
"eyo-kernel": "^2.5.1",
"glob": "^7.1.3",
"isutf8": "^2.0.3",
"eyo-kernel": "^2.5.6",
"glob": "^7.1.6",
"isutf8": "^2.1.0",
"markdown-it": "^10.0.0",
"minimatch": "^3.0.4",
"request": "^2.88.0",
"strip-json-comments": "^3.0.0",
"xml2js": "^0.4.19",
"node-fetch": "^2.6.0",
"strip-json-comments": "^3.0.1",
"xml2js": "^0.4.23",
"yandex-speller": "^4.0.0"

@@ -56,7 +56,7 @@ },

"chai": "^4.2.0",
"eslint": "^6.0.1",
"mocha": "^6.1.4",
"nyc": "^14.1.0",
"eslint": "^6.8.0",
"mocha": "^7.0.1",
"nyc": "^14.1.1",
"parse-json": "^5.0.0",
"sinon": "^7.3.2"
"sinon": "^9.0.0"
},

@@ -71,3 +71,3 @@ "engines": {

"unit-test": "mocha",
"unit-test-coverage": "nyc mocha"
"unit-test-coverage": "nyc --reporter=lcov --reporter=text-summary mocha"
},

@@ -74,0 +74,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc