Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

detective-es6

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detective-es6 - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

6

index.js

@@ -9,5 +9,6 @@ 'use strict';

* @param {String|Object} src - File's content or AST
* @param {Object} options - optional extra settings
* @return {String[]}
*/
module.exports = function(src) {
module.exports = function(src, options) {
const walker = new Walker();

@@ -26,2 +27,5 @@

case 'ImportDeclaration':
if (options && options.skipTypeImports && node.importKind == 'type') {
break;
}
if (node.source && node.source.value) {

@@ -28,0 +32,0 @@ dependencies.push(node.source.value);

2

package.json
{
"name": "detective-es6",
"version": "2.0.0",
"version": "2.1.0",
"description": "Get the dependencies of an es6 module",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -99,2 +99,10 @@ 'use strict';

});
it('respects settings for type imports', function() {
const source = 'import type {foo} from "mylib";';
const depsWithTypes = detective(source);
const depsWithoutTypes = detective(source, {skipTypeImports: true});
assert.deepEqual(depsWithTypes, ['mylib']);
assert.deepEqual(depsWithoutTypes, []);
});
});
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