Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@marcopeg/utils

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marcopeg/utils - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

lib/logger/debug.js

7

lib/config.js

@@ -8,3 +8,4 @@ /**

const winston = require('winston')
// const winston = require('winston')
const log = require('./logger/verbose')

@@ -16,3 +17,3 @@ const init = () => {}

if (defaultValue) {
winston.verbose(`${key}::default::${defaultValue}`)
log(`${key}::default::${defaultValue}`)
return defaultValue

@@ -23,3 +24,3 @@ }

}
winston.verbose(`${key}::${process.env[key]}`)
log(`${key}::${process.env[key]}`)
return process.env[key]

@@ -26,0 +27,0 @@ }

/* global fetch */
const pause = require('./pause')
const { isDev, get: getConfig } = require('./config')
const { isDev } = require('./config')

@@ -28,11 +28,10 @@ require('es6-promise').polyfill()

try {
const headers = config.headers || {}
const res = await wrappedFetch(url, {
...config,
const headers = Object.assign({}, config.headers || {}, {
'content-type': 'application/json',
})
const options = Object.assign({}, config, {
method: 'GET',
headers: {
...headers,
'content-type': 'application/json',
},
headers: headers,
})
const res = await wrappedFetch(url, options)

@@ -60,10 +59,9 @@ // status code error handling

const getJSONAuth = (url, token, config = {}) => {
const headers = config.headers || {}
return getJSON(url, {
...config,
headers: {
...headers,
Authorization: `Bearer ${token}`,
},
const headers = Object.assign({}, config.headers || {}, {
Authorization: `Bearer ${token}`,
})
const options = Object.assign({}, config, {
headers: headers,
})
return getJSON(url, options)
}

@@ -73,12 +71,11 @@

try {
const headers = config.headers || {}
const res = await wrappedFetch(url, {
...config,
const headers = Object.assign({}, config.headers || {}, {
'content-type': 'application/json',
})
const options = Object.assign({}, config, {
method: 'POST',
headers: {
...headers,
'content-type': 'application/json',
},
headers: headers,
body: JSON.stringify(data),
})
const res = await wrappedFetch(url, options)

@@ -106,10 +103,9 @@ // status code error handling

const postJSONAuth = (url, token, data = {}, config = {}) => {
const headers = config.headers || {}
return postJSON(url, data, {
...config,
headers: {
...headers,
Authorization: `Bearer ${token}`,
},
const headers = Object.assign({}, config.headers || {}, {
Authorization: `Bearer ${token}`,
})
const options = Object.assign({}, config, {
headers: headers,
})
return postJSON(url, data, options)
}

@@ -119,12 +115,11 @@

try {
const headers = config.headers || {}
const res = await wrappedFetch(url, {
...config,
const headers = Object.assign({}, config.headers || {}, {
'content-type': 'application/json',
})
const options = Object.assign({}, config, {
method: 'PUT',
headers: {
...headers,
'content-type': 'application/json',
},
headers: headers,
body: JSON.stringify(data),
})
const res = await wrappedFetch(url, options)

@@ -152,10 +147,9 @@ // status code error handling

const putJSONAuth = (url, token, data = {}, config = {}) => {
const headers = config.headers || {}
return putJSON(url, data, {
...config,
headers: {
...headers,
Authorization: `Bearer ${token}`,
},
const headers = Object.assign({}, config.headers || {}, {
Authorization: `Bearer ${token}`,
})
const options = Object.assign({}, config, {
headers: headers,
})
return putJSON(url, data, options)
}

@@ -172,2 +166,2 @@

module.exports = wrappedFetch
module.exports = wrappedFetch
{
"name": "@marcopeg/utils",
"version": "1.2.0",
"version": "1.3.0",
"description": "Javascript utils for server and client projects",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc