generate-function
npmv2.3.1Module that helps you write generated functions in Node
Not recommended for new projects
No — generate-function should not be adopted for new projects. Last published 2931 days ago.
- AAdoption: grade A, Excellent.
12M downloads per week and 1 known dependents.
- FMaintenance: grade F, Failing.
Last published 2931 days ago.
- AWeight: grade A, Excellent.
Pulls in 1 transitive package, about 8.8 KB installed (at least — some of the tree is still being crawled).
- BSupply chain: grade B, Good.
This package has a single maintainer (bus factor of 1).
- ALicense: grade A, Excellent.
MIT — permissive, with no copyleft found in the dependency tree.
Grades are computed deterministically from registry metadata collected by PackageGraph — downloads, dependents, publish dates, the resolved dependency tree, maintainer count, and declared licenses. No third-party scores are used.
Install cost
What you actually take on by adding generate-function to a project.
Runtime packages this one declares itself.
Distinct packages in the full runtime tree, deduplicated the way a package manager would.
Unpacked size of this package plus its entire runtime tree.
Longest resolved dependency chain below this package.
Part of this dependency tree has not been crawled yet, so these figures are a lower bound rather than a final total.
Compatibility
- Node.js
- No constraint declared
- Module format
- CommonJS only
- TypeScript
- No bundled types
- Install scripts
- None
Quick start
A usage example from the generate-function README.
const genfun = require('generate-function')
const { d } = genfun.formats
function addNumber (val) {
const gen = genfun()
gen(`
function add (n) {')
return n + ${d(val)}) // supports format strings to insert values
}
`)
return gen.toFunction() // will compile the function
}generate-function vs the alternatives
Packages solving a similar problem in the npm ecosystem, compared on the signals that drive an adoption decision.
| Package | Weekly downloads | Dependents | License | Last release |
|---|---|---|---|---|
| generate-functionthis page | 12M | 1 | MIT | 8 years ago |
| reusify | 91M | 1 | MIT | 1 day ago |
| @react-native/codegen | 0 | 2 | MIT | 1 day ago |
| callsites | 136.7M | 1 | MIT | 1 day ago |
| once | 109.6M | 1 | ISC | 1 day ago |
| call-bind | 80.7M | 5 | MIT | 1 day ago |
Dependencies
Declared by generate-function v2.3.1. Runtime dependencies are installed with the package; dev dependencies are not.
Runtime (1)
Dev (1)
Used by
Popular packages that depend on generate-function.
Relationship graph
Dependencies (left) and dependents (right) of generate-function.
Frequently installed together
TypeScript definitions for node
Prettier is an opinionated code formatter
A Long class for representing a 64-bit two's-complement integer value.
TypeScript Execute (tsx): Node.js enhanced with esbuild to run TypeScript & ESM files
🛡️ Faster SQL escape and format for JavaScript (Node.js, Bun, and Deno).
Convert character encodings in pure javascript.
AWS RDS SSL certificates bundles.
sql named placeholders to unnamed compiler
Extract meaning from JS Errors
The fastest javascript implementation of a double-ended queue. Used by the official Redis, MongoDB, MariaDB & MySQL libraries for Node.js and many other libraries. Maintains compatability with deque.
Release history
No releases in the last two years, typically about 0 days apart.
| Version | Published | Size | License |
|---|---|---|---|
| 2.3.1latest | 8 years ago | 8.8 KB | MIT |
| 2.3.0 | 8 years ago | 7.4 KB | MIT |
| 2.2.1 | 8 years ago | 7.1 KB | MIT |
| 2.2.0 | 8 years ago | 7.0 KB | MIT |
| 2.0.0 | 12 years ago | — | MIT |
| 1.1.0 | 12 years ago | — | MIT |
| 1.0.3 | 12 years ago | — | MIT |
| 1.0.2 | 12 years ago | — | MIT |
| 1.0.1 | 12 years ago | — | MIT |
| 1.0.0 | 12 years ago | — | MIT |
| 0.0.0 | 12 years ago | — | MIT |
Overview
generate-function is an npm package that module that helps you write generated functions in Node. It is extremely widely used, with about 12M downloads per week and 1 known dependents in the graph. The latest version is 2.3.1, released under the MIT license.
Who should use it
Teams working in the npm ecosystem who need module that helps you write generated functions in Node and value a battle-tested, widely-adopted solution.
When not to use it
Consider an alternative if you need to have first-class TypeScript types out of the box, or if a more actively-maintained option better fits your npm stack.
Pros
- Large, well-established user base (12M weekly downloads).
- Clear open-source license (MIT).
- Lean dependency tree (2 direct dependencies).
Cons
- No bundled TypeScript types (may require a separate @types package).
Auto-generated from collected registry metadata. No external claims are inferred.
Maintainers
Frequently asked questions
Should I use generate-function?
No — generate-function should not be adopted for new projects. Last published 2931 days ago.
How do I install generate-function?
Run `npm install generate-function` to add generate-function to your npm project.
How many dependencies does generate-function have?
generate-function declares 2 direct dependencies and pulls in 1 packages in total once its runtime tree is resolved totalling about 8.8 KB on disk.
What license is generate-function released under?
generate-function is distributed under the MIT license.
How popular is generate-function?
generate-function has approximately 11,999,809 downloads per week and 1 known dependent packages.
Is generate-function still maintained?
The most recent release of generate-function (v2.3.1) was published 8 years ago.
Does generate-function run install scripts?
No. generate-function does not define preinstall, install, or postinstall scripts, so installing it does not execute publisher-supplied code.