Socket
Socket
Sign inDemoInstall

@captemulation/get-parameter-names

Package Overview
Dependencies
4
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @captemulation/get-parameter-names

Retrieves parameter names from a function


Version published
Maintainers
1
Install size
234 kB
Created

Readme

Source

get-parameter-names

Retrieves the argument names of a function

Install

npm install @captemulation/get-parameter-names

Usage

function foo(bar, baz) {
  return bar + baz
}

var get = require('@captemulation/get-parameter-names')
get(foo) // = ['bar', 'baz']

Also supports fat arrow and default functions

const foo = (a, b = 20) => a + b

var get = require('@captemulation/get-parameter-names')
get(foo) // = ['a', 'b']

Also supports ES6 async functions

async function foo(a, b) { return a + b }

var get = require('@captemulation/get-parameter-names')
get(foo) // = ['a', 'b']

Also supports ES6 Class constructors


var get = require('@captemulation/get-parameter-names')

class Animal{
  constructor(){}
}
class Cat extends Animal{
  constructor(a, b){
    super();
    get(this.constructor) // = ['a', 'b']
  }
}

get(Cat) // = ['a', 'b']

Tests

npm test

License

MIT

Keywords

FAQs

Last updated on 01 Dec 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc