This package has been deprecated

Author message:

see @kingjs/reflect.descriptor.rename

@kingjs/property-descriptor.rename

1.0.3 • Public • Published

@kingjs/property-descriptor.rename

Renames functions found in a descriptor.

Usage

var assert = require('assert');
var rename = require('@kingjs/property-descriptor.rename');

var foo = {
  value: function foo() { }
}
foo = rename.call(foo, '${name} (thunk)');
assert(foo.value.name == 'foo (thunk)');

var bar = {
  get: function getBar() { }, 
  set: function setBar(value) { }
}
bar = rename.call(bar, '${name} (stub)');
assert(bar.get.name == 'getBar (stub)');
assert(bar.set.name == 'setBar (stub)');

API

rename(this, template)

Parameters

  • this: The descriptor whose functions will be renamed.
  • template: The name to assign to each function. A placeholder for name will be expanded to the name of the function being replaced.

Returns

Returns the descriptor with its functions renamed.

Install

With npm installed, run

$ npm install @kingjs/property-descriptor.rename

Source

https://repository.kingjs.net/property-descriptor/rename

License

MIT

Analytics

Dependencies (3)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @kingjs/property-descriptor.rename

    Weekly Downloads

    1

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    4.04 kB

    Total Files

    5

    Last publish

    Collaborators

    • kingces95