@kingjs/reflect.define-function
v1.0.3
Published
Extends `kingjs/reflect.define-property` with richer overloads.
Downloads
5
Readme
@kingjs/reflect.define-function
Extends kingjs/reflect.define-property
with richer overloads.
Usage
var assert = require('assert');
var defineFunction = require('@kingjs/reflect.define-function');
var target = defineFunction({ bar: 1 }, 'foo', 'this.bar');
assert(target.foo() == 1);
API
defineFunction(target, name, descriptor)
Overloads
defineField(target, name, string)
=> defineProperty(target, name, { value: lambda, function: true });
// inherited from @kingjs/reflect.define-property
defineField(...)
=> defineProperty(...);
Parameters
target
: The target on which the property will be defined.name
: The name of the property.descriptor
: A descriptor describing the property.
Install
With npm installed, run
$ npm install @kingjs/reflect.define-function
Dependencies
|Package|Version|
|---|---|
|@kingjs/is
|^1.0.9
|
|@kingjs/reflect.define-property
|^1.0.2
|
Source
https://repository.kingjs.net/reflect/define-function
License
MIT