What is parse-function?
The parse-function npm package is a utility for parsing JavaScript functions to extract their name, parameters, and body. It is useful for analyzing and manipulating functions programmatically.
What are parse-function's main functionalities?
Parse Function
This feature allows you to parse a JavaScript function to extract its name, parameters, and body. The code sample demonstrates how to parse a simple function and log the parsed details.
const parseFunction = require('parse-function')();
const parsed = parseFunction.parse(function example(a, b) { return a + b; });
console.log(parsed);
Parse Arrow Function
This feature allows you to parse an arrow function. The code sample demonstrates how to parse an arrow function and log the parsed details.
const parseFunction = require('parse-function')();
const parsed = parseFunction.parse((a, b) => a + b);
console.log(parsed);
Parse Async Function
This feature allows you to parse an async function. The code sample demonstrates how to parse an async function and log the parsed details.
const parseFunction = require('parse-function')();
const parsed = parseFunction.parse(async function example(a, b) { return a + b; });
console.log(parsed);
Other packages similar to parse-function
esprima
Esprima is a high-performance, standard-compliant ECMAScript parser. It can parse JavaScript code into an abstract syntax tree (AST), which can then be analyzed or transformed. Compared to parse-function, Esprima provides a more comprehensive parsing capability but requires more effort to extract specific function details.
acorn
Acorn is a small, fast, JavaScript-based JavaScript parser. It generates an abstract syntax tree (AST) from JavaScript code. Similar to Esprima, Acorn offers a broader parsing capability but requires additional steps to extract function-specific information compared to parse-function.
parse-function
Parse a function into an object using espree, acorn or babylon parsers. Extensible through Smart Plugins
Please consider following this project's author, Charlike Mike Reagent, and :star: the project to show your :heart: and support.
If you have any how-to kind of questions, please read the Contributing Guide and Code of Conduct documents.
For bugs reports and feature requests, please create an issue or ping
@tunnckoCore at Twitter.
Project is semantically versioned & automatically released from GitHub Actions with Lerna.
Topic | Contact |
---|
Any legal or licensing questions, like private or commerical use | |
For any critical problems and security reports | |
Consulting, professional support, personal or team training | |
For any questions about Open Source, partnerships and sponsoring | |
() => include(process.cwd() + '/.verb.head.md')
Table of Contents
(TOC generated by verb using markdown-toc)
Install
This project requires Node.js >=8.11 (see Support & Release Policy). Install it using
yarn or npm.
We highly recommend to use Yarn when you think to contribute to this project.
$ yarn add parse-function
() => include(process.cwd() + '/.verb.md')
back to top
Contributing
Guides and Community
Please read the Contributing Guide and Code of Conduct documents for advices.
For bug reports and feature requests, please join our community forum and open a thread there with prefixing the title of the thread with the name of the project if there's no separate channel for it.
Consider reading the Support and Release Policy guide if you are interested in what are the supported Node.js versions and how we proceed. In short, we support latest two even-numbered Node.js release lines.
Support the project
Become a Partner or Sponsor? :dollar: Check the Partner, Sponsor or Omega-level tiers! :tada: You can get your company logo, link & name on this file. It's also rendered on package page in npmjs.com and yarnpkg.com sites too! :rocket:
Not financial support? Okey! Pull requests, stars and all kind of contributions are always
welcome. :sparkles:
Wonderful Contributors
Thanks to the hard work of these wonderful people this project is alive! It follows the
all-contributors specification.
Don't hesitate to add yourself to that list if you have made any contribution! ;) See how,
here.
Consider showing your support to them. :sparkling_heart:
back to top
License
Copyright (c) 2016-present, Charlike Mike Reagent <opensource@tunnckocore.com>
& contributors.
Released under the MPL-2.0 License.