Socket
Socket
Sign inDemoInstall

yudarity

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.2 to 0.1.3

8

arity.js

@@ -6,3 +6,9 @@ module.exports = function (func) {

}
return result[1].replace(/\{[^\}]*\}/g, 'param') .split(/\s*,\s*/).length; // eslint-disable-line
var argumentStr = result[1].trim();
if (argumentStr.substring(argumentStr.length - 1, argumentStr.length) === ',') {
argumentStr = argumentStr.substring(0, argumentStr.length - 1);
}
return argumentStr.replace(/\{[^\}]*\}/g, 'param') .split(/\s*,\s*/).length; // eslint-disable-line
}

5

package.json
{
"name": "yudarity",
"description": "Returns function arity (number of possible arguments) supports all ES6 features including argument destructor and default.",
"version": "0.1.2",
"version": "0.1.3",
"author": "Roee Yudilevtich (RoeeYud@gmail.com)",

@@ -14,3 +14,4 @@ "devDependencies": {

"verbose": true,
"testEnvironment": "node"
"testEnvironment": "node",
"transform": {}
},

@@ -17,0 +18,0 @@ "repository": "https://github.com/roeeyud/arity",

@@ -37,2 +37,33 @@ const arity = require('../arity');

});
it('"," at the end', function () {
function testFn(
id,
options,
a,
c,
) {
return dispatch({
resource: 'a',
method: 'b',
path: 'c',
payload: id,
options,
});
}
expect(arity(testFn)).toBe(4);
});
it('arrow', function () {
expect(arity((id, options, a, c) => {
return dispatch({
resource: 'a',
method: 'b',
path: 'c',
payload: id,
options,
});
})).toBe(4);
});
});

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