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

escomplex

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

escomplex - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

4

package.json
{
"name": "escomplex",
"version": "0.2.1",
"version": "0.2.2",
"description": "Software complexity analysis of JavaScript-family abstract syntax trees.",

@@ -30,3 +30,3 @@ "homepage": "https://github.com/philbooth/escomplex",

"dependencies": {
"check-types": "0.7.x",
"check-types": "1.1.x",
"matrix-utilities": "1.2.x"

@@ -33,0 +33,0 @@ },

@@ -114,3 +114,3 @@ # escomplex

* Core size:
the percentage of modules
The percentage of modules
that are both widely depended on

@@ -421,2 +421,23 @@ and themselves depend on other modules.

## Related projects
* [plato]:
JavaScript source code visualization, static analysis, and complexity tool.
* [jsc]:
JavaScript source code complexity tool.
* [bob]:
Minimalist-omakase build tool for node.js projects.
* [cardio]:
A web application health tool.
* [grunt-complexity][grunt]:
A JavaScript complexity analysis grunt task.
* [brackets-crjs][brackets]:
Brackets extension.
* [jscomplexity]:
JS cyclomatic complexity report generator.
* [karma-complexity-processor][karma]:
A preprocessor for karma runner to give some metrics about code complexity.
* [crlint]:
JS linter based on complexity report results.
## Development

@@ -455,4 +476,13 @@

[review]: http://www.rose-hulman.edu/Users/faculty/young/CS-Classes/csse575/Resources/maintainabilityMeas05314233.pdf
[plato]: https://github.com/es-analysis/plato
[jsc]: https://github.com/bahmutov/js-complexity-viz
[bob]: https://github.com/cliffano/bob
[cardio]: https://github.com/auchenberg/cardio
[grunt]: https://github.com/vigetlabs/grunt-complexity
[brackets]: https://github.com/sahlas/brackets-crjs
[jscomplexity]: https://github.com/slyg/jscomplexity
[karma]: https://github.com/lorenzofox3/karma-complexity-preprocessor
[crlint]: https://github.com/spion/crlint.js
[contributions]: https://github.com/philbooth/escomplex/blob/master/CONTRIBUTING.md
[license]: https://github.com/philbooth/escomplex/blob/master/COPYING
[contributions]: https://github.com/philbooth/escomplex/blob/master/CONTRIBUTING.md

@@ -25,3 +25,3 @@ /**

function analyse (ast, walker, options) {
if (check.isArray(ast)) {
if (check.array(ast)) {
return require('./project').analyse(ast, walker, options);

@@ -28,0 +28,0 @@ }

@@ -14,7 +14,7 @@ /*globals exports, require */

check.verifyObject(ast, 'Invalid syntax tree');
check.verifyObject(walker, 'Invalid walker');
check.verifyFunction(walker.walk, 'Invalid walker.walk method');
check.verify.object(ast, 'Invalid syntax tree');
check.verify.object(walker, 'Invalid walker');
check.verify.fn(walker.walk, 'Invalid walker.walk method');
if (check.isObject(options)) {
if (check.object(options)) {
settings = options;

@@ -100,3 +100,3 @@ } else {

if (check.isObject(lines)) {
if (check.object(lines)) {
result.line = lines.start.line;

@@ -131,5 +131,5 @@ result.sloc.physical = lines.end.line - lines.start.line + 1;

if (check.isNumber(amount)) {
if (check.number(amount)) {
incrementFn(currentReport, amount);
} else if (check.isFunction(amount)) {
} else if (check.fn(amount)) {
incrementFn(currentReport, amount(node));

@@ -168,7 +168,7 @@ }

function processHalsteadMetric (node, syntax, metric, currentReport) {
if (check.isArray(syntax[metric])) {
if (check.array(syntax[metric])) {
syntax[metric].forEach(function (s) {
var identifier;
if (check.isFunction(s.identifier)) {
if (check.fn(s.identifier)) {
identifier = s.identifier(node);

@@ -179,3 +179,3 @@ } else {

if (check.isFunction(s.filter) === false || s.filter(node) === true) {
if (check.fn(s.filter) === false || s.filter(node) === true) {
halsteadItemEncountered(currentReport, metric, identifier);

@@ -231,5 +231,5 @@ }

if (check.isFunction(syntax.dependencies)) {
if (check.fn(syntax.dependencies)) {
dependencies = syntax.dependencies(node, clearDependencies);
if (check.isObject(dependencies) || check.isArray(dependencies)) {
if (check.object(dependencies) || check.array(dependencies)) {
report.dependencies = report.dependencies.concat(dependencies);

@@ -236,0 +236,0 @@ }

@@ -19,3 +19,3 @@ /*globals exports, require */

check.verifyArray(modules, 'Invalid modules');
check.verify.array(modules, 'Invalid modules');

@@ -25,3 +25,3 @@ reports = modules.map(function (m) {

check.verifyUnemptyString(m.path, 'Invalid path');
check.verify.unemptyString(m.path, 'Invalid path');

@@ -221,3 +221,3 @@ report = moduleAnalyser.analyse(m.ast, walker, options);

if (check.isOddNumber(values.length)) {
if (check.oddNumber(values.length)) {
return values[(values.length - 1) / 2];

@@ -224,0 +224,0 @@ }

@@ -8,7 +8,7 @@ /*globals require, module */

module.exports = function (object, defaultName) {
if (check.isObject(object) && check.isUnemptyString(object.name)) {
if (check.object(object) && check.unemptyString(object.name)) {
return object.name;
}
if (check.isUnemptyString(defaultName)) {
if (check.unemptyString(defaultName)) {
return defaultName;

@@ -15,0 +15,0 @@ }

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