@qubit-ltd/common-decorator 3.9.1 → 3.10.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/README.md +8 -3
- package/README.zh_CN.md +5 -1
- package/dist/common-decorator.cjs +41 -19
- package/dist/common-decorator.cjs.map +1 -1
- package/dist/common-decorator.min.cjs +1 -1
- package/dist/common-decorator.min.cjs.map +1 -1
- package/dist/common-decorator.min.mjs +1 -1
- package/dist/common-decorator.min.mjs.map +1 -1
- package/dist/common-decorator.mjs +41 -19
- package/dist/common-decorator.mjs.map +1 -1
- package/doc/api/DefaultAssignmentOptions.html +1 -1
- package/doc/api/DefaultOptions.html +1 -1
- package/doc/api/DefaultToJsonOptions.html +1 -1
- package/doc/api/Enum.html +1 -1
- package/doc/api/Model.html +27 -11
- package/doc/api/Page.html +1 -1
- package/doc/api/global.html +3 -2
- package/doc/api/index.html +8 -4
- package/doc/common-decorator.min.visualization.html +1 -1
- package/doc/common-decorator.visualization.html +1 -1
- package/package.json +1 -1
|
@@ -668,7 +668,7 @@ include the class name of the target object.</p>
|
|
|
668
668
|
|
|
669
669
|
<footer>
|
|
670
670
|
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a>
|
|
671
|
-
on
|
|
671
|
+
on Wed Apr 30 2025 14:22:08 GMT+0800 (China Standard Time)
|
|
672
672
|
using the <a href="https://github.com/Haixing-Hu/jsdoc-minami">customized Minami theme</a>.
|
|
673
673
|
</footer>
|
|
674
674
|
|
|
@@ -944,7 +944,7 @@ added to the old default options.</p>
|
|
|
944
944
|
|
|
945
945
|
<footer>
|
|
946
946
|
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a>
|
|
947
|
-
on
|
|
947
|
+
on Wed Apr 30 2025 14:22:08 GMT+0800 (China Standard Time)
|
|
948
948
|
using the <a href="https://github.com/Haixing-Hu/jsdoc-minami">customized Minami theme</a>.
|
|
949
949
|
</footer>
|
|
950
950
|
|
|
@@ -623,7 +623,7 @@ result JSON string of the <code>toJSON()</code> method.</p>
|
|
|
623
623
|
|
|
624
624
|
<footer>
|
|
625
625
|
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a>
|
|
626
|
-
on
|
|
626
|
+
on Wed Apr 30 2025 14:22:08 GMT+0800 (China Standard Time)
|
|
627
627
|
using the <a href="https://github.com/Haixing-Hu/jsdoc-minami">customized Minami theme</a>.
|
|
628
628
|
</footer>
|
|
629
629
|
|
package/doc/api/Enum.html
CHANGED
|
@@ -1838,7 +1838,7 @@ or <code>undefined</code> if there is no such enumerator.</p>
|
|
|
1838
1838
|
|
|
1839
1839
|
<footer>
|
|
1840
1840
|
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a>
|
|
1841
|
-
on
|
|
1841
|
+
on Wed Apr 30 2025 14:22:08 GMT+0800 (China Standard Time)
|
|
1842
1842
|
using the <a href="https://github.com/Haixing-Hu/jsdoc-minami">customized Minami theme</a>.
|
|
1843
1843
|
</footer>
|
|
1844
1844
|
|
package/doc/api/Model.html
CHANGED
|
@@ -58,12 +58,13 @@
|
|
|
58
58
|
<ul>
|
|
59
59
|
<li>Instance method <code>assign(obj, options)</code>: Copies the properties of the object
|
|
60
60
|
<code>obj</code> to this object, only copying properties defined in the class of this
|
|
61
|
-
object. If a property in
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
The <code>
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
object. If a property in <code>obj</code> does not exist, it sets the property of this
|
|
62
|
+
object to the default value. If a property exists in <code>obj</code> but its value is
|
|
63
|
+
<code>null</code> or <code>undefined</code>, the function preserves the <code>null</code> or <code>undefined</code> value.
|
|
64
|
+
The function returns this object itself. Note that <code>obj</code> can have a different
|
|
65
|
+
prototype than this object. The <code>options</code> parameter is the additional options
|
|
66
|
+
for the assignment. Available options will be explained below. If the <code>options</code>
|
|
67
|
+
parameter is <code>undefined</code> or <code>null</code>, the default options will be used. The default
|
|
67
68
|
options can be retrieved by calling <code>DefaultOptions.get('assign')</code>.</li>
|
|
68
69
|
<li>Instance method <code>clear()</code>: Sets all the properties of this object to their
|
|
69
70
|
default values.</li>
|
|
@@ -361,8 +362,10 @@ the <code>Person.prototype.equals()</code> method.</li>
|
|
|
361
362
|
<div class="description">
|
|
362
363
|
<p>Copies the properties from a specified data object to this object, only
|
|
363
364
|
copying properties defined in the class of this object.</p>
|
|
364
|
-
<p>If a property in the data object
|
|
365
|
-
sets the property of this object to the default value
|
|
365
|
+
<p>If a property in the data object doesn't exist, the function
|
|
366
|
+
sets the property of this object to the default value. However, if a property
|
|
367
|
+
exists in the data object but its value is <code>null</code> or <code>undefined</code>, the function
|
|
368
|
+
will preserve that <code>null</code> or <code>undefined</code> value in this object.</p>
|
|
366
369
|
<p>Note that the data object may have a different prototype than this object.</p>
|
|
367
370
|
</div>
|
|
368
371
|
|
|
@@ -1198,6 +1201,9 @@ have default values.</p>
|
|
|
1198
1201
|
this object.</p>
|
|
1199
1202
|
<p>A field is normalizable if and only if it is decorated with the
|
|
1200
1203
|
<code>@<a href="global.html#Normalizable">Normalizable</a></code> decorator.</p>
|
|
1204
|
+
<p>If a field value is <code>null</code> or <code>undefined</code>, the normalization process will
|
|
1205
|
+
preserve the <code>null</code> or <code>undefined</code> value rather than replacing it with a
|
|
1206
|
+
default value.</p>
|
|
1201
1207
|
</div>
|
|
1202
1208
|
|
|
1203
1209
|
|
|
@@ -2490,8 +2496,10 @@ validation result.</p>
|
|
|
2490
2496
|
<p>Creates a new instance of this class based on the specified data object.</p>
|
|
2491
2497
|
<p>It copies the property values from the corresponding properties of the
|
|
2492
2498
|
specified data object maintaining the same prototype and class definition.</p>
|
|
2493
|
-
<p>If a property in the data object
|
|
2494
|
-
|
|
2499
|
+
<p>If a property doesn't exist in the data object, the function sets the property
|
|
2500
|
+
of the created instance to the default value. If a property exists in the data
|
|
2501
|
+
object but its value is <code>null</code> or <code>undefined</code>, the function preserves the <code>null</code>
|
|
2502
|
+
or <code>undefined</code> value.</p>
|
|
2495
2503
|
<p>This method is usually used to transform a plain JSON object into the
|
|
2496
2504
|
specified domain object.</p>
|
|
2497
2505
|
</div>
|
|
@@ -2727,6 +2735,10 @@ objects.</p>
|
|
|
2727
2735
|
<p>The property values of each element in the created instances array are
|
|
2728
2736
|
copied from the corresponding elements in the data object array,
|
|
2729
2737
|
maintaining the same prototype and class definition.</p>
|
|
2738
|
+
<p>For each element in the array, if a property doesn't exist in the data object,
|
|
2739
|
+
the function sets the property of the created instance to the default value.
|
|
2740
|
+
If a property exists in the data object but its value is <code>null</code> or <code>undefined</code>,
|
|
2741
|
+
the function preserves the <code>null</code> or <code>undefined</code> value.</p>
|
|
2730
2742
|
<p>This method is usually used to transform an array of plain JSON objects
|
|
2731
2743
|
into an array of specified domain objects.</p>
|
|
2732
2744
|
</div>
|
|
@@ -2962,6 +2974,10 @@ data object array, or <code>null</code> if the specified data object array is
|
|
|
2962
2974
|
<p>Typically, the pagination data object is the JSON representation of a
|
|
2963
2975
|
list of domain objects obtained from a server using the GET method, and
|
|
2964
2976
|
the object should conform to the <code>Page</code> class definition.</p>
|
|
2977
|
+
<p>For each element in the page content array, if a property doesn't exist in
|
|
2978
|
+
the data object, the function sets the property of the created instance to
|
|
2979
|
+
the default value. If a property exists in the data object but its value is
|
|
2980
|
+
<code>null</code> or <code>undefined</code>, the function preserves the <code>null</code> or <code>undefined</code> value.</p>
|
|
2965
2981
|
</div>
|
|
2966
2982
|
|
|
2967
2983
|
|
|
@@ -3597,7 +3613,7 @@ of this argument is <code>'LOWER_CAMEL'</code>.</li>
|
|
|
3597
3613
|
|
|
3598
3614
|
<footer>
|
|
3599
3615
|
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a>
|
|
3600
|
-
on
|
|
3616
|
+
on Wed Apr 30 2025 14:22:08 GMT+0800 (China Standard Time)
|
|
3601
3617
|
using the <a href="https://github.com/Haixing-Hu/jsdoc-minami">customized Minami theme</a>.
|
|
3602
3618
|
</footer>
|
|
3603
3619
|
|
package/doc/api/Page.html
CHANGED
|
@@ -1095,7 +1095,7 @@ The default value is <code>{}</code>.</li>
|
|
|
1095
1095
|
|
|
1096
1096
|
<footer>
|
|
1097
1097
|
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a>
|
|
1098
|
-
on
|
|
1098
|
+
on Wed Apr 30 2025 14:22:08 GMT+0800 (China Standard Time)
|
|
1099
1099
|
using the <a href="https://github.com/Haixing-Hu/jsdoc-minami">customized Minami theme</a>.
|
|
1100
1100
|
</footer>
|
|
1101
1101
|
|
package/doc/api/global.html
CHANGED
|
@@ -3813,7 +3813,8 @@ The default value is <code>{}</code>.</li>
|
|
|
3813
3813
|
<p>A default normalizer for a non-static class field.</p>
|
|
3814
3814
|
<p>This normalizer does the following things:</p>
|
|
3815
3815
|
<ul>
|
|
3816
|
-
<li>If the value is <code>undefined</code> or <code>null</code>, it returns the value itself
|
|
3816
|
+
<li>If the value is <code>undefined</code> or <code>null</code>, it returns the value itself without
|
|
3817
|
+
changing it;</li>
|
|
3817
3818
|
<li>If the value is a string, it returns the trimmed string;</li>
|
|
3818
3819
|
<li>If the value is a collection, it returns the same type of collection whose
|
|
3819
3820
|
elements are normalized by the default normalizer;</li>
|
|
@@ -5804,7 +5805,7 @@ options.</p>
|
|
|
5804
5805
|
|
|
5805
5806
|
<footer>
|
|
5806
5807
|
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a>
|
|
5807
|
-
on
|
|
5808
|
+
on Wed Apr 30 2025 14:22:08 GMT+0800 (China Standard Time)
|
|
5808
5809
|
using the <a href="https://github.com/Haixing-Hu/jsdoc-minami">customized Minami theme</a>.
|
|
5809
5810
|
</footer>
|
|
5810
5811
|
|
package/doc/api/index.html
CHANGED
|
@@ -189,9 +189,11 @@ The default value is <code>{}</code>.</li>
|
|
|
189
189
|
</li>
|
|
190
190
|
</ul>
|
|
191
191
|
<p>This function copies the fields of the object <code>obj</code> to this object, only copying
|
|
192
|
-
fields defined in this object's class. If a field in the <code>obj</code> object
|
|
193
|
-
|
|
194
|
-
<code>
|
|
192
|
+
fields defined in this object's class. If a field doesn't exist in the <code>obj</code> object,
|
|
193
|
+
it sets the field's value to the default value. If a field exists in the <code>obj</code> object
|
|
194
|
+
but its value is <code>null</code> or <code>undefined</code>, the function preserves the <code>null</code> or <code>undefined</code>
|
|
195
|
+
value rather than setting it to the default value. Note that <code>obj</code> can have a different
|
|
196
|
+
prototype to this object.</p>
|
|
195
197
|
<h4><span id="model-clone">Instance method: Class.prototype.clone()</span></h4>
|
|
196
198
|
<ul>
|
|
197
199
|
<li>Parameters: none.</li>
|
|
@@ -314,6 +316,8 @@ parameter specifies the names of fields to be normalized. If <code>fields</code>
|
|
|
314
316
|
fields of this object. If <code>fields</code> is an array of strings, it normalizes all the
|
|
315
317
|
normalizable fields whose names are specified in the array. Note that a field is
|
|
316
318
|
normalizable if and only if it is decorated by the <code>@Normalizable</code> decorator.</p>
|
|
319
|
+
<p><strong>IMPORTANT</strong>: If a field value is <code>null</code> or <code>undefined</code>, the normalization process will
|
|
320
|
+
preserve the <code>null</code> or <code>undefined</code> value rather than replacing it with a default value.</p>
|
|
317
321
|
<h4><span id="model-validateField">Instance method: Class.prototype.validateField(field)</span></h4>
|
|
318
322
|
<ul>
|
|
319
323
|
<li>Parameters:
|
|
@@ -1932,7 +1936,7 @@ app.listen(3000, () => {
|
|
|
1932
1936
|
|
|
1933
1937
|
<footer>
|
|
1934
1938
|
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a>
|
|
1935
|
-
on
|
|
1939
|
+
on Wed Apr 30 2025 14:22:08 GMT+0800 (China Standard Time)
|
|
1936
1940
|
using the <a href="https://github.com/Haixing-Hu/jsdoc-minami">customized Minami theme</a>.
|
|
1937
1941
|
</footer>
|
|
1938
1942
|
|