time-to-botec/js/node_modules/@stdlib/utils/define-configurable-read-write-accessor/docs/repl.txt

37 lines
711 B
Plaintext
Raw Normal View History

{{alias}}( obj, prop, getter, setter )
Defines a configurable property having read-write accessors.
Configurable read-write accessors are enumerable.
Parameters
----------
obj: Object
Object on which to define the property.
prop: string|symbol
Property name.
getter: Function
Get accessor.
setter: Function
Set accessor.
Examples
--------
> var obj = {};
> var name = 'bar';
> function getter() { return name + ' foo'; };
> function setter( v ) { name = v; };
> {{alias}}( obj, 'foo', getter, setter );
> obj.foo
'bar foo'
> obj.foo = 'beep';
> obj.foo
'beep foo'
See Also
--------