@sumaris-net/ngx-components 2.0.0-rc40 → 2.0.0-rc41

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.
@@ -11180,73 +11180,47 @@ function EntityClass(opts) {
11180
11180
  // Define static field TYPENAME
11181
11181
  clazz.TYPENAME = typename;
11182
11182
  // Define static fromObject()
11183
- if (!clazz.fromObject) {
11184
- if (opts.fromObjectReuseStrategy === 'clone') {
11185
- constructor.fromObject = function (source, opts) {
11186
- if (!source)
11187
- return undefined;
11188
- if (source instanceof constructor)
11189
- return source.clone(opts);
11190
- const target = new constructor();
11191
- target.fromObject(source, opts);
11192
- return target;
11193
- };
11194
- constructor.asObject = function (source, opts) {
11195
- if (!source)
11196
- return undefined;
11197
- if (source instanceof constructor)
11198
- return source.asObject(opts);
11199
- return Object.assign({}, source);
11200
- };
11201
- }
11202
- else {
11203
- clazz.fromObject = function (source, opts) {
11204
- if (!source)
11205
- return undefined;
11206
- if (source instanceof constructor) {
11207
- // DEBUG
11208
- //console.debug('@EntityClass() fromObject() => will recycle existing object: ', source);
11209
- return source;
11210
- }
11211
- const target = new constructor();
11212
- target.fromObject(source, opts);
11213
- return target;
11214
- };
11215
- clazz.asObject = function (source, opts) {
11216
- if (!source)
11217
- return undefined;
11218
- if (source instanceof constructor) {
11219
- return source.asObject(opts);
11220
- }
11221
- // DEBUG
11222
- //console.debug('@EntityClass() asObject() => will recycle existing object: ', source);
11223
- return source;
11224
- };
11225
- }
11183
+ if (opts.fromObjectReuseStrategy === 'clone') {
11184
+ clazz.fromObject = function (source, opts) {
11185
+ if (!source)
11186
+ return undefined;
11187
+ if (source instanceof constructor)
11188
+ return source.clone(opts);
11189
+ const target = new constructor();
11190
+ target.fromObject(source, opts);
11191
+ return target;
11192
+ };
11193
+ clazz.asObject = function (source, opts) {
11194
+ if (!source)
11195
+ return undefined;
11196
+ if (source instanceof constructor)
11197
+ return source.asObject(opts);
11198
+ return Object.assign({}, source);
11199
+ };
11226
11200
  }
11227
- // Define static asObject()
11228
- if (!clazz.asObject) {
11229
- if (opts.fromObjectReuseStrategy === 'clone') {
11230
- clazz.asObject = function (source, opts) {
11231
- if (!source)
11232
- return undefined;
11233
- if (source instanceof constructor)
11234
- return source.asObject(opts);
11235
- return Object.assign({}, source);
11236
- };
11237
- }
11238
- else {
11239
- clazz.asObject = function (source, opts) {
11240
- if (!source)
11241
- return undefined;
11242
- if (source instanceof constructor) {
11243
- return source.asObject(opts);
11244
- }
11201
+ else {
11202
+ clazz.fromObject = function (source, opts) {
11203
+ if (!source)
11204
+ return undefined;
11205
+ if (source instanceof constructor) {
11245
11206
  // DEBUG
11246
- //console.debug('@EntityClass() asObject() => will recycle existing object: ', source);
11207
+ //console.debug('@EntityClass() fromObject() => will recycle existing object: ', source);
11247
11208
  return source;
11248
- };
11249
- }
11209
+ }
11210
+ const target = new constructor();
11211
+ target.fromObject(source, opts);
11212
+ return target;
11213
+ };
11214
+ clazz.asObject = function (source, opts) {
11215
+ if (!source)
11216
+ return undefined;
11217
+ if (source instanceof constructor) {
11218
+ return source.asObject(opts);
11219
+ }
11220
+ // DEBUG
11221
+ //console.debug('@EntityClass() asObject() => will recycle existing object: ', source);
11222
+ return source;
11223
+ };
11250
11224
  }
11251
11225
  // Register the entity class
11252
11226
  EntityClasses.register(typename, constructor);