New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

escomplex-js

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

escomplex-js - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

2

package.json
{
"name": "escomplex-js",
"version": "1.0.0",
"version": "1.1.0",
"description": "Javascript wrapping library for escomplex.",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/philbooth/escomplex-js",

@@ -23,15 +23,30 @@ /*globals require, exports */

function analyseSources (sources, options) {
return performAnalysis(sources.map(function (source) {
try {
return {
path: source.path,
ast: getSyntaxTree(source.code)
};
} catch (error) {
error.message = source.path + ': ' + error.message;
throw error;
return performAnalysis(
sources.map(
mapSource.bind(null, options)
).filter(filterSource),
options
);
}
function mapSource (options, source) {
try {
return {
path: source.path,
ast: getSyntaxTree(source.code)
};
} catch (error) {
if (options.ignoreErrors) {
return null;
}
}), options);
error.message = source.path + ': ' + error.message;
throw error;
}
}
function filterSource (source) {
return !!source;
}
function getSyntaxTree (source) {

@@ -38,0 +53,0 @@ return esprima.parse(source, { loc: true });

@@ -165,2 +165,29 @@ 'use strict';

suite('array source with bad code:', function() {
var code;
setup(function () {
mockery.deregisterMock('esprima');
mockery.disable();
code = [ { path: '/foo.js', code: 'foo foo' }, { path: '../bar.js', code: '"bar";' } ];
index = require(modulePath);
});
teardown(function () {
code = undefined;
});
test('throws an error with default options', function() {
assert.throws(function() {
index.analyse(code, {});
}, '/foo.js: Line 1: Unexpected identifier');
});
test('swallows error with options.ignoreErrors', function() {
assert.doesNotThrow(function() {
index.analyse(code, { ignoreErrors: true });
});
});
});
suite('string source:', function () {

@@ -167,0 +194,0 @@ var options, result;

Sorry, the diff of this file is not supported yet

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