Skip to content

Commit f7f144e

Browse files
author
Philipp
committed
Updated exists function
1 parent 1974f0a commit f7f144e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pmochine/vee-validate-laravel",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Adds simple laravel form validation support to vee-validate",
55
"main": "src/vee-validate-laravel.js",
66
"scripts": {

src/vee-validate-laravel.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,27 @@ const Plugin = {
1616
*/
1717
function addToErrorBag(errorResponse) {
1818
// only allow this function to be run if the validator exists
19-
if (!exists(this, '$validator')) return null;
19+
if (!hasProperty(this, '$validator')) return null;
2020

2121
// check if there is data in the response
22-
if (!exists(errorResponse, 'data')) return null;
22+
if (!hasProperty(errorResponse, 'data')) return null;
2323

2424
// clear errors
2525
this.$validator.errors.clear();
2626

2727
// check if errors exist
28-
if (!exists(errorResponse.data, 'errors')) return null;
28+
if (!hasProperty(errorResponse.data, 'errors')) return null;
2929

3030
return loopThroughErrors(errorResponse.data.errors);
3131
}
3232

33-
exists = (obj, key) => {
33+
function hasProperty(obj, key) {
3434
if (!obj) return false;
3535

3636
const has = Object.prototype.hasOwnProperty;
3737

3838
return has.call(obj, key);
39-
};
39+
}
4040

4141
function loopThroughErrors(errors) {
4242
let firstError = '';

0 commit comments

Comments
 (0)