@ohos-ports/stdlib-object 0.0.0-stage → 0.4.1-beta.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.
Files changed (207) hide show
  1. package/LICENSE +177 -0
  2. package/NOTICE +1 -0
  3. package/README.md +262 -2
  4. package/SECURITY.md +5 -0
  5. package/any-in-by/README.md +217 -0
  6. package/any-in-by/docs/repl.txt +41 -0
  7. package/any-in-by/docs/types/index.d.ts +102 -0
  8. package/any-in-by/docs/types/test.ts +53 -0
  9. package/any-in-by/lib/index.js +50 -0
  10. package/any-in-by/lib/main.js +75 -0
  11. package/any-in-by/package.json +66 -0
  12. package/any-own-by/README.md +221 -0
  13. package/any-own-by/docs/repl.txt +43 -0
  14. package/any-own-by/docs/types/index.d.ts +101 -0
  15. package/any-own-by/docs/types/test.ts +63 -0
  16. package/any-own-by/lib/index.js +46 -0
  17. package/any-own-by/lib/main.js +77 -0
  18. package/any-own-by/package.json +70 -0
  19. package/assign/README.md +139 -0
  20. package/assign/docs/repl.txt +34 -0
  21. package/assign/docs/types/index.d.ts +113 -0
  22. package/assign/docs/types/test.ts +47 -0
  23. package/assign/lib/builtin.js +55 -0
  24. package/assign/lib/has_object_assign.js +33 -0
  25. package/assign/lib/index.js +52 -0
  26. package/assign/lib/polyfill.js +86 -0
  27. package/assign/package.json +64 -0
  28. package/assign-in/README.md +145 -0
  29. package/assign-in/docs/repl.txt +34 -0
  30. package/assign-in/docs/types/index.d.ts +175 -0
  31. package/assign-in/docs/types/test.ts +44 -0
  32. package/assign-in/lib/index.js +54 -0
  33. package/assign-in/lib/main.js +92 -0
  34. package/assign-in/package.json +60 -0
  35. package/bifurcate-in/README.md +298 -0
  36. package/bifurcate-in/docs/repl.txt +68 -0
  37. package/bifurcate-in/docs/types/index.d.ts +189 -0
  38. package/bifurcate-in/docs/types/test.ts +97 -0
  39. package/bifurcate-in/lib/index.js +106 -0
  40. package/bifurcate-in/lib/main.js +148 -0
  41. package/bifurcate-in/lib/return_keys.js +81 -0
  42. package/bifurcate-in/lib/return_pairs.js +87 -0
  43. package/bifurcate-in/lib/return_values.js +87 -0
  44. package/bifurcate-in/lib/validate.js +76 -0
  45. package/bifurcate-in/package.json +72 -0
  46. package/bifurcate-own/README.md +255 -0
  47. package/bifurcate-own/docs/repl.txt +63 -0
  48. package/bifurcate-own/docs/types/index.d.ts +183 -0
  49. package/bifurcate-own/docs/types/test.ts +97 -0
  50. package/bifurcate-own/lib/index.js +87 -0
  51. package/bifurcate-own/lib/main.js +127 -0
  52. package/bifurcate-own/lib/return_keys.js +81 -0
  53. package/bifurcate-own/lib/return_pairs.js +87 -0
  54. package/bifurcate-own/lib/return_values.js +87 -0
  55. package/bifurcate-own/lib/validate.js +76 -0
  56. package/bifurcate-own/package.json +71 -0
  57. package/capitalize-keys/README.md +139 -0
  58. package/capitalize-keys/docs/repl.txt +28 -0
  59. package/capitalize-keys/docs/types/index.d.ts +46 -0
  60. package/capitalize-keys/docs/types/test.ts +33 -0
  61. package/capitalize-keys/lib/index.js +45 -0
  62. package/capitalize-keys/lib/main.js +69 -0
  63. package/capitalize-keys/package.json +76 -0
  64. package/common-keys/README.md +125 -0
  65. package/common-keys/docs/repl.txt +29 -0
  66. package/common-keys/docs/types/index.d.ts +70 -0
  67. package/common-keys/docs/types/test.ts +33 -0
  68. package/common-keys/lib/index.js +51 -0
  69. package/common-keys/lib/main.js +106 -0
  70. package/common-keys/package.json +70 -0
  71. package/common-keys-in/README.md +125 -0
  72. package/common-keys-in/docs/repl.txt +29 -0
  73. package/common-keys-in/docs/types/index.d.ts +70 -0
  74. package/common-keys-in/docs/types/test.ts +33 -0
  75. package/common-keys-in/lib/index.js +51 -0
  76. package/common-keys-in/lib/main.js +106 -0
  77. package/common-keys-in/package.json +72 -0
  78. package/ctor/README.md +536 -0
  79. package/ctor/docs/repl.txt +592 -0
  80. package/ctor/docs/types/index.d.ts +56 -0
  81. package/ctor/docs/types/test.ts +33 -0
  82. package/ctor/lib/index.js +54 -0
  83. package/ctor/lib/main.js +58 -0
  84. package/ctor/package.json +58 -0
  85. package/deep-get/README.md +181 -0
  86. package/deep-get/docs/repl.txt +63 -0
  87. package/deep-get/docs/types/index.d.ts +125 -0
  88. package/deep-get/docs/types/test.ts +109 -0
  89. package/deep-get/lib/defaults.js +38 -0
  90. package/deep-get/lib/dget.js +57 -0
  91. package/deep-get/lib/factory.js +94 -0
  92. package/deep-get/lib/index.js +58 -0
  93. package/deep-get/lib/main.js +101 -0
  94. package/deep-get/lib/validate.js +66 -0
  95. package/deep-get/package.json +68 -0
  96. package/deep-set/README.md +273 -0
  97. package/deep-set/docs/repl.txt +87 -0
  98. package/deep-set/docs/types/index.d.ts +180 -0
  99. package/deep-set/docs/types/test.ts +134 -0
  100. package/deep-set/lib/defaults.js +39 -0
  101. package/deep-set/lib/dset.js +80 -0
  102. package/deep-set/lib/factory.js +99 -0
  103. package/deep-set/lib/index.js +58 -0
  104. package/deep-set/lib/main.js +120 -0
  105. package/deep-set/lib/validate.js +74 -0
  106. package/deep-set/package.json +69 -0
  107. package/docs/types/index.d.ts +964 -0
  108. package/every-in-by/README.md +156 -0
  109. package/every-in-by/docs/repl.txt +43 -0
  110. package/every-in-by/docs/types/index.d.ts +83 -0
  111. package/every-in-by/docs/types/test.ts +60 -0
  112. package/every-in-by/lib/index.js +51 -0
  113. package/every-in-by/lib/main.js +70 -0
  114. package/every-in-by/package.json +67 -0
  115. package/every-own-by/README.md +223 -0
  116. package/every-own-by/docs/repl.txt +43 -0
  117. package/every-own-by/docs/types/index.d.ts +102 -0
  118. package/every-own-by/docs/types/test.ts +62 -0
  119. package/every-own-by/lib/index.js +46 -0
  120. package/every-own-by/lib/main.js +77 -0
  121. package/every-own-by/package.json +68 -0
  122. package/for-in/README.md +218 -0
  123. package/for-in/docs/repl.txt +44 -0
  124. package/for-in/docs/types/index.d.ts +65 -0
  125. package/for-in/docs/types/test.ts +50 -0
  126. package/for-in/lib/index.js +54 -0
  127. package/for-in/lib/main.js +82 -0
  128. package/for-in/package.json +74 -0
  129. package/for-own/README.md +209 -0
  130. package/for-own/docs/repl.txt +49 -0
  131. package/for-own/docs/types/index.d.ts +63 -0
  132. package/for-own/docs/types/test.ts +50 -0
  133. package/for-own/lib/index.js +50 -0
  134. package/for-own/lib/main.js +85 -0
  135. package/for-own/package.json +71 -0
  136. package/inverse/README.md +163 -0
  137. package/inverse/docs/repl.txt +53 -0
  138. package/inverse/docs/types/index.d.ts +66 -0
  139. package/inverse/docs/types/test.ts +60 -0
  140. package/inverse/lib/index.js +59 -0
  141. package/inverse/lib/main.js +123 -0
  142. package/inverse/package.json +69 -0
  143. package/inverse-by/README.md +205 -0
  144. package/inverse-by/docs/repl.txt +67 -0
  145. package/inverse-by/docs/types/index.d.ts +160 -0
  146. package/inverse-by/docs/types/test.ts +81 -0
  147. package/inverse-by/lib/index.js +78 -0
  148. package/inverse-by/lib/main.js +148 -0
  149. package/inverse-by/package.json +75 -0
  150. package/lib/index.js +276 -0
  151. package/lowercase-keys/README.md +139 -0
  152. package/lowercase-keys/docs/repl.txt +28 -0
  153. package/lowercase-keys/docs/types/index.d.ts +46 -0
  154. package/lowercase-keys/docs/types/test.ts +33 -0
  155. package/lowercase-keys/lib/index.js +45 -0
  156. package/lowercase-keys/lib/main.js +63 -0
  157. package/lowercase-keys/package.json +74 -0
  158. package/move-property/README.md +144 -0
  159. package/move-property/docs/repl.txt +38 -0
  160. package/move-property/docs/types/index.d.ts +53 -0
  161. package/move-property/docs/types/test.ts +46 -0
  162. package/move-property/lib/index.js +46 -0
  163. package/move-property/lib/main.js +74 -0
  164. package/move-property/package.json +69 -0
  165. package/none-in-by/README.md +241 -0
  166. package/none-in-by/docs/repl.txt +42 -0
  167. package/none-in-by/docs/types/index.d.ts +101 -0
  168. package/none-in-by/docs/types/test.ts +61 -0
  169. package/none-in-by/lib/index.js +46 -0
  170. package/none-in-by/lib/main.js +71 -0
  171. package/none-in-by/package.json +68 -0
  172. package/none-own-by/README.md +177 -0
  173. package/none-own-by/docs/repl.txt +42 -0
  174. package/none-own-by/docs/types/index.d.ts +102 -0
  175. package/none-own-by/docs/types/test.ts +61 -0
  176. package/none-own-by/lib/index.js +50 -0
  177. package/none-own-by/lib/main.js +75 -0
  178. package/none-own-by/package.json +68 -0
  179. package/package.json +66 -4
  180. package/some-in-by/README.md +232 -0
  181. package/some-in-by/docs/repl.txt +45 -0
  182. package/some-in-by/docs/types/index.d.ts +104 -0
  183. package/some-in-by/docs/types/test.ts +66 -0
  184. package/some-in-by/lib/index.js +46 -0
  185. package/some-in-by/lib/main.js +87 -0
  186. package/some-in-by/package.json +75 -0
  187. package/some-own-by/README.md +251 -0
  188. package/some-own-by/docs/repl.txt +45 -0
  189. package/some-own-by/docs/types/index.d.ts +103 -0
  190. package/some-own-by/docs/types/test.ts +66 -0
  191. package/some-own-by/lib/index.js +46 -0
  192. package/some-own-by/lib/main.js +85 -0
  193. package/some-own-by/package.json +72 -0
  194. package/uncapitalize-keys/README.md +139 -0
  195. package/uncapitalize-keys/docs/repl.txt +28 -0
  196. package/uncapitalize-keys/docs/types/index.d.ts +46 -0
  197. package/uncapitalize-keys/docs/types/test.ts +33 -0
  198. package/uncapitalize-keys/lib/index.js +45 -0
  199. package/uncapitalize-keys/lib/main.js +69 -0
  200. package/uncapitalize-keys/package.json +76 -0
  201. package/uppercase-keys/README.md +139 -0
  202. package/uppercase-keys/docs/repl.txt +28 -0
  203. package/uppercase-keys/docs/types/index.d.ts +46 -0
  204. package/uppercase-keys/docs/types/test.ts +33 -0
  205. package/uppercase-keys/lib/index.js +45 -0
  206. package/uppercase-keys/lib/main.js +63 -0
  207. package/uppercase-keys/package.json +74 -0
