Socket
Socket
Sign inDemoInstall

mande

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mande - npm Package Compare versions

Comparing version 0.0.22 to 0.0.23

6

CHANGELOG.md

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

## [0.0.23](https://github.com/posva/mande/compare/v0.0.22...v0.0.23) (2020-08-10)
### Bug Fixes
- **nuxt:** missign cookies ([c9b02d2](https://github.com/posva/mande/commit/c9b02d25ce4511e1611b4f38972038c144c2428e))
## [0.0.22](https://github.com/posva/mande/compare/v0.0.21...v0.0.22) (2020-08-09)

@@ -2,0 +8,0 @@

7

dist/mande.common.js
/*!
* mande v0.0.21
* mande v0.0.22
* (c) 2020 Eduardo San Martin Morote

@@ -105,2 +105,3 @@ * @license MIT

function nuxtWrap(api, fn) {
// args for the api call + 1 because of api parameter
const argsAmount = fn.length;

@@ -110,6 +111,5 @@ const wrappedCall = function _wrappedCall() {

let args = Array.from(arguments);
// call from nuxt server
// call from nuxt server with a function to augment the api instance
if (arguments.length === argsAmount) {
apiInstance = Object.assign({}, api);
apiInstance.options = Object.assign(Object.assign({}, apiInstance.options), { headers: Object.assign({}, apiInstance.options.headers) });
// remove the first argument

@@ -119,3 +119,2 @@ const [augmentApiInstance] = args.splice(0, 1);

augmentApiInstance(apiInstance);
apiInstance.options.headers = Object.assign({}, apiInstance.options.headers);
}

@@ -122,0 +121,0 @@ return fn.call(null, apiInstance, ...args);

/*!
* mande v0.0.21
* mande v0.0.22
* (c) 2020 Eduardo San Martin Morote

@@ -101,2 +101,3 @@ * @license MIT

function nuxtWrap(api, fn) {
// args for the api call + 1 because of api parameter
const argsAmount = fn.length;

@@ -106,6 +107,5 @@ const wrappedCall = function _wrappedCall() {

let args = Array.from(arguments);
// call from nuxt server
// call from nuxt server with a function to augment the api instance
if (arguments.length === argsAmount) {
apiInstance = Object.assign({}, api);
apiInstance.options = Object.assign(Object.assign({}, apiInstance.options), { headers: Object.assign({}, apiInstance.options.headers) });
// remove the first argument

@@ -115,3 +115,2 @@ const [augmentApiInstance] = args.splice(0, 1);

augmentApiInstance(apiInstance);
apiInstance.options.headers = Object.assign({}, apiInstance.options.headers);
}

@@ -118,0 +117,0 @@ return fn.call(null, apiInstance, ...args);

/*!
* mande v0.0.21
* mande v0.0.22
* (c) 2020 Eduardo San Martin Morote
* @license MIT
*/
let e=/\/+$/,n=/^\/+/;const t={responseAs:"json",headers:{Accept:"application/json","Content-Type":"application/json"}};function s(s,o={},i){function r(o,i,r,l={}){let u,p;"object"==typeof i?(u="",p=i,l=r||{}):(u=i,p=r);let b=Object.assign(Object.assign(Object.assign(Object.assign({},t),a),{method:o}),l),j=Object.assign(Object.assign(Object.assign({},t.query),a.query),l.query),{responseAs:d}=b;return b.headers=Object.assign(Object.assign(Object.assign({},t.headers),a.headers),l.headers),u=function(t,s){return t.replace(e,"")+"/"+s.replace(n,"")}(s,"number"==typeof u?""+u:u||""),u+=function(e){let n=Object.keys(e).map(n=>[n,e[n]].map(encodeURIComponent).join("=")).join("&");return n?"?"+n:""}(j),p&&(b.body=JSON.stringify(p)),c(u,b).then(e=>Promise.all([e,"response"===d?e:e[d]().catch(()=>null)])).then(([e,n])=>{if(e.status>=200&&e.status<300)return 204==e.status?null:n;let t=new Error(e.statusText);throw t.response=e,t.body=n,t})}const c="undefined"!=typeof fetch?fetch:i;if(!c)throw new Error("No fetch function exists. Make sure to include a polyfill on Node.js.");const a=Object.assign({headers:{}},o);return{options:a,post:r.bind(null,"POST"),put:r.bind(null,"PUT"),patch:r.bind(null,"PATCH"),get:(e,n)=>r("GET",e,null,n),delete:(e,n)=>r("DELETE",e,null,n)}}function o(e,n){const t=n.length;return function(){let s=e,o=Array.from(arguments);if(arguments.length===t){s=Object.assign({},e),s.options=Object.assign(Object.assign({},s.options),{headers:Object.assign({},s.options.headers)});const[n]=o.splice(0,1);n(s),s.options.headers=Object.assign({},s.options.headers)}return n.call(null,s,...o)}}export{t as defaults,s as mande,o as nuxtWrap};
let e=/\/+$/,n=/^\/+/;const t={responseAs:"json",headers:{Accept:"application/json","Content-Type":"application/json"}};function s(s,o={},r){function c(o,r,c,a={}){let u,p;"object"==typeof r?(u="",p=r,a=c||{}):(u=r,p=c);let b=Object.assign(Object.assign(Object.assign(Object.assign({},t),l),{method:o}),a),f=Object.assign(Object.assign(Object.assign({},t.query),l.query),a.query),{responseAs:j}=b;return b.headers=Object.assign(Object.assign(Object.assign({},t.headers),l.headers),a.headers),u=function(t,s){return t.replace(e,"")+"/"+s.replace(n,"")}(s,"number"==typeof u?""+u:u||""),u+=function(e){let n=Object.keys(e).map(n=>[n,e[n]].map(encodeURIComponent).join("=")).join("&");return n?"?"+n:""}(f),p&&(b.body=JSON.stringify(p)),i(u,b).then(e=>Promise.all([e,"response"===j?e:e[j]().catch(()=>null)])).then(([e,n])=>{if(e.status>=200&&e.status<300)return 204==e.status?null:n;let t=new Error(e.statusText);throw t.response=e,t.body=n,t})}const i="undefined"!=typeof fetch?fetch:r;if(!i)throw new Error("No fetch function exists. Make sure to include a polyfill on Node.js.");const l=Object.assign({headers:{}},o);return{options:l,post:c.bind(null,"POST"),put:c.bind(null,"PUT"),patch:c.bind(null,"PATCH"),get:(e,n)=>c("GET",e,null,n),delete:(e,n)=>c("DELETE",e,null,n)}}function o(e,n){const t=n.length;return function(){let s=e,o=Array.from(arguments);if(arguments.length===t){s=Object.assign({},e);const[n]=o.splice(0,1);n(s)}return n.call(null,s,...o)}}export{t as defaults,s as mande,o as nuxtWrap};
/*!
* mande v0.0.21
* mande v0.0.22
* (c) 2020 Eduardo San Martin Morote

@@ -104,2 +104,3 @@ * @license MIT

function nuxtWrap(api, fn) {
// args for the api call + 1 because of api parameter
const argsAmount = fn.length;

@@ -109,6 +110,5 @@ const wrappedCall = function _wrappedCall() {

let args = Array.from(arguments);
// call from nuxt server
// call from nuxt server with a function to augment the api instance
if (arguments.length === argsAmount) {
apiInstance = Object.assign({}, api);
apiInstance.options = Object.assign(Object.assign({}, apiInstance.options), { headers: Object.assign({}, apiInstance.options.headers) });
// remove the first argument

@@ -118,3 +118,2 @@ const [augmentApiInstance] = args.splice(0, 1);

augmentApiInstance(apiInstance);
apiInstance.options.headers = Object.assign({}, apiInstance.options.headers);
}

@@ -121,0 +120,0 @@ return fn.call(null, apiInstance, ...args);

/*!
* mande v0.0.21
* mande v0.0.22
* (c) 2020 Eduardo San Martin Morote
* @license MIT
*/
var Mande=function(e){"use strict";let n=/\/+$/,t=/^\/+/;const s={responseAs:"json",headers:{Accept:"application/json","Content-Type":"application/json"}};return e.defaults=s,e.mande=function(e,o={},r){function i(o,r,i,l={}){let u,p;"object"==typeof r?(u="",p=r,l=i||{}):(u=r,p=i);let d=Object.assign(Object.assign(Object.assign(Object.assign({},s),c),{method:o}),l),b=Object.assign(Object.assign(Object.assign({},s.query),c.query),l.query),{responseAs:j}=d;return d.headers=Object.assign(Object.assign(Object.assign({},s.headers),c.headers),l.headers),u=function(e,s){return e.replace(n,"")+"/"+s.replace(t,"")}(e,"number"==typeof u?""+u:u||""),u+=function(e){let n=Object.keys(e).map(n=>[n,e[n]].map(encodeURIComponent).join("=")).join("&");return n?"?"+n:""}(b),p&&(d.body=JSON.stringify(p)),a(u,d).then(e=>Promise.all([e,"response"===j?e:e[j]().catch(()=>null)])).then(([e,n])=>{if(e.status>=200&&e.status<300)return 204==e.status?null:n;let t=new Error(e.statusText);throw t.response=e,t.body=n,t})}const a="undefined"!=typeof fetch?fetch:r;if(!a)throw new Error("No fetch function exists. Make sure to include a polyfill on Node.js.");const c=Object.assign({headers:{}},o);return{options:c,post:i.bind(null,"POST"),put:i.bind(null,"PUT"),patch:i.bind(null,"PATCH"),get:(e,n)=>i("GET",e,null,n),delete:(e,n)=>i("DELETE",e,null,n)}},e.nuxtWrap=function(e,n){const t=n.length;return function(){let s=e,o=Array.from(arguments);if(arguments.length===t){s=Object.assign({},e),s.options=Object.assign(Object.assign({},s.options),{headers:Object.assign({},s.options.headers)});const[n]=o.splice(0,1);n(s),s.options.headers=Object.assign({},s.options.headers)}return n.call(null,s,...o)}},e}({});
var Mande=function(e){"use strict";let n=/\/+$/,t=/^\/+/;const s={responseAs:"json",headers:{Accept:"application/json","Content-Type":"application/json"}};return e.defaults=s,e.mande=function(e,o={},r){function c(o,r,c,l={}){let u,p;"object"==typeof r?(u="",p=r,l=c||{}):(u=r,p=c);let f=Object.assign(Object.assign(Object.assign(Object.assign({},s),i),{method:o}),l),d=Object.assign(Object.assign(Object.assign({},s.query),i.query),l.query),{responseAs:b}=f;return f.headers=Object.assign(Object.assign(Object.assign({},s.headers),i.headers),l.headers),u=function(e,s){return e.replace(n,"")+"/"+s.replace(t,"")}(e,"number"==typeof u?""+u:u||""),u+=function(e){let n=Object.keys(e).map(n=>[n,e[n]].map(encodeURIComponent).join("=")).join("&");return n?"?"+n:""}(d),p&&(f.body=JSON.stringify(p)),a(u,f).then(e=>Promise.all([e,"response"===b?e:e[b]().catch(()=>null)])).then(([e,n])=>{if(e.status>=200&&e.status<300)return 204==e.status?null:n;let t=new Error(e.statusText);throw t.response=e,t.body=n,t})}const a="undefined"!=typeof fetch?fetch:r;if(!a)throw new Error("No fetch function exists. Make sure to include a polyfill on Node.js.");const i=Object.assign({headers:{}},o);return{options:i,post:c.bind(null,"POST"),put:c.bind(null,"PUT"),patch:c.bind(null,"PATCH"),get:(e,n)=>c("GET",e,null,n),delete:(e,n)=>c("DELETE",e,null,n)}},e.nuxtWrap=function(e,n){const t=n.length;return function(){let s=e,o=Array.from(arguments);if(arguments.length===t){s=Object.assign({},e);const[n]=o.splice(0,1);n(s)}return n.call(null,s,...o)}},e}({});

@@ -31,3 +31,4 @@ /** @type {import('@nuxt/types').Plugin} */

api.options.headers = { ...api.options.headers, ...reqHeaders }
// force clear any existing cookie
api.options.headers = { ...api.options.headers, cookie: null, ...reqHeaders }

@@ -34,0 +35,0 @@ if (process.server) {

{
"name": "mande",
"version": "0.0.22",
"version": "0.0.23",
"description": "Some awesome description",

@@ -5,0 +5,0 @@ "main": "dist/mande.common.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