Socket
Socket
Sign inDemoInstall

is-arrow-function

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-arrow-function - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

4

index.js
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;')();

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