@@ -0,0 +1,592 @@
1
+
2
+ {{alias}}( value )
3
+ Returns an object.
4
+
5
+ If provided `null` or `undefined`, the function returns an empty object.
6
+
7
+ If provided an existing object, the function returns the input value
8
+ unchanged.
9
+
10
+ Otherwise, if provided any other value (e.g., a number, string, etc), the
11
+ function will return an object of the corresponding type.
12
+
13
+ Parameters
14
+ ----------
15
+ value: any
16
+ Input value.
17
+
18
+ Returns
19
+ -------
20
+ out: Object
21
+ Output object.
22
+
23
+ Examples
24
+ --------
25
+ > var o = new {{alias}}( null )
26
+ {}
27
+ > o = new {{alias}}( 5.0 )
28
+ <Number>
29
+ > o = new {{alias}}( 'beep' )
30
+ <String>
31
+
32
+ {{alias}}.assign( target, ...sources )
33
+ Assigns enumerable and own properties from source objects to a target
34
+ object.
35
+
36
+ Parameters
37
+ ----------
38
+ target: Object
39
+ Target object.
40
+
41
+ sources: ...Object
42
+ Source objects.
43
+
44
+ Returns
45
+ -------
46
+ out: Object
47
+ Target object.
48
+
49
+ Examples
50
+ --------
51
+ > var o = {{alias}}.assign( {}, { 'a': 1 }, { 'b': 2 } )
52
+ { 'a': 1, 'b': 2 }
53
+
54
+ {{alias}}.create( prototype, properties )
55
+ Creates a new object with a specified prototype object and properties.
56
+
57
+ Parameters
58
+ ----------
59
+ prototype: Object
60
+ Prototype object.
61
+
62
+ properties: Object
63
+ Properties object.
64
+
65
+ Returns
66
+ -------
67
+ out: Object
68
+ New object.
69
+
70
+ Examples
71
+ --------
72
+ > var o = {{alias}}.create( {}, { 'a': { 'value': 1 } } )
73
+ { 'a': 1 }
74
+
75
+ {{alias}}.defineProperties( obj, properties )
76
+ Defines properties for an object.
77
+
78
+ Parameters
79
+ ----------
80
+ obj: Object
81
+ Object.
82
+
83
+ properties: Object
84
+ Properties object.
85
+
86
+ Returns
87
+ -------
88
+ out: Object
89
+ Object.
90
+
91
+ Examples
92
+ --------
93
+ > var o = {{alias}}.defineProperties( {}, { 'a': { 'value': 1 } } )
94
+ { 'a': 1 }
95
+
96
+ {{alias}}.defineProperty( obj, key, descriptor )
97
+ Defines a property for an object.
98
+
99
+ Parameters
100
+ ----------
101
+ obj: Object
102
+ Object.
103
+
104
+ key: string
105
+ Property key.
106
+
107
+ descriptor: Object
108
+ Property descriptor.
109
+
110
+ Returns
111
+ -------
112
+ out: Object
113
+ Object.
114
+
115
+ Examples
116
+ --------
117
+ > var o = {{alias}}.defineProperty( {}, 'a', {
118
+ 'value': 1,
119
+ 'enumerable': true,
120
+ 'configurable': true,
121
+ 'writable': false
122
+ })
123
+ { 'a': 1 }
124
+
125
+ {{alias}}.entries( obj )
126
+ Returns an array of an object's own enumerable string-keyed property
127
+ [key, value] pairs.
128
+
129
+ Parameters
130
+ ----------
131
+ obj: Object
132
+ Object.
133
+
134
+ Returns
135
+ -------
136
+ out: Array
137
+ Array of [key, value] pairs.
138
+
139
+ Examples
140
+ --------
141
+ > var o = {{alias}}.entries( { 'a': 1, 'b': 2 } )
142
+ [ [ 'a', 1 ], [ 'b', 2 ] ]
143
+
144
+ {{alias}}.freeze( obj )
145
+ Freezes an object.
146
+
147
+ Parameters
148
+ ----------
149
+ obj: Object
150
+ Object.
151
+
152
+ Returns
153
+ -------
154
+ out: Object
155
+ Object.
156
+
157
+ Examples
158
+ --------
159
+ > var o = {{alias}}.freeze( { 'a': 1 } )
160
+ { 'a': 1 }
161
+
162
+ {{alias}}.getOwnPropertyDescriptor( obj, key )
163
+ Returns an object's own property descriptor.
164
+
165
+ Parameters
166
+ ----------
167
+ obj: Object
168
+ Object.
169
+
170
+ key: string
171
+ Property key.
172
+
173
+ Returns
174
+ -------
175
+ out: Object
176
+ Property descriptor.
177
+
178
+ Examples
179
+ --------
180
+ > var o = {{alias}}.getOwnPropertyDescriptor( { 'a': 1 }, 'a' )
181
+ { 'value': 1, 'enumerable': true, 'configurable': true, 'writable': true }
182
+
183
+ {{alias}}.getOwnPropertyDescriptors( obj )
184
+ Returns an object's own property descriptors.
185
+
186
+ Parameters
187
+ ----------
188
+ obj: Object
189
+ Object.
190
+
191
+ Returns
192
+ -------
193
+ out: Object
194
+ Property descriptors.
195
+
196
+ Examples
197
+ --------
198
+ > var o = {{alias}}.getOwnPropertyDescriptors( { 'a': 1, 'b': 2 } )
199
+ {
200
+ 'a': {
201
+ 'value': 1,
202
+ 'enumerable': true,
203
+ 'configurable': true,
204
+ 'writable': true
205
+ },
206
+ 'b': {
207
+ 'value': 2,
208
+ 'enumerable': true,
209
+ 'configurable': true,
210
+ 'writable': true
211
+ }
212
+ }
213
+
214
+ {{alias}}.getOwnPropertyNames( obj )
215
+ Returns an array of an object's own enumerable and non-enumerable
216
+ property names.
217
+
218
+ Parameters
219
+ ----------
220
+ obj: Object
221
+ Object.
222
+
223
+ Returns
224
+ -------
225
+ out: Array
226
+ Array of property names.
227
+
228
+ Examples
229
+ --------
230
+ > var o = {{alias}}.getOwnPropertyNames( { 'a': 1, 'b': 2 } )
231
+ [ 'a', 'b' ]
232
+
233
+ {{alias}}.getOwnPropertySymbols( obj )
234
+ Returns an array of an object's own enumerable and non-enumerable
235
+ symbol property names.
236
+
237
+ Parameters
238
+ ----------
239
+ obj: Object
240
+ Object.
241
+
242
+ Returns
243
+ -------
244
+ out: Array
245
+ Array of symbol property names.
246
+
247
+ Examples
248
+ --------
249
+ > var o = {{alias}}.getOwnPropertySymbols( { 'a': 1, 'b': 2 } )
250
+ []
251
+
252
+ {{alias}}.getPrototypeOf( obj )
253
+ Returns an object's prototype.
254
+
255
+ Parameters
256
+ ----------
257
+ obj: Object
258
+ Object.
259
+
260
+ Returns
261
+ -------
262
+ out: Object
263
+ Prototype.
264
+
265
+ Examples
266
+ --------
267
+ > var o = {{alias}}.getPrototypeOf( { 'a': 1, 'b': 2 } )
268
+ <Object>
269
+
270
+ {{alias}}.hasOwn( obj, p )
271
+ Returns a boolean indicating whether an object has a property with the
272
+ specified name.
273
+
274
+ Parameters
275
+ ----------
276
+ obj: Object
277
+ Object.
278
+
279
+ p: string
280
+ Property name.
281
+
282
+ Returns
283
+ -------
284
+ out: boolean
285
+ Boolean indicating whether an object has a property with the specified
286
+ name.
287
+
288
+ Examples
289
+ --------
290
+ > var o = {{alias}}.hasOwn( { 'a': 1, 'b': 2 }, 'a' )
291
+ true
292
+
293
+ {{alias}}.is( value1, value2 )
294
+ Returns a boolean indicating whether two values are the same value.
295
+
296
+ Parameters
297
+ ----------
298
+ value1: any
299
+ First value.
300
+
301
+ value2: any
302
+ Second value.
303
+
304
+ Returns
305
+ -------
306
+ out: boolean
307
+ Boolean indicating whether two values are the same value.
308
+
309
+ Examples
310
+ --------
311
+ > var o = {{alias}}.is( 1, 1 )
312
+ true
313
+ > var o = {{alias}}.is( 1, '1' )
314
+ false
315
+
316
+ {{alias}}.isExtensible( obj )
317
+ Returns a boolean indicating whether an object is extensible.
318
+
319
+ Parameters
320
+ ----------
321
+ obj: Object
322
+ Object.
323
+
324
+ Returns
325
+ -------
326
+ out: boolean
327
+ Boolean indicating whether an object is extensible.
328
+
329
+ Examples
330
+ --------
331
+ > var o = {{alias}}.isExtensible( { 'a': 1 } )
332
+ true
333
+
334
+ {{alias}}.isFrozen( obj )
335
+ Returns a boolean indicating whether an object is frozen.
336
+
337
+ Parameters
338
+ ----------
339
+ obj: Object
340
+ Object.
341
+
342
+ Returns
343
+ -------
344
+ out: boolean
345
+ Boolean indicating whether an object is frozen.
346
+
347
+ Examples
348
+ --------
349
+ > var o = {{alias}}.isFrozen( { 'a': 1 } )
350
+ false
351
+ > var o = {{alias}}.isFrozen( {{alias}}.freeze( { 'a': 1 } ) )
352
+ true
353
+
354
+ {{alias}}.isSealed( obj )
355
+ Returns a boolean indicating whether an object is sealed.
356
+
357
+ Parameters
358
+ ----------
359
+ obj: Object
360
+ Object.
361
+
362
+ Returns
363
+ -------
364
+ out: boolean
365
+ Boolean indicating whether an object is sealed.
366
+
367
+ Examples
368
+ --------
369
+ > var o = {{alias}}.isSealed( { 'a': 1 } )
370
+ false
371
+ > var o = {{alias}}.isSealed( {{alias}}.seal( { 'a': 1 } ) )
372
+ true
373
+
374
+ {{alias}}.keys( obj )
375
+ Returns an array of an object's own enumerable string-keyed property
376
+ names.
377
+
378
+ Parameters
379
+ ----------
380
+ obj: Object
381
+ Object.
382
+
383
+ Returns
384
+ -------
385
+ out: Array
386
+ Array of property names.
387
+
388
+ Examples
389
+ --------
390
+ > var o = {{alias}}.keys( { 'a': 1, 'b': 2 } )
391
+ [ 'a', 'b' ]
392
+
393
+ {{alias}}.preventExtensions( obj )
394
+ Prevents the addition of new properties to an object.
395
+
396
+ Parameters
397
+ ----------
398
+ obj: Object
399
+ Object.
400
+
401
+ Returns
402
+ -------
403
+ out: Object
404
+ Object.
405
+
406
+ Examples
407
+ --------
408
+ > var o = {{alias}}.preventExtensions( { 'a': 1 } )
409
+ { 'a': 1 }
410
+ > o.b = 2;
411
+ > o
412
+ { 'a': 1 }
413
+
414
+ {{alias}}.seal( obj )
415
+ Prevents the addition of new properties to an object and marks all
416
+ existing properties as non-configurable.
417
+
418
+ Parameters
419
+ ----------
420
+ obj: Object
421
+ Object.
422
+
423
+ Returns
424
+ -------
425
+ out: Object
426
+ Object.
427
+
428
+ Examples
429
+ --------
430
+ > var o = {{alias}}.seal( { 'a': 1 } )
431
+ { 'a': 1 }
432
+ > o.b = 2;
433
+ > o
434
+ { 'a': 1 }
435
+ > delete o.a;
436
+ > o
437
+ { 'a': 1 }
438
+
439
+ {{alias}}.setPrototypeOf( obj, proto )
440
+ Sets an object's prototype.
441
+
442
+ Parameters
443
+ ----------
444
+ obj: Object
445
+ Object.
446
+
447
+ proto: Object
448
+ Prototype.
449
+
450
+ Returns
451
+ -------
452
+ out: Object
453
+ Object.
454
+
455
+ Examples
456
+ --------
457
+ > var o = {{alias}}.setPrototypeOf( { 'a': 1 }, { 'b': 2 } )
458
+ { 'a': 1 }
459
+ > o.b
460
+ 2
461
+
462
+ {{alias}}.values( obj )
463
+ Returns an array of an object's own enumerable property values.
464
+
465
+ Parameters
466
+ ----------
467
+ obj: Object
468
+ Object.
469
+
470
+ Returns
471
+ -------
472
+ out: Array
473
+ Array of property values.
474
+
475
+ Examples
476
+ --------
477
+ > var o = {{alias}}.values( { 'a': 1, 'b': 2 } )
478
+ [ 1, 2 ]
479
+
480
+ {{alias}}.prototype.toLocaleString()
481
+ Returns a string representing the object.
482
+
483
+ Returns
484
+ -------
485
+ out: string
486
+ String representing the object.
487
+
488
+ Examples
489
+ --------
490
+ > var o = {{alias}}.prototype.toLocaleString.call( { 'a': 1, 'b': 2 } )
491
+ <string>
492
+
493
+ {{alias}}.prototype.toString()
494
+ Returns a string representing the object.
495
+
496
+ Returns
497
+ -------
498
+ out: string
499
+ String representing the object.
500
+
501
+ Examples
502
+ --------
503
+ > var o = {{alias}}.prototype.toString.call( { 'a': 1, 'b': 2 } )
504
+ <string>
505
+
506
+ {{alias}}.prototype.valueOf()
507
+ Returns the primitive value of the object.
508
+
509
+ Returns
510
+ -------
511
+ out: any
512
+ Primitive value of the object.
513
+
514
+ Examples
515
+ --------
516
+ > var o = {{alias}}.prototype.valueOf.call( { 'a': 1, 'b': 2 } )
517
+ {}
518
+
519
+ {{alias}}.prototype.hasOwnProperty( p )
520
+ Returns a boolean indicating whether an object has a property with the
521
+ specified name.
522
+
523
+ Parameters
524
+ ----------
525
+ p: string
526
+ Property name.
527
+
528
+ Returns
529
+ -------
530
+ out: boolean
531
+ Boolean indicating whether an object has a property with the specified
532
+ name.
533
+
534
+ Examples
535
+ --------
536
+ > var o = {{alias}}.prototype.hasOwnProperty.call( { 'a': 1, 'b': 2 }, 'a' )
537
+ true
538
+
539
+ {{alias}}.prototype.isPrototypeOf( obj )
540
+ Returns a boolean indicating whether an object exists in another object's
541
+ prototype chain.
542
+
543
+ Parameters
544
+ ----------
545
+ obj: Object
546
+ Object.
547
+
548
+ Returns
549
+ -------
550
+ out: boolean
551
+ Boolean indicating whether an object exists in another object's
552
+ prototype chain.
553
+
554
+ Examples
555
+ --------
556
+ > var p = { 'a': 1 };
557
+ > var o = { '__proto__': p };
558
+ > var b = o.isPrototypeOf( p );
559
+ true
560
+
561
+ {{alias}}.prototype.propertyIsEnumerable( p )
562
+ Returns a boolean indicating whether an object's property is enumerable.
563
+
564
+ Parameters
565
+ ----------
566
+ p: string
567
+ Property name.
568
+
569
+ Returns
570
+ -------
571
+ out: boolean
572
+ Boolean indicating whether an object's property is enumerable.
573
+
574
+ Examples
575
+ --------
576
+ > var o = { 'a': 1, 'b': 2 };
577
+ > var bool = {{alias}}.prototype.propertyIsEnumerable.call( o, 'a' )
578
+ true
579
+
580
+ {{alias}}.prototype.constructor
581
+ Property whose value is a reference to the constructor function that
582
+ created the instance object.
583
+
584
+ Examples
585
+ --------
586
+ > var o = new Object( null );
587
+ > var ctr = o.constructor;
588
+ <Object>
589
+
590
+ See Also
591
+ --------
592
+
@@ -0,0 +1,56 @@
1
+ /*
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2022 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ // TypeScript Version: 4.1
20
+
21
+ // EXPORTS //
22
+
23
+ /**
24
+ * Returns an object.
25
+ *
26
+ * ## Notes
27
+ *
28
+ * - If provided `null` or `undefined`, the function returns an empty object.
29
+ * - If provided an existing object, the function returns the input value unchanged.
30
+ * - Otherwise, if provided any other value (e.g., a number, string, etc), the function will return an object of the corresponding type.
31
+ *
32
+ * @param value - input value
33
+ * @returns object
34
+ *
35
+ * @example
36
+ * var o = new Object( null );
37
+ * // returns {}
38
+ *
39
+ * @example
40
+ * var o = new Object( 5.0 );
41
+ * // returns <Number>
42
+ *
43
+ * @example
44
+ * var o = new Object( 'beep' );
45
+ * // returns <String>
46
+ *
47
+ * @example
48
+ * var o1 = {};
49
+ *
50
+ * var o2 = new Object( o1 );
51
+ * // returns {}
52
+ *
53
+ * var bool = ( o1 === o2 );
54
+ * // returns true
55
+ */
56
+ export = Object;
@@ -0,0 +1,33 @@
1
+ /*
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2022 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
20
+
21
+ import Obj = require( './index' );
22
+
23
+
24
+ // TESTS //
25
+
26
+ // The function returns an object...
27
+ {
28
+ new Obj( null ); // $ExpectType Object
29
+ new Obj( undefined ); // $ExpectType Object
30
+ new Obj( {} ); // $ExpectType Object
31
+ new Obj( 5 ); // $ExpectType Object
32
+ new Obj( 'beep' ); // $ExpectType Object
33
+ }
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @license Apache-2.0
3
+ *
4
+ * Copyright (c) 2022 The Stdlib Authors.
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ 'use strict';
20
+
21
+ /**
22
+ * Object constructor.
23
+ *
24
+ * @module @stdlib/object/ctor
25
+ *
26
+ * @example
27
+ * var Object = require( '@ohos-ports/stdlib-object/ctor' );
28
+ *
29
+ * var o = new Object( null );
30
+ * // returns {}
31
+ *
32
+ * o = new Object( 5.0 );
33
+ * // returns <Number>
34
+ *
35
+ * o = new Object( 'beep' );
36
+ * // returns <String>
37
+ *
38
+ * var o1 = {};
39
+ *
40
+ * var o2 = new Object( o1 );
41
+ * // returns {}
42
+ *
43
+ * var bool = ( o1 === o2 );
44
+ * // returns true
45
+ */
46
+
47
+ // MODULES //
48
+
49
+ var main = require( './main.js' );
50
+
51
+
52
+ // EXPORTS //
53
+
54
+ module.exports = main;