kingjs/descriptor.write
@Writes a value to a descriptor, cloning descriptors if frozen.
Usage
Set a few properties on a descriptor like this.
var write = require('@kingjs/descriptor.write');
var target = { foo: 0 };
write.call(target, 'bar', 0);
result:
{
foo: 0,
bar: 0,
}
API
declare function write(
descriptor: Descriptor,
name: string,
value: any
): Descriptor
Interfaces
-
Descriptor
: see @kingjs/descriptor
Parameters
-
this
: The descriptor whose property will be updated. -
name
: The property to write. -
value
: The updated value.
Returns
Returns a clone of this
with updated properties.
Install
With npm installed, run
$ npm install @kingjs/descriptor.write
License
MIT