auto formating

This commit is contained in:
Martin Karkowski 2022-08-02 22:31:48 +02:00
parent ba752f4142
commit fe66f41ddd
10 changed files with 33 additions and 52 deletions

View File

@ -225,13 +225,11 @@ export class NopeInstanceManager implements INopeInstanceManager {
] of _this._rpcManager.services.originalData.entries()) { ] of _this._rpcManager.services.originalData.entries()) {
// Filter the Generators based on the existing services // Filter the Generators based on the existing services
const generators = services.services const generators = services.services
.filter((svc) => .filter((svc) => {
{ return svc?.id.startsWith(
return svc?.id.startsWith(
`nope${SPLITCHAR}core${SPLITCHAR}constructor${SPLITCHAR}` `nope${SPLITCHAR}core${SPLITCHAR}constructor${SPLITCHAR}`
); );
} })
)
.map((item) => { .map((item) => {
return item.id; return item.id;
}); });
@ -274,10 +272,9 @@ export class NopeInstanceManager implements INopeInstanceManager {
dispatcher: this._id, dispatcher: this._id,
// We will send the descriptions. // We will send the descriptions.
instances: Array.from(this._internalInstances).map((identifier) => { instances: Array.from(this._internalInstances).map((identifier) => {
// Generate the Module Description for every identifier: // Generate the Module Description for every identifier:
return _this._instances.get(identifier).instance.toDescription(); return _this._instances.get(identifier).instance.toDescription();
} }),
),
}); });
// Update the Instances // Update the Instances

View File

@ -344,11 +344,9 @@ export class NopeRpcManager<T extends IFunctionOptions = IFunctionOptions>
typeof (_resultPromise as INopePromise<any>)?.cancel === "function" typeof (_resultPromise as INopePromise<any>)?.cancel === "function"
) { ) {
// Push the Callback to the Result. // Push the Callback to the Result.
cbs.push((reason) => cbs.push((reason) => {
{ return (_resultPromise as INopePromise<any>).cancel(reason);
return (_resultPromise as INopePromise<any>).cancel(reason); });
}
);
} }
// Store, who has requested the task. // Store, who has requested the task.

View File

