Comparing version 0.1.3 to 0.1.4
@@ -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; |
@@ -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", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34591
934