vue-resource-case-converter
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -87,3 +87,3 @@ 'use strict'; | ||
var convertedBody = convertObjectKeys(parsedBody, camelCase); | ||
var convertedBody = convertObjectKeys(response.body, camelCase); | ||
response.body = convertedBody; | ||
@@ -90,0 +90,0 @@ return response; |
@@ -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=convertObjectKeys(parsedBody,camelCase);return e.body=t,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(e.body,camelCase);return e.body=t,e})})}};"object"===("undefined"==typeof module?"undefined":_typeof(module))&&module.exports&&(module.exports=VueResourceCaseConverter); |
{ | ||
"name": "vue-resource-case-converter", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"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", |
@@ -83,3 +83,3 @@ // | ||
const convertedBody = convertObjectKeys(parsedBody, camelCase); | ||
const convertedBody = convertObjectKeys(response.body, camelCase); | ||
response.body = convertedBody; | ||
@@ -86,0 +86,0 @@ return response; |
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
10930