@ -78,13 +78,10 @@ export function generateSelector(
if (data.has(opts.serviceName)) { if (data.has(opts.serviceName)) {
const items = Array.from(data.get(opts.serviceName)); const items = Array.from(data.get(opts.serviceName));
const hosts = items.map( const hosts = items.map((id) => {
(id) => return core.connectivityManager.dispatchers.originalData.get(id)
{ ?.host.name;
return core.connectivityManager.dispatchers.originalData.get(id)?.host });
.name;
}
);
const idx = hosts.indexOf(host); const idx = hosts.indexOf(host);
if (idx >= 0) { if (idx >= 0) {
return items[idx]; return items[idx];

View File

@ -88,11 +88,9 @@ export class NopeDispatcher extends NopeCore implements INopeDispatcher {
throw Error("Invalid Type-Parameter"); throw Error("Invalid Type-Parameter");
} }
return items.filter( return items.filter((item) => {
(item) =>{ return comparePatternAndPath(pattern, item).affected;
return comparePatternAndPath(pattern, item).affected; });
}
);
} }
// See interface description // See interface description

View File

@ -351,8 +351,7 @@ export class NopeEventEmitter<
public waitFor( public waitFor(
testCallback: IWaitForCallback<G, AD> = (value) => { testCallback: IWaitForCallback<G, AD> = (value) => {
return (value as any as boolean) == true; return (value as any as boolean) == true;
} },
,
options: INopeWaitForObservableChangeOptions = { testCurrent: true } options: INopeWaitForObservableChangeOptions = { testCurrent: true }
): Promise<G> { ): Promise<G> {
const _this = this; const _this = this;

View File

@ -173,13 +173,9 @@ export function countElements<T>(array: Array<T>): Map<T, number> {
* @param arrayToFlatten The Array * @param arrayToFlatten The Array
*/ */
export function flattenDeep<T>(arrayToFlatten) { export function flattenDeep<T>(arrayToFlatten) {
return arrayToFlatten.reduce( return arrayToFlatten.reduce((acc, val) => {
(acc, val) => return Array.isArray(val) ? acc.concat(flattenDeep(val)) : acc.concat(val);
{ }, []) as T[];
return Array.isArray(val) ? acc.concat(flattenDeep(val)) : acc.concat(val);
},
[]
) as T[];
} }
/** /**
@ -255,7 +251,7 @@ export function minOfArray<T>(
}; };
} }
const arrOfValues = arr.map((item) =>{ const arrOfValues = arr.map((item) => {
return rgetattr<number>(item, path as string, defaultValue); return rgetattr<number>(item, path as string, defaultValue);
}); });
const min = Math.min(...arrOfValues); const min = Math.min(...arrOfValues);
@ -280,7 +276,7 @@ export function maxOfArray(
}; };
} }
const arrOfValues = arr.map((item) =>{ const arrOfValues = arr.map((item) => {
return rgetattr<number>(item, path, defaultValue); return rgetattr<number>(item, path, defaultValue);
}); });
const max = Math.max(...arrOfValues); const max = Math.max(...arrOfValues);

View File

@ -152,7 +152,7 @@ export function generateResult(
* @export * @export
* @param {string} pathPattern The pattern to test * @param {string} pathPattern The pattern to test
* @param {string} contentPath The path to use as basis * @param {string} contentPath The path to use as basis
* @return {*} {TPathCompareResult} * @return {TPathCompareResult}
*/ */
export function comparePatternAndPath( export function comparePatternAndPath(
pathPattern: string, pathPattern: string,

View File

@ -40,9 +40,9 @@ export function replaceAll(
/** /**
* Function to Pad a String. * Function to Pad a String.
* @param num * @param num The Number to pad
* @param size * @param size the amount of zeros to add
* @param maxLength * @param maxLength The max length of the number.
*/ */
export function padString( export function padString(
num: number, num: number,

View File

@ -509,11 +509,7 @@ export class NopeBaseModule implements INopeModule {
// the registered properties and the regiestered functions. If the prop or the // the registered properties and the regiestered functions. If the prop or the
// function matches ==> return the name otherwise we throw an error. // function matches ==> return the name otherwise we throw an error.
for (const [ for (const [name, item] of this._registeredProperties.entries()) {
name,
item,
] of this._registeredProperties.entries()) {
const { observable, options } = item; const { observable, options } = item;
if (observable == propOrFunc) { if (observable == propOrFunc) {
@ -547,10 +543,7 @@ export class NopeBaseModule implements INopeModule {
} }
} }
} }
for (const [ for (const [name, item] of this._registeredFunctions.entries()) {
name,
item,
] of this._registeredFunctions.entries()) {
const { func, options } = item; const { func, options } = item;
if (func == propOrFunc) { if (func == propOrFunc) {
return options.id; return options.id;

View File

@ -398,7 +398,6 @@ export class PubSubSystemBase<
this._matched.clear(); this._matched.clear();
// Iterate through all Publishers and // Iterate through all Publishers and
for (const [emitter, item] of this._emitters.entries()) { for (const [emitter, item] of this._emitters.entries()) {
const { pubTopic, subTopic } = item; const { pubTopic, subTopic } = item;
// Now, lets Update the Matching for the specific Topics. // Now, lets Update the Matching for the specific Topics.
@ -607,7 +606,11 @@ export class PubSubSystemBase<
for (const [emitter, item] of this._emitters.entries()) { for (const [emitter, item] of this._emitters.entries()) {
if (item.subTopic) { if (item.subTopic) {
// Now lets determine the Path // Now lets determine the Path
this.__addMatchingEntryIfRequired(topicOfChange, item.subTopic, emitter); this.__addMatchingEntryIfRequired(
topicOfChange,
item.subTopic,
emitter
);
} }
} }
} }