Socket
Socket
Sign inDemoInstall

amdextract

Package Overview
Dependencies
2
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.14 to 3.0.0

10

index.js

@@ -14,4 +14,3 @@ /*

var toString = Object.prototype.toString,
ArrayProto = Array.prototype;
var toString = Object.prototype.toString;

@@ -31,3 +30,5 @@ function traverse(object, visitor) {

if (typeof child === 'object' && child !== null) {
child.key = key;
if (typeof child.key === 'undefined') {
child.key = key;
}
if (result = traverse(child, visitor)) {

@@ -125,3 +126,4 @@ return result;

return false;
} else if (object.type === 'Identifier' && object.name === variable &&
} else if (object.type === 'Identifier' &&
(object.name === variable || (object.key && object.key.name && object.key.name.indexof(variable) !== -1)) &&
object.key !== 'property' && object.key !== 'id') {

@@ -128,0 +130,0 @@ return object;

10

package.json
{
"name": "amdextract",
"version": "2.1.14",
"version": "3.0.0",
"description": "Uses AST to extract AMD modules, their parts and an optimized output without unused dependencies while keeping the original format.",

@@ -36,9 +36,9 @@ "main": "index.js",

"devDependencies": {
"mocha": "^2.2.5",
"should": "^7.0.2"
"mocha": "^6.2.2",
"should": "^13.2.3"
},
"dependencies": {
"esprima": "^2.4.1",
"estraverse": "^4.1.0"
"esprima": "^4.0.1",
"estraverse": "^4.3.0"
}
}

@@ -1,2 +0,2 @@

# amdextract [![Build Status](https://travis-ci.org/mehdishojaei/amdextract.png)](https://travis-ci.org/mehdishojaei/amdextract)
# amdextract [![Build Status](https://travis-ci.org/mehdishojaei/amdextract.png)](https://travis-ci.org/mehdishojaei/amdextract) [![Known Vulnerabilities](https://snyk.io/test/github/mehdishojaei/amdextract/badge.svg)](https://snyk.io/test/github/mehdishojaei/amdextract)

@@ -3,0 +3,0 @@ Uses AST to extract AMD modules, their parts and an optimized output without unused dependencies while keeping the original format.

@@ -0,0 +0,0 @@ // General test for all cases.

@@ -0,0 +0,0 @@ // General test for all cases.

@@ -195,4 +195,36 @@ var amdextract = require('..');

});
describe('es6 computed properties postive match', function() {
var output = amdextract.parse(
"define('name', ['p1'], function(a) { var computed = {[a.const]: 'value'} })",
{ removeUnusedDependencies: true }
);
var result = output.results[0];
it('.moduleId', function() { should(result.moduleId).equal('name'); });
it('.paths', function() { result.paths.should.be.eql(['p1']); });
it('.dependencies', function() { result.dependencies.should.be.eql(['a']); });
it('.unusedPaths', function() { result.unusedPaths.should.be.eql([]); });
it('.unusedDependencies', function() { result.unusedDependencies.should.be.eql([]); });
it('.optimizedContent', function() { should(output.optimizedContent).be.equal(
"define('name', ['p1'], function(a) { var computed = {[a.const]: 'value'} })"
); });
})
describe('es6 computed properties negative match', function() {
var output = amdextract.parse(
"define('name', ['p1'], function(a) { var computed = {[b.const]: 'value'} })",
{ removeUnusedDependencies: true }
);
var result = output.results[0];
it('.moduleId', function() { should(result.moduleId).equal('name'); });
it('.paths', function() { result.paths.should.be.eql(['p1']); });
it('.dependencies', function() { result.dependencies.should.be.eql(['a']); });
it('.unusedPaths', function() { result.unusedPaths.should.be.eql(['p1']); });
it('.unusedDependencies', function() { result.unusedDependencies.should.be.eql(['a']); });
it('.optimizedContent', function() { should(output.optimizedContent).be.equal(
"define('name', [], function() { var computed = {[b.const]: 'value'} })"
); });
})
});
});
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc