🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

fetchival

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetchival - npm Package Compare versions

Comparing version

to
0.3.3

2

index.js

@@ -9,3 +9,3 @@ ;(function (window) {

var arr = Object.keys(queryParams).map(function (k) {
return [k, encodeURIComponent(queryParams[k])].join('=')
return k + '=' + encodeURIComponent(queryParams[k])
})

@@ -12,0 +12,0 @@ return '?' + arr.join('&')

@@ -1,1 +0,1 @@

(function(n){function e(n,e){for(var t in e)n[t]=n[t]||e[t]}function t(n){var e=Object.keys(n).map(function(e){return[e,encodeURIComponent(n[e])].join("=")});return["?"].concat(e).join("&")}function o(n,o,r,i,f){r.method=n;r.headers=r.headers||{};r.responseAs=r.responseAs&&["json","text"].indexOf(r.responseAs)>=0?r.responseAs:"json";e(r.headers,{Accept:"application/json","Content-Type":"application/json"});if(f){o+=t(f)}if(i){r.body=JSON.stringify(i)}return fetchival.fetch(o,r).then(function(n){if(n.status>=200&&n.status<300){return n[r.responseAs]()}var e=new Error(n.statusText);e.response=n;throw e})}function fetchival(n,t){t=t||{};var r=function(o,r){o=n+"/"+o;r=r||{};e(r,t);return fetchival(o,r)};r.get=function(e){return o("GET",n,t,null,e)};r.post=function(e){return o("POST",n,t,e)};r.put=function(e){return o("PUT",n,t,e)};r.patch=function(e){return o("PATCH",n,t,e)};r.delete=function(){return o("DELETE",n,t)};return r}fetchival.fetch=typeof fetch!=="undefined"?fetch.bind(n):null;if(typeof exports==="object")module.exports=fetchival;else if(typeof define==="function"&&define.amd)define(function(){return fetchival});else n.fetchival=fetchival})(typeof window!="undefined"?window:undefined);
(function(e){function n(e,n){for(var t in n)e[t]=e[t]||n[t]}function t(e){var n=Object.keys(e).map(function(n){return n+"="+encodeURIComponent(e[n])});return"?"+n.join("&")}function o(e,o,r,s,i){r.method=e;r.headers=r.headers||{};r.responseAs=r.responseAs&&["json","text","response"].indexOf(r.responseAs)>=0?r.responseAs:"json";n(r.headers,{Accept:"application/json","Content-Type":"application/json"});if(i){o+=t(i)}if(s){r.body=JSON.stringify(s)}else{delete r.body}return fetchival.fetch(o,r).then(function(e){if(e.status>=200&&e.status<300){if(r.responseAs=="response")return e;if(e.status==204)return null;return e[r.responseAs]()}var n=new Error(e.statusText);n.response=e;throw n})}function fetchival(e,t){t=t||{};var r=function(o,r){o=e+"/"+o;r=r||{};n(r,t);return fetchival(o,r)};r.get=function(n){return o("GET",e,t,null,n)};r.post=function(n){return o("POST",e,t,n)};r.put=function(n){return o("PUT",e,t,n)};r.patch=function(n){return o("PATCH",e,t,n)};r.delete=function(){return o("DELETE",e,t)};return r}fetchival.fetch=typeof fetch!=="undefined"?fetch.bind(e):null;if(typeof exports==="object")module.exports=fetchival;else if(typeof define==="function"&&define.amd)define(function(){return fetchival});else e.fetchival=fetchival})(typeof window!="undefined"?window:undefined);
{
"name": "fetchival",
"version": "0.3.2",
"version": "0.3.3",
"description": "Makes JSON requests with fetch easier",

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

@@ -128,3 +128,3 @@ # fetchival.js [![Travis](https://img.shields.io/travis/typicode/fetchival.svg)](https://travis-ci.org/typicode/fetchival)

`responseAs` must be either `text` or `json` (the default)
`responseAs` can be `response`, `text` or `json` (default)

@@ -131,0 +131,0 @@ To use fetchival in Node, you need to install `node-fetch` and configure fetchival to use it

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet