Socket
Socket
Sign inDemoInstall

fn-name

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.0 to 4.0.0

10

index.js

@@ -1,9 +0,7 @@

'use strict';
module.exports = fn => {
if (typeof fn !== 'function') {
export default function functionName(function_) {
if (typeof function_ !== 'function') {
throw new TypeError('Expected a function');
}
return fn.displayName || fn.name || (/function ([^(]+)?\(/.exec(fn.toString()) || [])[1];
};
return function_.displayName || function_.name || (/function ([^(]+)?\(/.exec(function_.toString()) || [])[1];
}

13

package.json
{
"name": "fn-name",
"version": "3.0.0",
"version": "4.0.0",
"description": "Get the name of a named function",
"license": "MIT",
"repository": "sindresorhus/fn-name",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=8"
"node": ">=12"
},

@@ -28,5 +31,5 @@ "scripts": {

"devDependencies": {
"ava": "^2.3.0",
"xo": "^0.24.0"
"ava": "^3.15.0",
"xo": "^0.38.2"
}
}

@@ -1,2 +0,2 @@

# fn-name [![Build Status](https://travis-ci.org/sindresorhus/fn-name.svg?branch=master)](https://travis-ci.org/sindresorhus/fn-name)
# fn-name

@@ -7,3 +7,2 @@ > Get the name of a named function

## Install

@@ -15,13 +14,11 @@

## Usage
```js
const fnName = require('fn-name');
import functionName from 'fn-name';
fnName(function foo() {});
functionName(function foo() {});
//=> 'foo'
```
---

@@ -28,0 +25,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc