Renames a function.
npm install @kingjs/function-ex.renamejs
var assert = require('assert');
var Rename = require('@kingjs/function-ex.rename');function foo() { }
var fooDescriptor = Object.getOwnPropertyDescriptor(foo, 'name');
assert(fooDescriptor.value == 'foo');
var bar = fooRename;
var barDescriptor = Object.getOwnPropertyDescriptor(foo, 'name');
assert(barDescriptor.value == 'bar');
assert(barDescriptor.enumerable == fooDescriptor.enumerable);
assert(barDescriptor.configurable == fooDescriptor.configurable);
assert(barDescriptor.writable == fooDescriptor.writable);
`API
`ts
rename(this, string)
`
$3
- this: The function to rename.
- string: The name to assign the function.
$3
Returns the function.Install
With npm installed, run
`
$ npm install @kingjs/function-ex.rename
``[@kingjs]: https://www.npmjs.com/package/kingjs
[ns0]: https://www.npmjs.com/package/@kingjs/function-ex
[ns1]: https://www.npmjs.com/package/@kingjs/function-ex.rename