Skip to content
This repository was archived by the owner on Nov 10, 2021. It is now read-only.

Commit 5aab6f5

Browse files
committed
Replace with lodash mapValues function
Previous mapMap was incorrectly returning empty map object in all scenarios.
1 parent 807943c commit 5aab6f5

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

lib/conseil.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,6 @@ const ONE_HOUR_MILLIS = 60 * ONE_MINUTE_MILLIS
2222
const ONE_DAY_MILLIS = 24 * ONE_HOUR_MILLIS
2323
const ONE_WEEK_MILLIS = 7 * ONE_DAY_MILLIS
2424

25-
Map.prototype.mapMap = function(callback) {
26-
const output = new Map()
27-
this.forEach((element, key)=>{
28-
output.set(key, callback(element, key))
29-
})
30-
return output
31-
}
32-
3325
Array.prototype.sum = Array.prototype.sum || function (){
3426
return this.reduce(function(p,c){return p+c},0);
3527
};
@@ -1172,11 +1164,13 @@ const getFeaturedArtisticUniverse = async (max_time) => {
11721164

11731165

11741166
let replacementScore = Object.values(tzktscores).filter(v => v !== -1).avg() / 2
1175-
tzktscores = tzktscores.mapMap((value, key) => {
1167+
tzktscores = _.mapValues(tzktscores, function(value) {
11761168
if (value === -1) {
11771169
return replacementScore
1170+
} else
1171+
{
1172+
return value
11781173
}
1179-
return value
11801174
})
11811175
// Cost to be on feed per objekt last 7 days shouldn't be higher than any of:
11821176
// 0.5tez

0 commit comments

Comments
 (0)