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

vue-resource-case-converter

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-resource-case-converter - npm Package Compare versions

Comparing version 1.0.8 to 2.0.0

9

dist/vue-resource-case-converter.js

@@ -87,11 +87,4 @@ 'use strict';

var parsedBody = void 0;
try {
parsedBody = JSON.parse(response.body);
} catch (e) {
return response;
}
var convertedBody = convertObjectKeys(parsedBody, camelCase);
response.body = JSON.stringify(convertedBody);
response.body = convertedBody;
return response;

@@ -98,0 +91,0 @@ });

2

dist/vue-resource-case-converter.min.js

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

"use strict";function camelCase(e){var t=/(\_\w)/g,r=function(e){return e[1].toUpperCase()};return e.replace(t,r)}function snakeCase(e){var t=/([A-Z])/g,r=function(e){return"_"+e.toLowerCase()};return e.replace(t,r)}function getClass(e){var t=Object.prototype.toString.call(e);return t.match(/\[object (.+)\]/)[1]}function convertObjectKeys(e,t){return"Object"!==getClass(e)&&"Array"!==getClass(e)?e:Object.keys(e).reduce(function(r,n){return r[t(n)]=convertObjectKeys(e[n],t),r},Array.isArray(e)?[]:{})}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},VueResourceCaseConverter={install:function(e,t){var r=function(){return!0},n=function(){return!0};return null!=t&&t.requestUrlFilter&&(r=t.requestUrlFilter),null!=t&&t.responseUrlFilter&&(n=t.responseUrlFilter),null==e.http?void(void 0).$log("Please add http-resource plugin to your Vue instance"):void e.http.interceptors.push(function(e,t){r(e.url)&&(e.params=convertObjectKeys(e.params,snakeCase),e.body=convertObjectKeys(e.body,snakeCase)),t(function(e){if(!n(e.url))return e;var t=void 0;try{t=JSON.parse(e.body)}catch(t){return e}var r=convertObjectKeys(t,camelCase);return e.body=JSON.stringify(r),e})})}};"object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports&&(module.exports=VueResourceCaseConverter);
"use strict";function camelCase(e){var t=/(\_\w)/g,r=function(e){return e[1].toUpperCase()};return e.replace(t,r)}function snakeCase(e){var t=/([A-Z])/g,r=function(e){return"_"+e.toLowerCase()};return e.replace(t,r)}function getClass(e){var t=Object.prototype.toString.call(e);return t.match(/\[object (.+)\]/)[1]}function convertObjectKeys(e,t){return"Object"!==getClass(e)&&"Array"!==getClass(e)?e:Object.keys(e).reduce(function(r,n){return r[t(n)]=convertObjectKeys(e[n],t),r},Array.isArray(e)?[]:{})}var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},VueResourceCaseConverter={install:function(e,t){var r=function(){return!0},n=function(){return!0};return null!=t&&t.requestUrlFilter&&(r=t.requestUrlFilter),null!=t&&t.responseUrlFilter&&(n=t.responseUrlFilter),null==e.http?void(void 0).$log("Please add http-resource plugin to your Vue instance"):void e.http.interceptors.push(function(e,t){r(e.url)&&(e.params=convertObjectKeys(e.params,snakeCase),e.body=convertObjectKeys(e.body,snakeCase)),t(function(e){if(!n(e.url))return e;var t=convertObjectKeys(parsedBody,camelCase);return e.body=t,e})})}};"object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports&&(module.exports=VueResourceCaseConverter);
{
"name": "vue-resource-case-converter",
"version": "1.0.8",
"version": "2.0.0",
"description": "Vue resource plugin to convert request json keys to snake_case and response json keys to camelCase",

@@ -5,0 +5,0 @@ "main": "dist/vue-resource-case-converter.js",

@@ -28,2 +28,7 @@ # vue-resource-case-converter

If you are still using older version of vue-resource (0.\*) then use 1.\* version of
case converter.
Version 2.\* does not work with 0.\* version of vue-resource, because it has some breaking changes.
## Configuration

@@ -30,0 +35,0 @@

@@ -83,12 +83,4 @@ //

let parsedBody;
try {
parsedBody = JSON.parse(response.body);
}
catch (e) {
return response;
}
const convertedBody = convertObjectKeys(parsedBody, camelCase);
response.body = JSON.stringify(convertedBody);
response.body = convertedBody;
return response;

@@ -95,0 +87,0 @@ });

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