@cauldria.dev/rename-function
v0.1.0
Published
Rename a JavaScript function: rebuild a named function from its source with a new name.
Readme
@cauldria.dev/rename-function
Rename a JavaScript function: returns a new function built from the original's source with a new name.
const { rename } = require("@cauldria.dev/rename-function");
function alpha() { return this.x; }
const beta = rename(alpha, "beta");
beta.name; // "beta"Works for the function name(...) declaration pattern; arrow functions and
methods are returned as-is (their source has no leading name to replace).
