🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

fn-annotate

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fn-annotate - npm Package Compare versions

Comparing version

to
1.2.0

test/destructuring.js

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

function groupSubArguments(_, type, keys) {
return type + keys.split(',')
.map(function (arg) {
return arg && arg.trim();
})
.filter(Boolean)
.join('@');
}
argumentString = argumentString.replace(/(\{)([^}]*)\}/g, groupSubArguments);
argumentString = argumentString.replace(/(\[)([^}]*)\]/g, groupSubArguments);
return argumentString.split(',')

@@ -34,3 +46,13 @@ .map(function (arg) {

})
.map(function (arg) {
if (arg[0] === '{') {
return arg.substring(1).split('@');
}
if (arg[0] === '[') {
return { items: arg.substring(1).split('@') };
}
return arg;
})
.filter(Boolean);
}

2

package.json
{
"name": "fn-annotate",
"version": "1.1.3",
"version": "1.2.0",
"description": "Get the argument names of a JavaScript function",

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

@@ -37,2 +37,11 @@ 'use strict';

function supportsDestructuring() {
try {
var fn = global[EVIL]('(({x}) => x)');
return typeof fn === 'function';
} catch (ex) {
return false;
}
}
require('./function');

@@ -51,1 +60,5 @@

}
if (supportsDestructuring()) {
require('./destructuring');
}