From fe66f41ddd3ced721c51f930200c5212a481d720 Mon Sep 17 00:00:00 2001 From: Martin Karkowski Date: Tue, 2 Aug 2022 22:31:48 +0200 Subject: [PATCH] auto formating --- lib/dispatcher/InstanceManager/InstanceManager.ts | 15 ++++++--------- lib/dispatcher/RpcManager/NopeRpcManager.ts | 8 +++----- lib/dispatcher/RpcManager/selectors.ts | 11 ++++------- lib/dispatcher/nopeDispatcher.ts | 8 +++----- lib/eventEmitter/nopeEventEmitter.ts | 3 +-- lib/helpers/arrayMethods.ts | 14 +++++--------- lib/helpers/pathMatchingMethods.ts | 2 +- lib/helpers/stringMethods.ts | 6 +++--- lib/module/BaseModule.ts | 11 ++--------- lib/pubSub/nopePubSubSystem.ts | 7 +++++-- 10 files changed, 33 insertions(+), 52 deletions(-) diff --git a/lib/dispatcher/InstanceManager/InstanceManager.ts b/lib/dispatcher/InstanceManager/InstanceManager.ts index d683b90..7dc115a 100644 --- a/lib/dispatcher/InstanceManager/InstanceManager.ts +++ b/lib/dispatcher/InstanceManager/InstanceManager.ts @@ -225,13 +225,11 @@ export class NopeInstanceManager implements INopeInstanceManager { ] of _this._rpcManager.services.originalData.entries()) { // Filter the Generators based on the existing services const generators = services.services - .filter((svc) => - { - return svc?.id.startsWith( + .filter((svc) => { + return svc?.id.startsWith( `nope${SPLITCHAR}core${SPLITCHAR}constructor${SPLITCHAR}` ); - } - ) + }) .map((item) => { return item.id; }); @@ -274,10 +272,9 @@ export class NopeInstanceManager implements INopeInstanceManager { dispatcher: this._id, // We will send the descriptions. instances: Array.from(this._internalInstances).map((identifier) => { - // Generate the Module Description for every identifier: - return _this._instances.get(identifier).instance.toDescription(); - } - ), + // Generate the Module Description for every identifier: + return _this._instances.get(identifier).instance.toDescription(); + }), }); // Update the Instances diff --git a/lib/dispatcher/RpcManager/NopeRpcManager.ts b/lib/dispatcher/RpcManager/NopeRpcManager.ts index 44d98c6..5551a6b 100644 --- a/lib/dispatcher/RpcManager/NopeRpcManager.ts +++ b/lib/dispatcher/RpcManager/NopeRpcManager.ts @@ -344,11 +344,9 @@ export class NopeRpcManager typeof (_resultPromise as INopePromise)?.cancel === "function" ) { // Push the Callback to the Result. - cbs.push((reason) => - { - return (_resultPromise as INopePromise).cancel(reason); - } - ); + cbs.push((reason) => { + return (_resultPromise as INopePromise).cancel(reason); + }); } // Store, who has requested the task. diff --git a/lib/dispatcher/RpcManager/selectors.ts b/lib/dispatcher/RpcManager/selectors.ts index ddd9d61..d7704c4 100644 --- a/lib/dispatcher/RpcManager/selectors.ts +++ b/lib/dispatcher/RpcManager/selectors.ts @@ -78,13 +78,10 @@ export function generateSelector( if (data.has(opts.serviceName)) { const items = Array.from(data.get(opts.serviceName)); - const hosts = items.map( - (id) => - { - return core.connectivityManager.dispatchers.originalData.get(id)?.host - .name; - } - ); + const hosts = items.map((id) => { + return core.connectivityManager.dispatchers.originalData.get(id) + ?.host.name; + }); const idx = hosts.indexOf(host); if (idx >= 0) { return items[idx]; diff --git a/lib/dispatcher/nopeDispatcher.ts b/lib/dispatcher/nopeDispatcher.ts index b6f423c..867cf0a 100644 --- a/lib/dispatcher/nopeDispatcher.ts +++ b/lib/dispatcher/nopeDispatcher.ts @@ -88,11 +88,9 @@ export class NopeDispatcher extends NopeCore implements INopeDispatcher { throw Error("Invalid Type-Parameter"); } - return items.filter( - (item) =>{ - return comparePatternAndPath(pattern, item).affected; - } - ); + return items.filter((item) => { + return comparePatternAndPath(pattern, item).affected; + }); } // See interface description diff --git a/lib/eventEmitter/nopeEventEmitter.ts b/lib/eventEmitter/nopeEventEmitter.ts index 5c0c15e..5afe788 100644 --- a/lib/eventEmitter/nopeEventEmitter.ts +++ b/lib/eventEmitter/nopeEventEmitter.ts @@ -351,8 +351,7 @@ export class NopeEventEmitter< public waitFor( testCallback: IWaitForCallback = (value) => { return (value as any as boolean) == true; - } - , + }, options: INopeWaitForObservableChangeOptions = { testCurrent: true } ): Promise { const _this = this; diff --git a/lib/helpers/arrayMethods.ts b/lib/helpers/arrayMethods.ts index 16100a1..89f4e7a 100644 --- a/lib/helpers/arrayMethods.ts +++ b/lib/helpers/arrayMethods.ts @@ -173,13 +173,9 @@ export function countElements(array: Array): Map { * @param arrayToFlatten The Array */ export function flattenDeep(arrayToFlatten) { - return arrayToFlatten.reduce( - (acc, val) => - { - return Array.isArray(val) ? acc.concat(flattenDeep(val)) : acc.concat(val); - }, - [] - ) as T[]; + return arrayToFlatten.reduce((acc, val) => { + return Array.isArray(val) ? acc.concat(flattenDeep(val)) : acc.concat(val); + }, []) as T[]; } /** @@ -255,7 +251,7 @@ export function minOfArray( }; } - const arrOfValues = arr.map((item) =>{ + const arrOfValues = arr.map((item) => { return rgetattr(item, path as string, defaultValue); }); const min = Math.min(...arrOfValues); @@ -280,7 +276,7 @@ export function maxOfArray( }; } - const arrOfValues = arr.map((item) =>{ + const arrOfValues = arr.map((item) => { return rgetattr(item, path, defaultValue); }); const max = Math.max(...arrOfValues); diff --git a/lib/helpers/pathMatchingMethods.ts b/lib/helpers/pathMatchingMethods.ts index 82a1134..719f895 100644 --- a/lib/helpers/pathMatchingMethods.ts +++ b/lib/helpers/pathMatchingMethods.ts @@ -152,7 +152,7 @@ export function generateResult( * @export * @param {string} pathPattern The pattern to test * @param {string} contentPath The path to use as basis - * @return {*} {TPathCompareResult} + * @return {TPathCompareResult} */ export function comparePatternAndPath( pathPattern: string, diff --git a/lib/helpers/stringMethods.ts b/lib/helpers/stringMethods.ts index 5277335..4f4d963 100644 --- a/lib/helpers/stringMethods.ts +++ b/lib/helpers/stringMethods.ts @@ -40,9 +40,9 @@ export function replaceAll( /** * Function to Pad a String. - * @param num - * @param size - * @param maxLength + * @param num The Number to pad + * @param size the amount of zeros to add + * @param maxLength The max length of the number. */ export function padString( num: number, diff --git a/lib/module/BaseModule.ts b/lib/module/BaseModule.ts index 0fc3ae5..a9d0d16 100644 --- a/lib/module/BaseModule.ts +++ b/lib/module/BaseModule.ts @@ -509,11 +509,7 @@ export class NopeBaseModule implements INopeModule { // the registered properties and the regiestered functions. If the prop or the // function matches ==> return the name otherwise we throw an error. - for (const [ - name, - item, - ] of this._registeredProperties.entries()) { - + for (const [name, item] of this._registeredProperties.entries()) { const { observable, options } = item; if (observable == propOrFunc) { @@ -547,10 +543,7 @@ export class NopeBaseModule implements INopeModule { } } } - for (const [ - name, - item, - ] of this._registeredFunctions.entries()) { + for (const [name, item] of this._registeredFunctions.entries()) { const { func, options } = item; if (func == propOrFunc) { return options.id; diff --git a/lib/pubSub/nopePubSubSystem.ts b/lib/pubSub/nopePubSubSystem.ts index e869bdc..8f601d0 100644 --- a/lib/pubSub/nopePubSubSystem.ts +++ b/lib/pubSub/nopePubSubSystem.ts @@ -398,7 +398,6 @@ export class PubSubSystemBase< this._matched.clear(); // Iterate through all Publishers and for (const [emitter, item] of this._emitters.entries()) { - const { pubTopic, subTopic } = item; // Now, lets Update the Matching for the specific Topics. @@ -607,7 +606,11 @@ export class PubSubSystemBase< for (const [emitter, item] of this._emitters.entries()) { if (item.subTopic) { // Now lets determine the Path - this.__addMatchingEntryIfRequired(topicOfChange, item.subTopic, emitter); + this.__addMatchingEntryIfRequired( + topicOfChange, + item.subTopic, + emitter + ); } } }