Comparing version 3.1.0 to 3.2.0
@@ -49,2 +49,3 @@ 'use strict'; | ||
fun.rm = removeMethod; | ||
fun.hasMethod = hasMethod; | ||
fun.callNextMethod = Genfun.callNextMethod; | ||
@@ -108,2 +109,19 @@ fun.getContext = Genfun.getContext; | ||
/** | ||
* Returns true if there are methods that apply to the given arguments on | ||
* `genfun`. Additionally, makes sure the cache is warmed up for the given | ||
* arguments. | ||
* | ||
*/ | ||
function hasMethod() { | ||
var genfun = typeof this === 'function' && this.genfun ? this.genfun : this; | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var methods = getApplicableMethods(genfun, args || []); | ||
return !!(methods && methods.length); | ||
} | ||
/** | ||
* This generic function is called when `genfun` has been called and no | ||
@@ -175,4 +193,4 @@ * applicable method was found. The default method throws an `Error`. | ||
if (this.hasNextMethod()) { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
@@ -179,0 +197,0 @@ |
@@ -25,3 +25,3 @@ { | ||
"main": "lib/genfun.js", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"license": "CC0-1.0", | ||
@@ -28,0 +28,0 @@ "files": [ |
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
25903
499