README
Zero-dependency get function header
Installation
yarn add get-function-header
Usage
import getFunctionHeader from 'get-function-header'
async function sayHello(who, ...messages) {
console.log(`${ who }: ${ messages.join() }`)
}
getFunctionHeader(sayHello.toString()).trim()
// async function sayHello(who, ...messages)
API
Table of Contents
getFunctionHeader
Get function header codeing from function string.
Parameters
code
string The function string get from Function.prototype.toStringwithComments
boolean Return header with comments or not (optional, defaultfalse
)
Returns string The function header string