backend-assistant
Advanced tools
Comparing version 0.0.30 to 0.0.31
{ | ||
"name": "backend-assistant", | ||
"version": "0.0.30", | ||
"version": "0.0.31", | ||
"description": "Powerful assistive functions for Firebase backends", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -109,20 +109,4 @@ let _ = require('lodash'); | ||
// 1. Convert args to a normal array | ||
let args = Array.prototype.slice.call(arguments); | ||
let logs = []; | ||
let logs = [...Array.prototype.slice.call(arguments)]; | ||
// loop through and convert objects to strings if in development | ||
for (var i = 0, l = args.length; i < l; i++) { | ||
let tempItem; | ||
// if it's an error, log in now and continue to next item | ||
if (args[i] instanceof Error) { | ||
console.error(args[i]); | ||
continue; | ||
} | ||
tempItem = typeof args[i] === 'object' | ||
? tryLogPrep(args[i], self.meta.environment) | ||
: args[i]; | ||
tempItem = typeof tempItem === 'string' && self.meta.environment !== 'development' ? tempItem.replace(/\r\n|\r|\n/, '') : tempItem; | ||
logs = logs.concat(tempItem); | ||
} | ||
// 2. Prepend log prefix log string | ||
@@ -258,6 +242,2 @@ logs.unshift(`[${self.meta.name} ${self.meta.startTime.timestamp}] >`); | ||
).trim() | ||
// return ( | ||
// // headers['cf-ipcountry'] || | ||
// '' | ||
// ) | ||
} | ||
@@ -275,8 +255,2 @@ | ||
).trim() | ||
// return ( | ||
// headers['cf-connecting-ip'] || | ||
// headers['x-appengine-user-ip'] || | ||
// (headers['x-forwarded-for'] || '').split(',').pop() || | ||
// '127.0.0.1' | ||
// ) | ||
} | ||
@@ -310,15 +284,2 @@ | ||
function tryLogPrep(obj, environment) { | ||
let result; | ||
JSON5 = JSON5 || require('json5'); | ||
try { | ||
result = environment === 'development' | ||
? JSON5.stringify(obj, null, 2) | ||
: JSON5.stringify(obj) | ||
} catch (e) { | ||
} finally { | ||
return result || obj; | ||
} | ||
} | ||
module.exports = BackendAssistant; |
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
15082
269