From eb2e8744035467f742bf279d6fc0c9966b85e9b1 Mon Sep 17 00:00:00 2001 From: Paz Barda Date: Wed, 17 Jan 2024 13:50:53 +0200 Subject: [PATCH] happy lintin' round2 --- src/lib/mock-observations/helpers/CommonGenerator.ts | 6 +++--- src/lib/mock-observations/helpers/RandIntGenerator.ts | 8 ++++---- src/lib/mock-observations/index.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/mock-observations/helpers/CommonGenerator.ts b/src/lib/mock-observations/helpers/CommonGenerator.ts index bfda831..9bd938d 100644 --- a/src/lib/mock-observations/helpers/CommonGenerator.ts +++ b/src/lib/mock-observations/helpers/CommonGenerator.ts @@ -3,7 +3,7 @@ import {Generator} from '../interfaces'; class CommonGenerator implements Generator { private name = ''; private generateObject: {} = {}; - initialise(name: string, config:{[key:string]: any}): void { + initialise(name: string, config: {[key: string]: any}): void { this.name = this.validateName(name); // TODO PB -- validate config is not null, not empty and a valid yml object, use yaml.parse(input) // TODO PB -- object immutabilty - copy by value here @@ -12,9 +12,9 @@ class CommonGenerator implements Generator { next(_historical: Object[]): Object { // TODO PB -- object immutabilty - copy by value here - return this.generateObject + return this.generateObject; } - + public getName(): String { return this.name; } diff --git a/src/lib/mock-observations/helpers/RandIntGenerator.ts b/src/lib/mock-observations/helpers/RandIntGenerator.ts index 3668817..050c7ca 100644 --- a/src/lib/mock-observations/helpers/RandIntGenerator.ts +++ b/src/lib/mock-observations/helpers/RandIntGenerator.ts @@ -7,7 +7,7 @@ class RandIntGenerator implements Generator { private min = 0; private max = 0; - initialise(fieldToPopulate: string, config: { [key: string]: any }): void { + initialise(fieldToPopulate: string, config: {[key: string]: any}): void { this.fieldToPopulate = this.validateName(fieldToPopulate); this.validateConfig(config); this.min = config[RandIntGenerator.MIN]; @@ -34,12 +34,12 @@ class RandIntGenerator implements Generator { } // TODO PB: extract to a utils class? - private validateConfig(config: {[key: string]: any }): void { - if (!config.hasOwnProperty(RandIntGenerator.MIN)) { + private validateConfig(config: { [key: string]: any }): void { + if (!Object.prototype.hasOwnProperty.call(config, RandIntGenerator.MIN)) { // TODO PB - custom / more specific error? throw new Error('config is missing ' + RandIntGenerator.MIN); } - if (!config.hasOwnProperty(RandIntGenerator.MAX)) { + if (!Object.prototype.hasOwnProperty.call(config, RandIntGenerator.MAX)) { // TODO PB - custom / more specific error? throw new Error('config is missing ' + RandIntGenerator.MAX); } diff --git a/src/lib/mock-observations/index.ts b/src/lib/mock-observations/index.ts index 6dba392..40d291c 100644 --- a/src/lib/mock-observations/index.ts +++ b/src/lib/mock-observations/index.ts @@ -40,7 +40,7 @@ export class MockObservations implements ModelPluginInterface { duration: this.duration, }; // TODO PB -- consider this way to copy key-value pairs from component to observation, it looks like an overkill - for (const key in component) { + for (const key in component) { if (Object.prototype.hasOwnProperty.call(component, key)) { observation[key] = component[key]; }