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

function-extractor

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

function-extractor

Extracts all the functions from a Javascript file into an array of objects.

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-25%
Maintainers
1
Weekly downloads
 
Created
Source

function-extractor

Provides an array of objects listing the names and types of functions found in a Javascript file.

Based on fn-extractor, except this one works with the latest Esprima, catches more corner cases, reports errors, and isn't in Coffeescript.

Used by Panino to report doc coverage.

Installation

npm install function-extractor

Usage

Esprima is required by this tool.

You can use this module in two ways. If you don't already have an Esprima AST of your code, do this:

var functionExtractor = require("./javascript/jsd/function_extractor");

var functions = functionExtractor.parse(source);

where source is the text read from your Javascript file.

Otherwise, if you've already parsed the file, do this:

var functionExtractor = require("./javascript/jsd/function_extractor");

var functions = functionExtractor.parse(source, ast);

where source is the text read from your Javascript file, and ast is the Esprima.parse() result. Note that you must pass the range and loc options to Esprima.

FAQs

Package last updated on 06 Nov 2012

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