Have ideas to improve npm?Join in the discussion! »

    rename-function-x

    1.1.2 • Public • Published

    Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

    rename-function-x

    Rename a function.

    Note: This is not supported in all environments. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name#Browser_compatibility

    Example

    import renameFunction from 'rename-function-x';
     
    const fn = function test() {};
    console.log(renameFunction(fn, 'hw')); // true if a success, else false
    console.log(fn.name); // hw if set, else test
     
    // The following would normally throw an error as it is a reserved name.
    // However, you can for the rename as follows.
    console.log(renameFunction(fn, 'catch', true)); // true if a success, else false

    Install

    npm i rename-function-x

    DownloadsWeekly Downloads

    10

    Version

    1.1.2

    License

    MIT

    Unpacked Size

    338 kB

    Total Files

    11

    Last publish

    Collaborators

    • avatar