1
0
mirror of https://github.com/oceanprotocol/community-numbers.git synced 2024-12-22 17:23:31 +01:00
community-numbers/api/utils.js

17 lines
367 B
JavaScript
Raw Normal View History

2019-05-14 20:52:48 +02:00
/* eslint-disable no-console */
const chalk = require('chalk')
2020-06-16 12:32:47 +02:00
const log = (text) => console.log(text)
const logError = (text) => console.error(chalk.bold.red(text))
2019-05-14 20:52:48 +02:00
2020-06-16 16:43:55 +02:00
const arrSum = (arr) => {
var sum = 0
arr.forEach(function (v) {
if (typeof v === 'object') sum += arrSum(v)
else sum += v
})
return sum
}
2019-06-06 20:26:32 +02:00
module.exports = { log, logError, arrSum }