UNPKG

analytics-reporter

Version:

A lightweight command line tool for reporting and publishing analytics data from a Google Analytics account.

21 lines (16 loc) 497 B
const config = require("../config") global.analyticsCredentialsIndex = 0 const loadCredentials = () => { const credentialData = JSON.parse(config.analytics_credentials) const credentialsArray = _wrapArray(credentialData) const index = global.analyticsCredentialsIndex++ % credentialsArray.length return credentialsArray[index] } const _wrapArray = (object) => { if (Array.isArray(object)) { return object } else { return [object] } } module.exports = { loadCredentials }