@@ -93,7 +93,7 @@ class Entity {
9393 if ( _this . constructor . __hasCache ( options ) ) {
9494 return _this . constructor . clearCache ( )
9595 . then ( ( ) => _this )
96- . catch ( ( err ) => {
96+ . catch ( err => {
9797 let msg = 'Error while clearing the cache after saving the entity.' ;
9898 msg += 'The entity has been saved successfully though. ' ;
9999 msg += 'Both the cache error and the entity saved have been attached.' ;
@@ -170,7 +170,7 @@ class Entity {
170170 return ;
171171 }
172172
173- this . schema . __meta . geoPointsProps . forEach ( ( property ) => {
173+ this . schema . __meta . geoPointsProps . forEach ( property => {
174174 if ( { } . hasOwnProperty . call ( _this . entityData , property )
175175 && _this . entityData [ property ] !== null
176176 && _this . entityData [ property ] . constructor . name !== 'GeoPoint' ) {
@@ -301,9 +301,9 @@ class Entity {
301301
302302 getEntityDataWithVirtuals ( ) {
303303 const { virtuals } = this . schema ;
304- const entityData = Object . assign ( { } , this . entityData ) ;
304+ const entityData = { ... this . entityData } ;
305305
306- Object . keys ( virtuals ) . forEach ( ( k ) => {
306+ Object . keys ( virtuals ) . forEach ( k => {
307307 if ( { } . hasOwnProperty . call ( entityData , k ) ) {
308308 virtuals [ k ] . applySetters ( entityData [ k ] , entityData ) ;
309309 } else {
@@ -381,15 +381,15 @@ function buildEntityData(self, data) {
381381 const { error, value } = schema . validateJoi ( data ) ;
382382
383383 if ( ! error ) {
384- entityData = Object . assign ( { } , value ) ;
384+ entityData = { ... value } ;
385385 }
386386 }
387387
388- entityData = Object . assign ( { } , entityData , data ) ;
388+ entityData = { ... entityData , ... data } ;
389389
390390 let isTypeArray ;
391391
392- Object . keys ( schema . paths ) . forEach ( ( k ) => {
392+ Object . keys ( schema . paths ) . forEach ( k => {
393393 const prop = schema . paths [ k ] ;
394394 const hasValue = { } . hasOwnProperty . call ( entityData , k ) ;
395395 const isOptional = { } . hasOwnProperty . call ( prop , 'optional' ) && prop . optional !== false ;
@@ -471,12 +471,12 @@ function registerHooksFromSchema(self) {
471471 }
472472
473473 // Add Pre hooks
474- callQueue [ method ] . pres . forEach ( ( fn ) => {
474+ callQueue [ method ] . pres . forEach ( fn => {
475475 self . pre ( method , fn ) ;
476476 } ) ;
477477
478478 // Add Pre hooks
479- callQueue [ method ] . post . forEach ( ( fn ) => {
479+ callQueue [ method ] . post . forEach ( fn => {
480480 self . post ( method , fn ) ;
481481 } ) ;
482482 }
0 commit comments