Skip to content

Commit 6696cab

Browse files
committedMay 6, 2024··
fix(objectrepository): fix SonarCloud minor issues
1 parent 8b6e4e7 commit 6696cab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎lib/core/shared/ObjectRepository.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ export class ObjectRepository<TObject extends { _id: string }> {
142142
return null;
143143
}
144144

145-
return await this.fromDTO(Object.assign({}, JSON.parse(response)));
145+
return await this.fromDTO({ ...JSON.parse(response) });
146146
} catch (err) {
147147
throw kerror.get("services", "cache", "read_failed", err.message);
148148
}
@@ -256,7 +256,7 @@ export class ObjectRepository<TObject extends { _id: string }> {
256256
): Promise<TObject> {
257257
const key = options.key || this.getCacheKey(object._id);
258258
const value = JSON.stringify(this.serializeToCache(object));
259-
const ttl = options.ttl !== undefined ? options.ttl : this.ttl;
259+
const ttl = options.ttl ?? this.ttl;
260260

261261
await global.kuzzle.ask(`core:cache:${this.cacheDb}:store`, key, value, {
262262
ttl,
@@ -359,7 +359,7 @@ export class ObjectRepository<TObject extends { _id: string }> {
359359
* @returns {object}
360360
*/
361361
toDTO(o: TObject): any {
362-
return Object.assign({}, o);
362+
return { ...o };
363363
}
364364

365365
/**

0 commit comments

Comments
 (0)
Please sign in to comment.