tardis-dev
Advanced tools
Comparing version 12.2.0 to 12.2.1
@@ -16,8 +16,9 @@ "use strict"; | ||
const id = normalizedMessage.name !== undefined ? `${normalizedMessage.symbol}:${normalizedMessage.name}` : normalizedMessage.symbol; | ||
const computables = factory.getOrCreate(normalizedMessage.exchange, id); | ||
const computablesMap = factory.getOrCreate(normalizedMessage.exchange, id); | ||
const computables = computablesMap[normalizedMessage.type]; | ||
if (!computables) | ||
continue; | ||
for (const computable of computables) { | ||
if (computable.sourceDataTypes.includes(normalizedMessage.type)) { | ||
for (const computedMessage of computable.compute(normalizedMessage)) { | ||
yield computedMessage; | ||
} | ||
for (const computedMessage of computable.compute(normalizedMessage)) { | ||
yield computedMessage; | ||
} | ||
@@ -46,3 +47,3 @@ } | ||
if (this._computables[exchange][id] === undefined) { | ||
this._computables[exchange][id] = this._computablesFactories.map((c) => c()); | ||
this._computables[exchange][id] = createComputablesMap(this._computablesFactories.map((c) => c())); | ||
} | ||
@@ -55,2 +56,16 @@ return this._computables[exchange][id]; | ||
} | ||
function createComputablesMap(computables) { | ||
return computables.reduce((acc, computable) => { | ||
computable.sourceDataTypes.forEach((dataType) => { | ||
const existing = acc[dataType]; | ||
if (!existing) { | ||
acc[dataType] = [computable]; | ||
} | ||
else { | ||
acc[dataType].push(computable); | ||
} | ||
}); | ||
return acc; | ||
}, {}); | ||
} | ||
//# sourceMappingURL=computable.js.map |
{ | ||
"name": "tardis-dev", | ||
"version": "12.2.0", | ||
"version": "12.2.1", | ||
"engines": { | ||
@@ -5,0 +5,0 @@ "node": ">=12" |
@@ -29,9 +29,9 @@ import { Disconnect, Exchange, NormalizedData } from '../types' | ||
const computables = factory.getOrCreate(normalizedMessage.exchange, id) | ||
const computablesMap = factory.getOrCreate(normalizedMessage.exchange, id) | ||
const computables = computablesMap[normalizedMessage.type] | ||
if (!computables) continue | ||
for (const computable of computables) { | ||
if (computable.sourceDataTypes.includes(normalizedMessage.type)) { | ||
for (const computedMessage of computable.compute(normalizedMessage)) { | ||
yield computedMessage | ||
} | ||
for (const computedMessage of computable.compute(normalizedMessage)) { | ||
yield computedMessage | ||
} | ||
@@ -58,3 +58,3 @@ } | ||
[ex in Exchange]?: { | ||
[key: string]: Computable<any>[] | ||
[key: string]: { [dataType: string]: Computable<any>[] } | ||
} | ||
@@ -71,3 +71,3 @@ } = {} | ||
if (this._computables[exchange]![id] === undefined) { | ||
this._computables[exchange]![id] = this._computablesFactories.map((c) => c()) | ||
this._computables[exchange]![id] = createComputablesMap(this._computablesFactories.map((c) => c())) | ||
} | ||
@@ -82,1 +82,15 @@ | ||
} | ||
function createComputablesMap(computables: Computable<any>[]) { | ||
return computables.reduce((acc, computable) => { | ||
computable.sourceDataTypes.forEach((dataType) => { | ||
const existing = acc[dataType] | ||
if (!existing) { | ||
acc[dataType] = [computable] | ||
} else { | ||
acc[dataType].push(computable) | ||
} | ||
}) | ||
return acc | ||
}, {} as { [dataType: string]: Computable<any>[] }) | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18123
1009636
349