1
0
mirror of https://github.com/oceanprotocol/community-numbers.git synced 2024-11-24 19:10:17 +01:00
community-numbers/api/utils.js

17 lines
367 B
JavaScript

/* eslint-disable no-console */
const chalk = require('chalk')
const log = (text) => console.log(text)
const logError = (text) => console.error(chalk.bold.red(text))
const arrSum = (arr) => {
var sum = 0
arr.forEach(function (v) {
if (typeof v === 'object') sum += arrSum(v)
else sum += v
})
return sum
}
module.exports = { log, logError, arrSum }