@nejs/basic-extensions 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.esdoc.json +9 -0
- package/README.md +2025 -11
- package/bin/clean +6 -0
- package/dist/@nejs/basic-extensions.bundle.1.6.1.js +4 -0
- package/dist/@nejs/basic-extensions.bundle.1.6.1.js.map +7 -0
- package/dist/cjs/arrayextensions.js +1 -0
- package/dist/cjs/arrayextensions.js.map +1 -0
- package/dist/cjs/functionextensions.js +1 -0
- package/dist/cjs/functionextensions.js.map +1 -0
- package/dist/cjs/globals.js +2 -1
- package/dist/cjs/globals.js.map +1 -0
- package/dist/cjs/index.d.ts +10 -19
- package/dist/cjs/index.js +69 -76
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/mapextensions.d.ts +2 -0
- package/dist/cjs/mapextensions.js +30 -0
- package/dist/cjs/mapextensions.js.map +1 -0
- package/dist/cjs/newClasses/asyncIterable.d.ts +123 -0
- package/dist/cjs/{asyncIterable.js → newClasses/asyncIterable.js} +7 -4
- package/dist/cjs/newClasses/asyncIterable.js.map +1 -0
- package/dist/cjs/newClasses/descriptor.d.ts +401 -0
- package/dist/cjs/{descriptor.js → newClasses/descriptor.js} +150 -80
- package/dist/cjs/newClasses/descriptor.js.map +1 -0
- package/dist/cjs/newClasses/iterable.d.ts +125 -0
- package/dist/cjs/{iterable.js → newClasses/iterable.js} +36 -10
- package/dist/cjs/newClasses/iterable.js.map +1 -0
- package/dist/cjs/newClasses/refmap.d.ts +238 -0
- package/dist/cjs/newClasses/refmap.js +433 -0
- package/dist/cjs/newClasses/refmap.js.map +1 -0
- package/dist/cjs/newClasses/refset.d.ts +186 -0
- package/dist/cjs/{refset.js → newClasses/refset.js} +18 -3
- package/dist/cjs/newClasses/refset.js.map +1 -0
- package/dist/cjs/objectextensions.d.ts +7 -6
- package/dist/cjs/objectextensions.js +85 -43
- package/dist/cjs/objectextensions.js.map +1 -0
- package/dist/cjs/reflectextensions.js +16 -12
- package/dist/cjs/reflectextensions.js.map +1 -0
- package/dist/cjs/stringextensions.js +1 -0
- package/dist/cjs/stringextensions.js.map +1 -0
- package/dist/cjs/symbolextensions.js +3 -1
- package/dist/cjs/symbolextensions.js.map +1 -0
- package/dist/cjs/weakrefextensions.js +1 -0
- package/dist/cjs/weakrefextensions.js.map +1 -0
- package/dist/mjs/arrayextensions.js +1 -0
- package/dist/mjs/arrayextensions.js.map +1 -0
- package/dist/mjs/functionextensions.js +1 -0
- package/dist/mjs/functionextensions.js.map +1 -0
- package/dist/mjs/globals.js +2 -1
- package/dist/mjs/globals.js.map +1 -0
- package/dist/mjs/index.d.ts +10 -19
- package/dist/mjs/index.js +67 -60
- package/dist/mjs/index.js.map +1 -0
- package/dist/mjs/mapextensions.d.ts +2 -0
- package/dist/mjs/mapextensions.js +27 -0
- package/dist/mjs/mapextensions.js.map +1 -0
- package/dist/mjs/newClasses/asyncIterable.d.ts +123 -0
- package/dist/mjs/{asyncIterable.js → newClasses/asyncIterable.js} +106 -105
- package/dist/mjs/newClasses/asyncIterable.js.map +1 -0
- package/dist/mjs/newClasses/descriptor.d.ts +401 -0
- package/dist/mjs/{descriptor.js → newClasses/descriptor.js} +129 -67
- package/dist/mjs/newClasses/descriptor.js.map +1 -0
- package/dist/mjs/newClasses/iterable.d.ts +125 -0
- package/dist/mjs/newClasses/iterable.js +199 -0
- package/dist/mjs/newClasses/iterable.js.map +1 -0
- package/dist/mjs/newClasses/refmap.d.ts +238 -0
- package/dist/mjs/newClasses/refmap.js +417 -0
- package/dist/mjs/newClasses/refmap.js.map +1 -0
- package/dist/mjs/newClasses/refset.d.ts +186 -0
- package/dist/mjs/{refset.js → newClasses/refset.js} +17 -3
- package/dist/mjs/newClasses/refset.js.map +1 -0
- package/dist/mjs/objectextensions.d.ts +7 -6
- package/dist/mjs/objectextensions.js +84 -42
- package/dist/mjs/objectextensions.js.map +1 -0
- package/dist/mjs/reflectextensions.js +16 -12
- package/dist/mjs/reflectextensions.js.map +1 -0
- package/dist/mjs/stringextensions.js +1 -0
- package/dist/mjs/stringextensions.js.map +1 -0
- package/dist/mjs/symbolextensions.js +3 -1
- package/dist/mjs/symbolextensions.js.map +1 -0
- package/dist/mjs/weakrefextensions.js +1 -0
- package/dist/mjs/weakrefextensions.js.map +1 -0
- package/docs/assets/anchor.js +350 -0
- package/docs/assets/bass-addons.css +12 -0
- package/docs/assets/bass.css +544 -0
- package/docs/assets/fonts/EOT/SourceCodePro-Bold.eot +0 -0
- package/docs/assets/fonts/EOT/SourceCodePro-Regular.eot +0 -0
- package/docs/assets/fonts/LICENSE.txt +93 -0
- package/docs/assets/fonts/OTF/SourceCodePro-Bold.otf +0 -0
- package/docs/assets/fonts/OTF/SourceCodePro-Regular.otf +0 -0
- package/docs/assets/fonts/TTF/SourceCodePro-Bold.ttf +0 -0
- package/docs/assets/fonts/TTF/SourceCodePro-Regular.ttf +0 -0
- package/docs/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff +0 -0
- package/docs/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff +0 -0
- package/docs/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff +0 -0
- package/docs/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff +0 -0
- package/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2 +0 -0
- package/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2 +0 -0
- package/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2 +0 -0
- package/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2 +0 -0
- package/docs/assets/fonts/source-code-pro.css +23 -0
- package/docs/assets/github.css +123 -0
- package/docs/assets/site.js +168 -0
- package/docs/assets/split.css +15 -0
- package/docs/assets/split.js +782 -0
- package/docs/assets/style.css +147 -0
- package/docs/index.html +13060 -0
- package/jsdoc-config.json +31 -0
- package/package.json +12 -3
- package/src/globals.js +1 -1
- package/src/index.js +75 -82
- package/src/mapextensions.js +30 -0
- package/src/{asyncIterable.js → newClasses/asyncIterable.js} +117 -117
- package/src/{descriptor.js → newClasses/descriptor.js} +137 -74
- package/src/newClasses/iterable.js +221 -0
- package/src/newClasses/refmap.js +483 -0
- package/src/{refset.js → newClasses/refset.js} +29 -16
- package/src/objectextensions.js +97 -46
- package/src/reflectextensions.js +16 -14
- package/src/symbolextensions.js +2 -1
- package/tests/index.test.js +1 -1
- package/tests/{asyncIterable.test.js → newClasses/asyncIterable.test.js} +3 -4
- package/tests/newClasses/descriptor.test.js +252 -0
- package/tests/{iterable.test.js → newClasses/iterable.test.js} +2 -4
- package/tests/newClasses/refmap.test.js +69 -0
- package/tests/{refset.test.js → newClasses/refset.test.js} +2 -4
- package/tests/objectextensions.test.js +128 -0
- package/tsconfig.base.json +2 -1
- package/dist/@nejs/basic-extensions.bundle.1.5.1.js +0 -2
- package/dist/@nejs/basic-extensions.bundle.1.5.1.js.map +0 -7
- package/dist/cjs/asyncIterable.d.ts +0 -3
- package/dist/cjs/descriptor.d.ts +0 -2
- package/dist/cjs/iterable.d.ts +0 -3
- package/dist/cjs/refset.d.ts +0 -2
- package/dist/mjs/asyncIterable.d.ts +0 -3
- package/dist/mjs/descriptor.d.ts +0 -2
- package/dist/mjs/iterable.d.ts +0 -3
- package/dist/mjs/iterable.js +0 -184
- package/dist/mjs/refset.d.ts +0 -2
- package/src/iterable.js +0 -203
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
export class Descriptor {
|
|
2
|
+
/**
|
|
3
|
+
* Shorthand for Object.getOwnPropertyDescriptor()
|
|
4
|
+
*
|
|
5
|
+
* @param {object} object a non-null object instance
|
|
6
|
+
* @param {string|symbol} key a symbol or string referencing which key on the
|
|
7
|
+
* object to return a descriptor for.
|
|
8
|
+
* @returns an object descriptor for the requested field or null
|
|
9
|
+
*/
|
|
10
|
+
static for(object: object, key: string | symbol, wrap?: boolean): PropertyDescriptor | Descriptor | null | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The function `getData` retrieves the value of a property from an object
|
|
13
|
+
* if it exists and is a data property.
|
|
14
|
+
*
|
|
15
|
+
* @param {object} object - The "object" parameter is the object from which
|
|
16
|
+
* we want to retrieve data.
|
|
17
|
+
* @param {string|symbol} property - The `property` parameter is the name of
|
|
18
|
+
* the property that you want to retrieve the data from.
|
|
19
|
+
* @returns either the value of the specified property if it exists and is
|
|
20
|
+
* a data property, or undefined if the property does not exist or is not
|
|
21
|
+
* a data property.
|
|
22
|
+
*/
|
|
23
|
+
static getData(object: object, property: string | symbol): any;
|
|
24
|
+
/**
|
|
25
|
+
* The function `getAccessor` checks if an object has a getter/setter accessor
|
|
26
|
+
* for a given property and returns the accessor functions if found.
|
|
27
|
+
*
|
|
28
|
+
* @param object - The `object` parameter is the object from which we want to
|
|
29
|
+
* retrieve the accessor for a specific property.
|
|
30
|
+
* @param property - The `property` parameter is the name of the property for
|
|
31
|
+
* which we want to get the accessor.
|
|
32
|
+
* @returns an object that contains the getter and setter functions for the
|
|
33
|
+
* specified property of the given object. If the property is an accessor
|
|
34
|
+
* property (defined with a getter and/or setter), the returned object will
|
|
35
|
+
* also have additional properties such as "accessor" and "descriptor". If
|
|
36
|
+
* the property is not found or is not an accessor property, the function
|
|
37
|
+
* returns undefined.
|
|
38
|
+
*/
|
|
39
|
+
static getAccessor(object: any, property: any): any;
|
|
40
|
+
/**
|
|
41
|
+
* The function returns an object with enumerable and configurable properties
|
|
42
|
+
* based on the input parameters.
|
|
43
|
+
*
|
|
44
|
+
* @param [enumerable=false] - A boolean value indicating whether the property
|
|
45
|
+
* can be enumerated (listed) when iterating over the object's properties.
|
|
46
|
+
* @param [configurable=false] - The `configurable` parameter determines
|
|
47
|
+
* whether the property can be deleted or its attributes can be modified.
|
|
48
|
+
* If `configurable` is set to `true`, the property can be deleted and its
|
|
49
|
+
* attributes can be changed. If `configurable` is set to `false`, the
|
|
50
|
+
* property cannot be deleted and
|
|
51
|
+
* @returns An object with the properties `enumerable` and `configurable` is
|
|
52
|
+
* being returned. The values of these properties are determined by the
|
|
53
|
+
* arguments passed to the `base` function.
|
|
54
|
+
*/
|
|
55
|
+
static base(enumerable?: boolean | undefined, configurable?: boolean | undefined): {
|
|
56
|
+
enumerable: boolean;
|
|
57
|
+
configurable: boolean;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* The function "newAccessor" creates a new property descriptor object with a
|
|
61
|
+
* getter and setter function, along with optional enumerable and configurable
|
|
62
|
+
* flags.
|
|
63
|
+
*
|
|
64
|
+
* @param getter - The getter parameter is a function that will be used as the
|
|
65
|
+
* getter for the property. It will be called when the property is accessed.
|
|
66
|
+
* @param setter - The `setter` parameter is a function that will be used as
|
|
67
|
+
* the setter for the property. It will be called whenever the property is
|
|
68
|
+
* assigned a new value.
|
|
69
|
+
* @param [] - - `getter`: A function that will be used as the getter for the
|
|
70
|
+
* property.
|
|
71
|
+
* @returns an object with properties "get", "set", "enumerable", and
|
|
72
|
+
* "configurable".
|
|
73
|
+
*/
|
|
74
|
+
static accessor(getter: any, setter: any, { enumerable, configurable }?: {
|
|
75
|
+
enumerable: boolean;
|
|
76
|
+
configurable: boolean;
|
|
77
|
+
} | undefined): {
|
|
78
|
+
get: any;
|
|
79
|
+
set: any;
|
|
80
|
+
enumerable: boolean;
|
|
81
|
+
configurable: boolean;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* The function "newData" creates a new data object with customizable
|
|
85
|
+
* properties.
|
|
86
|
+
*
|
|
87
|
+
* @param value - The value parameter represents the value that will be
|
|
88
|
+
* assigned to the property.
|
|
89
|
+
* @param [writable=true] - The `writable` parameter determines whether the
|
|
90
|
+
* value of the property can be changed. If `writable` is set to `true`, the
|
|
91
|
+
* value can be changed. If `writable` is set to `false`, the value cannot be
|
|
92
|
+
* changed.
|
|
93
|
+
* @param [] - - `value`: The value to be assigned to the property.
|
|
94
|
+
* @returns an object with properties `value`, `enumerable`, `writable`, and
|
|
95
|
+
* `configurable`.
|
|
96
|
+
*/
|
|
97
|
+
static data(value: any, writable?: boolean | undefined, { enumerable, configurable }?: {
|
|
98
|
+
enumerable: boolean;
|
|
99
|
+
configurable: boolean;
|
|
100
|
+
} | undefined): {
|
|
101
|
+
value: any;
|
|
102
|
+
enumerable: boolean;
|
|
103
|
+
writable: boolean;
|
|
104
|
+
configurable: boolean;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* The function checks if an object is a likely an object descriptor in
|
|
108
|
+
* JavaScript. This is determined as an object with some of the known
|
|
109
|
+
* descriptor keys (e.g. enumerable, configurable, value, writable, get,
|
|
110
|
+
* or set). Technically, any object could serve as a descriptor but this
|
|
111
|
+
* function only returns true if known descriptor keys are found.
|
|
112
|
+
*
|
|
113
|
+
* @param object - The `object` parameter is the object that we want to
|
|
114
|
+
* check if it is a descriptor.
|
|
115
|
+
* @returns a boolean value.
|
|
116
|
+
*/
|
|
117
|
+
static isDescriptor(object: any): any;
|
|
118
|
+
/**
|
|
119
|
+
* The function checks if a given property or descriptor is a data property.
|
|
120
|
+
*
|
|
121
|
+
* brie
|
|
122
|
+
*
|
|
123
|
+
* @param descriptor_orProp - The `descriptor_orProp` parameter can be
|
|
124
|
+
* either a descriptor or a property name.
|
|
125
|
+
* @param object - The `object` parameter is the object that you want to
|
|
126
|
+
* check for data properties.
|
|
127
|
+
* @returns a boolean value. It returns `true` if the `descriptor` object
|
|
128
|
+
* has any keys that match the `DATA_KEYS` array, otherwise it returns
|
|
129
|
+
* `false`.
|
|
130
|
+
*/
|
|
131
|
+
static isData(object_orProp: any, property: any): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* The function checks if a given property descriptor or property of an
|
|
134
|
+
* object is an accessor.
|
|
135
|
+
*
|
|
136
|
+
* @param object_orProp - The `descriptor_orProp` parameter can be either a
|
|
137
|
+
* descriptor object or a property name.
|
|
138
|
+
* @param property - The `object` parameter is the object that you want to
|
|
139
|
+
* check for accessor properties.
|
|
140
|
+
* @returns a boolean value. It returns true if the descriptor or property
|
|
141
|
+
* passed as an argument is an accessor descriptor, and false otherwise.
|
|
142
|
+
*/
|
|
143
|
+
static isAccessor(object_orProp: any, property: any): boolean;
|
|
144
|
+
/**
|
|
145
|
+
* A base descriptor (new for each read) that is both enumerable and
|
|
146
|
+
* configurable
|
|
147
|
+
*
|
|
148
|
+
* @returns The method `flexible` is returning the result of calling the
|
|
149
|
+
* `base` method with the arguments `true` and `true`.
|
|
150
|
+
*/
|
|
151
|
+
static get flexible(): {
|
|
152
|
+
enumerable: boolean;
|
|
153
|
+
configurable: boolean;
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* A base descriptor (new for each read) that is not enumerable but is
|
|
157
|
+
* configurable
|
|
158
|
+
*
|
|
159
|
+
* @returns The method `enigmatic` is returning the result of calling
|
|
160
|
+
* the `base` method with the arguments `false` and `true`.
|
|
161
|
+
*/
|
|
162
|
+
static get enigmatic(): {
|
|
163
|
+
enumerable: boolean;
|
|
164
|
+
configurable: boolean;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* A base descriptor (new for each read) that is neither enumerable
|
|
168
|
+
* nor configurable
|
|
169
|
+
*
|
|
170
|
+
* @returns The code is returning the result of calling the `base` method with
|
|
171
|
+
* the arguments `false` and `false`.
|
|
172
|
+
*/
|
|
173
|
+
static get intrinsic(): {
|
|
174
|
+
enumerable: boolean;
|
|
175
|
+
configurable: boolean;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* A base descriptor (new for each read) that enumerable but not configurable
|
|
179
|
+
*
|
|
180
|
+
* @returns The method is returning the result of calling the `base`
|
|
181
|
+
* method with the arguments `true` and `false`.
|
|
182
|
+
*/
|
|
183
|
+
static get transparent(): {
|
|
184
|
+
enumerable: boolean;
|
|
185
|
+
configurable: boolean;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* The function returns an array of shared descriptor keys.
|
|
189
|
+
*
|
|
190
|
+
* @returns An array containing the strings 'configurable' and 'enumerable'.
|
|
191
|
+
*/
|
|
192
|
+
static get SHARED_KEYS(): string[];
|
|
193
|
+
/**
|
|
194
|
+
* The function returns an array of accessor descriptor keys.
|
|
195
|
+
*
|
|
196
|
+
* @returns An array containing the strings 'get' and 'set' is being returned.
|
|
197
|
+
*/
|
|
198
|
+
static get ACCESSOR_KEYS(): string[];
|
|
199
|
+
/**
|
|
200
|
+
* The function returns an array of data descriptor keys.
|
|
201
|
+
*
|
|
202
|
+
* @returns An array containing the strings 'value' and 'writable' is being
|
|
203
|
+
* returned.
|
|
204
|
+
*/
|
|
205
|
+
static get DATA_KEYS(): string[];
|
|
206
|
+
/**
|
|
207
|
+
* Creates a new instance of Descriptor either from another object or
|
|
208
|
+
* around the supplied object descriptor value.
|
|
209
|
+
*
|
|
210
|
+
* @param {object} object either an object descriptor or the object
|
|
211
|
+
* from which to get the descriptor
|
|
212
|
+
* @param {symbol|string} key a valid key for accessing the descriptor
|
|
213
|
+
* on the aforesupplied object.
|
|
214
|
+
*/
|
|
215
|
+
constructor(object: object, key: symbol | string);
|
|
216
|
+
/**
|
|
217
|
+
* Detects whether or not this instance is an accessor object descriptor
|
|
218
|
+
*
|
|
219
|
+
* @returns {boolean} true if this object has a getter or setter and is not
|
|
220
|
+
* a data descriptor
|
|
221
|
+
*/
|
|
222
|
+
get isAccessor(): boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Detects whether or not this instance is an data object descriptor
|
|
225
|
+
*
|
|
226
|
+
* @returns {boolean} true if this object has a value property and is not
|
|
227
|
+
* an accessor descriptor
|
|
228
|
+
*/
|
|
229
|
+
get isData(): boolean;
|
|
230
|
+
/**
|
|
231
|
+
* Detects whether or not this instance is a valid object descriptor
|
|
232
|
+
*
|
|
233
|
+
* @returns {boolean} true if this descriptor store is a valid descriptor
|
|
234
|
+
*/
|
|
235
|
+
get isDescriptor(): boolean;
|
|
236
|
+
/**
|
|
237
|
+
* Sets the `configurable` value of this object. If the internal descriptor
|
|
238
|
+
* store store is invalid, the value is thrown away
|
|
239
|
+
*
|
|
240
|
+
* @param {boolean} value the value to set for the `configurable` descriptor
|
|
241
|
+
* property. If this value is not a `boolean` it will be converted to one
|
|
242
|
+
*/
|
|
243
|
+
set configurable(value: boolean);
|
|
244
|
+
/**
|
|
245
|
+
* Getter around the `configurable` object descriptor property of
|
|
246
|
+
* this instance of Descriptor.
|
|
247
|
+
*
|
|
248
|
+
* @returns {boolean} a boolean value or undefined if the internal
|
|
249
|
+
* descriptor store is invalid.
|
|
250
|
+
*/
|
|
251
|
+
get configurable(): boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Sets the `enumerable` value of this object. If the internal descriptor
|
|
254
|
+
* store is invalid, the value is thrown away
|
|
255
|
+
*
|
|
256
|
+
* @param {boolean} value the value to set for the `enumerable` descriptor
|
|
257
|
+
* property. If this value is not a `boolean` it will be converted to one
|
|
258
|
+
*/
|
|
259
|
+
set enumerable(value: boolean);
|
|
260
|
+
/**
|
|
261
|
+
* Getter around the `enumerable` object descriptor property of
|
|
262
|
+
* this instance of Descriptor.
|
|
263
|
+
*
|
|
264
|
+
* @returns {boolean} a boolean value or undefined if the internal
|
|
265
|
+
* descriptor store is invalid.
|
|
266
|
+
*/
|
|
267
|
+
get enumerable(): boolean;
|
|
268
|
+
/**
|
|
269
|
+
* Sets the `writable` value of this object. If the internal descriptor
|
|
270
|
+
* store is invalid, the value is thrown away
|
|
271
|
+
*
|
|
272
|
+
* @param {boolean} value the value to set for the `writable` descriptor
|
|
273
|
+
* property. If this value is not a `boolean` it will be converted to one
|
|
274
|
+
*/
|
|
275
|
+
set writable(value: boolean);
|
|
276
|
+
/**
|
|
277
|
+
* Getter around the `writable` object descriptor property of
|
|
278
|
+
* this instance of Descriptor.
|
|
279
|
+
*
|
|
280
|
+
* @returns {boolean} a boolean value or undefined if the internal
|
|
281
|
+
* descriptor store is invalid.
|
|
282
|
+
*/
|
|
283
|
+
get writable(): boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Sets the `value` value of this object. If the internal descriptor
|
|
286
|
+
* store is invalid, the value is thrown away
|
|
287
|
+
*
|
|
288
|
+
* @param {any} value the value to set for the `value` descriptor
|
|
289
|
+
* property.
|
|
290
|
+
*/
|
|
291
|
+
set value(value: any);
|
|
292
|
+
/**
|
|
293
|
+
* Getter around the `value` object descriptor property of
|
|
294
|
+
* this instance of Descriptor.
|
|
295
|
+
*
|
|
296
|
+
* @returns {any} any value stored in this descriptor
|
|
297
|
+
*/
|
|
298
|
+
get value(): any;
|
|
299
|
+
/**
|
|
300
|
+
* Sets the `get` value of this object. If the internal descriptor
|
|
301
|
+
* store is invalid, the value is thrown away
|
|
302
|
+
*
|
|
303
|
+
* @param {function} value the getter function for this descriptor
|
|
304
|
+
*/
|
|
305
|
+
set get(value: Function);
|
|
306
|
+
/**
|
|
307
|
+
* Getter around the `get` object descriptor property of
|
|
308
|
+
* this instance of Descriptor.
|
|
309
|
+
*
|
|
310
|
+
* @returns {function} a function if the getter for this descriptor is
|
|
311
|
+
* defined or `undefined` if the internal descriptor object or the getter
|
|
312
|
+
* is undefined.
|
|
313
|
+
*/
|
|
314
|
+
get get(): Function;
|
|
315
|
+
/**
|
|
316
|
+
* Retrieves the {@link get} function for this accessor and binds it to
|
|
317
|
+
* the object from which the descriptor was derived, if that value is set.
|
|
318
|
+
* Otherwise this method is identical to the {@link get} accessor.
|
|
319
|
+
*
|
|
320
|
+
* @returns {function} the getter if one is defined. If possible this
|
|
321
|
+
* getter will be bound the associated and previously set `object`.
|
|
322
|
+
*/
|
|
323
|
+
get boundGet(): Function;
|
|
324
|
+
/**
|
|
325
|
+
* Sets the `set` value of this object. If the internal descriptor
|
|
326
|
+
* store is invalid, the value is thrown away
|
|
327
|
+
*
|
|
328
|
+
* @param {function} value the setter function for this descriptor
|
|
329
|
+
*/
|
|
330
|
+
set set(value: Function);
|
|
331
|
+
/**
|
|
332
|
+
* Getter around the `set` object descriptor property of
|
|
333
|
+
* this instance of Descriptor.
|
|
334
|
+
*
|
|
335
|
+
* @returns {function} a function if the setter for this descriptor is
|
|
336
|
+
* defined or `undefined` if the internal descriptor object or the setter
|
|
337
|
+
* is undefined.
|
|
338
|
+
*/
|
|
339
|
+
get set(): Function;
|
|
340
|
+
/**
|
|
341
|
+
* Retrieves the {@link set} function for this accessor and binds it to
|
|
342
|
+
* the object from which the descriptor was derived, if that value is set.
|
|
343
|
+
* Otherwise this method is identical to the {@link set} accessor.
|
|
344
|
+
*
|
|
345
|
+
* @returns {function} the setter if one is defined. If possible this
|
|
346
|
+
* setter will be bound the associated and previously set `object`.
|
|
347
|
+
*/
|
|
348
|
+
get boundSet(): Function;
|
|
349
|
+
/**
|
|
350
|
+
* The function checks the descriptor's associated object has been set on this
|
|
351
|
+
* instance of `Descriptor`.
|
|
352
|
+
*
|
|
353
|
+
* @returns {boolean} `true` if the `object` property has been set,
|
|
354
|
+
* `false` otherwise
|
|
355
|
+
*/
|
|
356
|
+
get hasObject(): boolean;
|
|
357
|
+
/**
|
|
358
|
+
* Sets the descriptor's associated `object` value. This is usually the
|
|
359
|
+
* parent object from which the descriptor was derived.
|
|
360
|
+
*
|
|
361
|
+
* @param {object} value sets the object for which this descriptor is to
|
|
362
|
+
* be associated with.
|
|
363
|
+
*/
|
|
364
|
+
set object(value: object);
|
|
365
|
+
/**
|
|
366
|
+
* Returns the descriptor's associated `object` value. This is usually the
|
|
367
|
+
* parent object from which the descriptor was derived. If the value is preset
|
|
368
|
+
* it will be returned. Undefined will be returned otherwise
|
|
369
|
+
*
|
|
370
|
+
* @returns {object} the associated object for this descriptor or undefined
|
|
371
|
+
* if it has not yet been set.
|
|
372
|
+
*/
|
|
373
|
+
get object(): object;
|
|
374
|
+
/**
|
|
375
|
+
* Take the descriptor defined by this objects values and apply them to
|
|
376
|
+
* the specified object using the specified key.
|
|
377
|
+
*
|
|
378
|
+
* @param {object} object the object to apply this descriptor to
|
|
379
|
+
* @param {string|symbol} forKey the string or symbol for which this
|
|
380
|
+
* descriptor will abe applied
|
|
381
|
+
*/
|
|
382
|
+
applyTo(object: object, forKey: string | symbol): object;
|
|
383
|
+
/**
|
|
384
|
+
* Converts this descriptor object into a base representation
|
|
385
|
+
*
|
|
386
|
+
* @param {string} hint one of `string`, `number` or default;
|
|
387
|
+
* @returns if the hint is 'string', then a string identifying the enum
|
|
388
|
+
* and its type is returned. `number` will always be NaN since it is incoret
|
|
389
|
+
*/
|
|
390
|
+
[Symbol.toPrimitive](hint: string): string | number | object | undefined;
|
|
391
|
+
/**
|
|
392
|
+
* Ensures that the constructor of this object instance's name
|
|
393
|
+
* is returned if the string tag for this instance is queried
|
|
394
|
+
*
|
|
395
|
+
* @returns {string} the name of the class
|
|
396
|
+
*/
|
|
397
|
+
get [Symbol.toStringTag](): string;
|
|
398
|
+
#private;
|
|
399
|
+
}
|
|
400
|
+
export const DescriptorExtensions: Extension;
|
|
401
|
+
import { Extension } from '@nejs/extension';
|