Socket
Socket
Sign inDemoInstall

call-func

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

call-func - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

6

build/cjs/src/__tests__/callFuncTest.js

@@ -79,2 +79,8 @@ "use strict";

});
it("test return null", function () {
var actual1 = (0, _index["default"])('foo');
(0, _chai.expect)(actual1).to.equal('foo');
var actual2 = (0, _index["default"])('foo', null, null, null);
(0, _chai.expect)(actual2).to.be["null"];
});
it("test return with non-func", function () {

@@ -81,0 +87,0 @@ (0, _chai.expect)((0, _index["default"])(undefined)).to.be.undefined;

4

build/cjs/src/callfunc.js

@@ -14,4 +14,4 @@ "use strict";

var callFunc = function callFunc(func, args, scope) {
return _reshowConstant.FUNCTION === (0, _typeof2["default"])(func) ? func.apply(scope, args) : func;
var callFunc = function callFunc(func, args, scope, def) {
return _reshowConstant.FUNCTION === (0, _typeof2["default"])(func) ? func.apply(scope, args) : _reshowConstant.UNDEFINED !== (0, _typeof2["default"])(def) ? def : func;
};

@@ -18,0 +18,0 @@

@@ -66,2 +66,8 @@ import _classCallCheck from "reshow-runtime/es/helpers/classCallCheck";

});
it("test return null", function () {
var actual1 = callfunc('foo');
expect(actual1).to.equal('foo');
var actual2 = callfunc('foo', null, null, null);
expect(actual2).to.be["null"];
});
it("test return with non-func", function () {

@@ -68,0 +74,0 @@ expect(callfunc(undefined)).to.be.undefined;

import _typeof from "reshow-runtime/es/helpers/typeof";
import { FUNCTION } from "reshow-constant";
import { FUNCTION, UNDEFINED } from "reshow-constant";
var callFunc = function callFunc(func, args, scope) {
return FUNCTION === _typeof(func) ? func.apply(scope, args) : func;
var callFunc = function callFunc(func, args, scope, def) {
return FUNCTION === _typeof(func) ? func.apply(scope, args) : UNDEFINED !== _typeof(def) ? def : func;
};
export default callFunc;
{
"name": "call-func",
"version": "0.1.3",
"version": "0.1.4",
"description": "call function",

@@ -5,0 +5,0 @@ "repository": "react-atomic/react-atomic-organism",

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