vue-axios-http
Advanced tools
Comparing version 3.1.1 to 3.1.2
@@ -5,2 +5,12 @@ # Changelog | ||
### [3.1.2](https://github.com/chantouchsek/vue-axios-http/compare/v3.1.1...v3.1.2) (2022-07-08) | ||
### Bug Fixes | ||
* :tada: make the clear fuction onkeydown work correctly ([1b9a550](https://github.com/chantouchsek/vue-axios-http/commit/1b9a55053642566d44715cc7a05cc5bed8179fb7)) | ||
* make keydown more specific ([045be20](https://github.com/chantouchsek/vue-axios-http/commit/045be20b878eb105fc22345b6a94d444e390f1b6)) | ||
* remove unused type ([ad383b7](https://github.com/chantouchsek/vue-axios-http/commit/ad383b7c29d02dca6eb708878e08c3dfc37b5c73)) | ||
* typing typo ([29def5b](https://github.com/chantouchsek/vue-axios-http/commit/29def5b85e9e9fc21b8133b4e1f034f6fc11ffbd)) | ||
### [3.1.1](https://github.com/chantouchsek/vue-axios-http/compare/v3.1.0...v3.1.1) (2022-07-08) | ||
@@ -7,0 +17,0 @@ |
@@ -8,2 +8,3 @@ "use strict"; | ||
const util_1 = require("../util"); | ||
const lodash_1 = require("lodash"); | ||
const qs_1 = __importDefault(require("qs")); | ||
@@ -40,4 +41,4 @@ const validator = Validator_1.default; | ||
put(id, payload, config) { | ||
const parameter = id && !(0, util_1.isObject)(id) ? `/${id}` : ''; | ||
const body = (0, util_1.isObject)(id) ? id : payload; | ||
const parameter = id && !(0, lodash_1.isObject)(id) ? `/${id}` : ''; | ||
const body = (0, lodash_1.isObject)(id) ? id : payload; | ||
const requestType = (0, util_1.hasFiles)(body) ? 'post' : 'put'; | ||
@@ -50,4 +51,4 @@ if ((0, util_1.hasFiles)(body)) { | ||
patch(id, payload, config) { | ||
const parameter = id && !(0, util_1.isObject)(id) ? `/${id}` : ''; | ||
const body = (0, util_1.isObject)(id) ? id : payload; | ||
const parameter = id && !(0, lodash_1.isObject)(id) ? `/${id}` : ''; | ||
const body = (0, lodash_1.isObject)(id) ? id : payload; | ||
return this.submit('patch', parameter, body, config); | ||
@@ -147,3 +148,3 @@ } | ||
} | ||
else if ((0, util_1.isArray)(parameters)) { | ||
else if ((0, lodash_1.isArray)(parameters)) { | ||
for (const parameter of parameters) { | ||
@@ -150,0 +151,0 @@ delete this.parameters[parameter]; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const lodash_1 = require("lodash"); | ||
const util_1 = require("../util"); | ||
const lodash_get_1 = __importDefault(require("lodash.get")); | ||
const lodash_has_1 = __importDefault(require("lodash.has")); | ||
class Validator { | ||
@@ -24,6 +20,6 @@ constructor(errors = {}) { | ||
has(field) { | ||
if (Array.isArray(field)) { | ||
if ((0, lodash_1.isArray)(field)) { | ||
return (0, util_1.is)(Object.keys(this.errors), field); | ||
} | ||
let hasError = (0, lodash_has_1.default)(this.errors, field); | ||
let hasError = (0, lodash_1.has)(this.errors, field); | ||
if (!hasError) { | ||
@@ -38,3 +34,3 @@ const errors = Object.keys(this.errors).filter((e) => e.startsWith(`${field}.`) || e.startsWith(`${field}[`)); | ||
for (let i = 0; i < field.length; i++) { | ||
if (!(0, lodash_has_1.default)(this.errors, field[i])) { | ||
if (!(0, lodash_1.has)(this.errors, field[i])) { | ||
continue; | ||
@@ -85,3 +81,3 @@ } | ||
get(field) { | ||
return (0, lodash_get_1.default)(this.errors, field) || []; | ||
return (0, lodash_1.get)(this.errors, field) || []; | ||
} | ||
@@ -104,19 +100,3 @@ all() { | ||
} | ||
const errors = Object.assign({}, this.errors); | ||
if (attribute instanceof Array) { | ||
attribute.map((field) => { | ||
Object.keys(errors) | ||
.filter((e) => e === field || | ||
e.startsWith(`${field}.`) || | ||
e.startsWith(`${field}[`)) | ||
.forEach((e) => delete errors[e]); | ||
}); | ||
} | ||
else { | ||
Object.keys(errors) | ||
.filter((e) => e === attribute || | ||
e.startsWith(`${attribute}.`) || | ||
e.startsWith(`${attribute}[`)) | ||
.forEach((e) => delete errors[e]); | ||
} | ||
const errors = (0, lodash_1.omit)((0, lodash_1.cloneDeep)(this.errors), attribute); | ||
this.fill(errors); | ||
@@ -131,6 +111,6 @@ } | ||
return; | ||
const nameWithPrefix = prefix ? `${prefix}.${name}` : null; | ||
this.clear([name, nameWithPrefix]); | ||
const names = prefix ? [name, `${prefix}.${name}`] : [name]; | ||
this.clear(names); | ||
} | ||
} | ||
exports.default = new Validator(); |
@@ -25,3 +25,3 @@ "use strict"; | ||
exports.Validator = Validator_1.default; | ||
const util_1 = require("./util"); | ||
const lodash_1 = require("lodash"); | ||
// augment typings of Vue.js | ||
@@ -42,3 +42,3 @@ require("./vue"); | ||
this.installed = true; | ||
const defaultOption = (0, util_1.merge)({ | ||
const defaultOption = (0, lodash_1.merge)({ | ||
parsedQs: this.parsedQs, | ||
@@ -45,0 +45,0 @@ errorProperty: 'errors', |
@@ -11,3 +11,3 @@ "use strict"; | ||
}`; | ||
const head = document.head || document.getElementsByTagName('head')[0]; | ||
const head = document.getElementsByTagName('head')[0]; | ||
const style = document.createElement('style'); | ||
@@ -14,0 +14,0 @@ head.appendChild(style); |
export declare function isArray(object: any): boolean; | ||
export declare function hasOwnProperty(obj: any, key: any): boolean; | ||
export declare function isFile(object: any): boolean; | ||
export declare function merge(a: any, b: any): Record<any, any>; | ||
export declare function cloneDeep(object: any): any; | ||
export declare function is(errors: any, error: any): boolean; | ||
export declare function isObject(value: any): boolean; | ||
export declare function isPlainObject(value: any): boolean; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isPlainObject = exports.isObject = exports.is = exports.cloneDeep = exports.merge = exports.isFile = exports.hasOwnProperty = exports.isArray = void 0; | ||
exports.is = exports.isFile = exports.hasOwnProperty = exports.isArray = void 0; | ||
function isArray(object) { | ||
@@ -23,39 +23,2 @@ return Object.prototype.toString.call(object) === '[object Array]'; | ||
exports.isFile = isFile; | ||
function merge(a, b) { | ||
for (const key in b) { | ||
if (hasOwnProperty(b, key)) { | ||
a[key] = cloneDeep(b[key]); | ||
} | ||
} | ||
return a; | ||
} | ||
exports.merge = merge; | ||
function cloneDeep(object) { | ||
if (object === null) { | ||
return null; | ||
} | ||
if (isFile(object)) { | ||
return object; | ||
} | ||
if (isArray(object)) { | ||
const clone = []; | ||
for (const key in object) { | ||
if (hasOwnProperty(object, key)) { | ||
clone[key] = cloneDeep(object[key]); | ||
} | ||
} | ||
return clone; | ||
} | ||
if (typeof object === 'object') { | ||
const clone = {}; | ||
for (const key in object) { | ||
if (hasOwnProperty(object, key)) { | ||
clone[key] = cloneDeep(object[key]); | ||
} | ||
} | ||
return clone; | ||
} | ||
return object; | ||
} | ||
exports.cloneDeep = cloneDeep; | ||
function is(errors, error) { | ||
@@ -67,17 +30,1 @@ return isArray(error) | ||
exports.is = is; | ||
function isObject(value) { | ||
return Object.prototype.toString.call(value) === '[object Object]'; | ||
} | ||
exports.isObject = isObject; | ||
function isPlainObject(value) { | ||
if (!isObject(value)) | ||
return false; | ||
const ctor = value.constructor; | ||
if (ctor === undefined) | ||
return true; | ||
const prot = ctor.prototype; | ||
if (!isObject(prot)) | ||
return false; | ||
return hasOwnProperty(prot, 'isPrototypeOf'); | ||
} | ||
exports.isPlainObject = isPlainObject; |
{ | ||
"name": "vue-axios-http", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"description": "Elegant and simple way to build requests for REST API", | ||
@@ -15,3 +15,2 @@ "main": "dist/index.js", | ||
"release": "standard-version && git push --follow-tags origin main && yarn publish", | ||
"prepublish": "yarn lint && yarn test && yarn build", | ||
"clean": "rimraf dist", | ||
@@ -56,4 +55,3 @@ "prepare": "husky install", | ||
"@types/jest": "^27.4.0", | ||
"@types/lodash.get": "^4.4.7", | ||
"@types/lodash.has": "^4.5.7", | ||
"@types/lodash": "^4.14.182", | ||
"@types/node": "^18.0.0", | ||
@@ -88,4 +86,3 @@ "@types/qs": "^6.9.7", | ||
"axios": "^0.27.2", | ||
"lodash.get": "^4.4.2", | ||
"lodash.has": "^4.5.2", | ||
"lodash": "^4.17.21", | ||
"qs": "^6.10.2" | ||
@@ -92,0 +89,0 @@ }, |
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
3
27
50238
693
+ Addedlodash@^4.17.21
+ Addedlodash@4.17.21(transitive)
- Removedlodash.get@^4.4.2
- Removedlodash.has@^4.5.2
- Removedlodash.get@4.4.2(transitive)
- Removedlodash.has@4.5.2(transitive)