Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-fn-name

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-fn-name

Get function name with strictness and correctness in mind. Also works for arrow functions and getting correct name of bounded functions. Powered by [fn-name][].

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
34
decreased by-15%
Maintainers
1
Weekly downloads
 
Created
Source

get-fn-name npmjs.com The MIT License

Get function name with strictness and correctness in mind. Also works for arrow functions and getting correct name of bounded functions. Powered by fn-name.

code climate standard code style travis build status coverage status dependency status

Install

npm i get-fn-name --save

Usage

For more use-cases see the tests

const getFnName = require('get-fn-name')

getFnName

Trying to get the name of val function.

Params

  • val {Function}: Regular or arrow (es2015/es6, also know as fat arrow) function.
  • returns {String|null}: The name of function or null otherwise.

Example

var name = require('get-fn-name')

console.log(name(function () { return 1 })) // => null
console.log(name(function named () { return 2 })) // => 'named'

// arrows
console.log(name(() => 3)) // => null
console.log(name(() => { return 4 })) // => null
console.log(name((a, b, c) => a + b + c)) // => null
console.log(name((a, b) => { return a + b })) // => null

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckoCore.tk keybase tunnckoCore tunnckoCore npm tunnckoCore twitter tunnckoCore github

Keywords

FAQs

Package last updated on 03 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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