Skip to content

Commit ef33f00

Browse files
committed
Document object properties
1 parent 3ac28da commit ef33f00

File tree

1 file changed

+11
-1
lines changed
  • lib/node_modules/@stdlib/utils/define-property/lib

1 file changed

+11
-1
lines changed

lib/node_modules/@stdlib/utils/define-property/lib/polyfill.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,19 @@ var lookupSetter = objectProtoype.__lookupSetter__;
4040
/**
4141
* Defines a property.
4242
*
43+
* ## Notes
44+
*
45+
* - Property descriptors come in two flavors: **data descriptors** and **accessor descriptors**. A data descriptor is a property that has a value, which may or may not be writable. An accessor descriptor is a property described by a getter-setter function pair. A descriptor must be one of these two flavors and cannot be both.
46+
*
4347
* @param {Object} obj - object on which to define the property
4448
* @param {string} prop - property name
45-
* @param {Object} descriptor - descriptor for the property
49+
* @param {Object} descriptor - property descriptor
50+
* @param {boolean} [descriptor.configurable=false] - boolean indicating if property descriptor can be changed and if the property can be deleted from the provided object
51+
* @param {boolean} [descriptor.enumerable=false] - boolean indicating if the property shows up when enumerating object properties
52+
* @param {boolean} [descriptor.writable=false] - boolean indicating if the value associated with the property can be changed with an assignment operator
53+
* @param {*} [descriptor.value] - property value
54+
* @param {(Function|void)} [descriptor.get=undefined] - function which serves as a getter for the property, or, if no getter, undefined. When the property is accessed, a getter function is called without arguments and with the `this` context set to the object through which the property is accessed (which may not be the object on which the property is defined due to inheritance). The return value will be used as the value of the property.
55+
* @param {(Function|void)} [descriptor.set=undefined] - function which serves as a setter for the property, or, if no setter, undefined. When assigning a property value, a setter function is called with one argument (the value being assigned to the property) and with the `this` context set to the object through which the property is assigned.
4656
* @throws {TypeError} first argument must be an object
4757
* @throws {TypeError} third argument must be an object
4858
* @throws {Error} property descriptor has both a value and a setter and/or getter

0 commit comments

Comments
 (0)