is-arrow-function
Advanced tools
Comparing version 1.0.0 to 1.0.1
var toStr = Object.prototype.toString; | ||
var fnToStr = Function.prototype.toString; | ||
@@ -6,5 +7,4 @@ module.exports = function isArrowFunction(fn) { | ||
var fnStr = toStr.call(fn); | ||
var fnSrc = String(fn); | ||
return fnStr === '[object Function]' && fnSrc.indexOf('function') !== 0; | ||
return fnStr === '[object Function]' && fnToStr.call(fn).indexOf('function') !== 0; | ||
}; | ||
{ | ||
"name": "is-arrow-function", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Determine if a function is an ES6 arrow function or not.", | ||
@@ -29,3 +29,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"tape": "~1.1.0" | ||
"tape": "~2.3.0" | ||
}, | ||
@@ -32,0 +32,0 @@ "testling": { |
@@ -5,2 +5,4 @@ #is-arrow-function <sup>[![Version Badge][2]][1]</sup> | ||
[![npm badge][11]][1] | ||
[![browser support][9]][10] | ||
@@ -34,2 +36,3 @@ | ||
[10]: https://ci.testling.com/ljharb/node-is-arrow-function | ||
[11]: https://nodei.co/npm/is-arrow-function.png?downloads=true&stars=true | ||
@@ -46,2 +46,10 @@ "use strict"; | ||
test('returns false for non-arrow function with faked toString', function (t) { | ||
var func = function () {}; | ||
func.toString = function () { return 'ARROW'; }; | ||
t.notOk(isArrowFunction(func), 'anonymous function with faked toString is not an arrow function'); | ||
t.end(); | ||
}); | ||
var makeArrowFunction = function () { | ||
@@ -48,0 +56,0 @@ return Function('return (a, b) => a * b;')(); |
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
5428
64
37