Socket
Socket
Sign inDemoInstall

agentia-utilities

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

agentia-utilities - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

15

index.js

@@ -81,7 +81,15 @@ 'use strict';

console.log(options);
Object.defineProperty(obj, name, options);
};
var getParamNames = function getParamNames(fn) {
var params;
if (isFunction(fn)) {
fn = fn.toString();
params = fn.slice(fn.indexOf('(') + 1, fn.indexOf(')')).match(/([^\s,]+)/g);
}
return isArray(params) ? params : [];
};
module.exports = {

@@ -100,3 +108,4 @@ isArray: isArray,

round: round,
defineProp: defineProp
defineProp: defineProp,
getParamNames: getParamNames
};

4

package.json
{
"name": "agentia-utilities",
"version": "1.1.0",
"version": "1.2.0",
"description": "Multipurpose utilities for by Agentia modules",
"main": "index.js",
"scripts": {
"test": "gulp spec"
"test": "gulp lint && gulp spec"
},

@@ -9,0 +9,0 @@ "repository": {

@@ -299,2 +299,38 @@ 'use strict';

describe('.getParamNames()', function() {
it('should return an array of params', function() {
var fn = function(a, b, c) {
return a + b + c;
};
var params = utils.getParamNames(fn);
expect(params).to.be.an('array');
expect(params).to.have.length.of(3);
expect(params).to.include('a');
expect(params).to.include('b');
expect(params).to.include('c');
});
it('should return an empty array, when function has no params', function() {
var fn = function() {};
var params = utils.getParamNames(fn);
expect(params).to.be.an('array');
expect(params).to.be.empty;
});
it('should return an empty array, when argument is not a function', function() {
expect(utils.getParamNames({})).to.be.empty;
expect(utils.getParamNames(true)).to.be.empty;
expect(utils.getParamNames('string')).to.be.empty;
expect(utils.getParamNames(new Date())).to.be.empty;
expect(utils.getParamNames([])).to.be.empty;
expect(utils.getParamNames(0)).to.be.empty;
expect(utils.getParamNames(null)).to.be.empty;
expect(utils.getParamNames(undefined)).to.be.empty;
});
});
});

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