Skip to content

Commit

Permalink
Bump version to 0.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
apih committed Jul 14, 2024
1 parent 3a9dc5b commit 94a02af
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 15 deletions.
2 changes: 1 addition & 1 deletion dist/locales/en.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* quival v0.3.2 (https://github.com/apih/quival)
* quival v0.3.3 (https://github.com/apih/quival)
* (c) 2023 Mohd Hafizuddin M Marzuki <hafizuddin_83@yahoo.com>
* Released under the MIT License.
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/en.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/locales/ms.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* quival v0.3.2 (https://github.com/apih/quival)
* quival v0.3.3 (https://github.com/apih/quival)
* (c) 2023 Mohd Hafizuddin M Marzuki <hafizuddin_83@yahoo.com>
* Released under the MIT License.
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/locales/ms.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 16 additions & 6 deletions dist/quival.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* quival v0.3.2 (https://github.com/apih/quival)
* quival v0.3.3 (https://github.com/apih/quival)
* (c) 2023 Mohd Hafizuddin M Marzuki <hafizuddin_83@yahoo.com>
* Released under the MIT License.
*/
Expand Down Expand Up @@ -946,6 +946,9 @@ var quival = (function (exports) {
has(key) {
return this.first(key) !== '';
}
remove(key) {
delete this.#data[key];
}
messages() {
return this.#data;
}
Expand Down Expand Up @@ -1269,6 +1272,7 @@ var quival = (function (exports) {
#checkers;
#replacers;
#errors;
#skippedAttributes;
#implicitAttributes;
#stopOnFirstFailure;
#alwaysBail;
Expand All @@ -1295,6 +1299,7 @@ var quival = (function (exports) {
Validator.#dummyRules.push(rule);
}
constructor(data = {}, rules = {}, messages = {}, attributes = {}, values = {}) {
this.#skippedAttributes = [];
this.#implicitAttributes = {};
this.#stopOnFirstFailure = false;
this.#alwaysBail = false;
Expand Down Expand Up @@ -1406,23 +1411,24 @@ var quival = (function (exports) {
this.#checkers.clearCaches();
this.#errors = new ErrorBag();
const tasks = [];
const skippedAttributes = [];
for (const [attribute, rules] of Object.entries(this.#rules)) {
let value = this.getValue(attribute);
if (Object.hasOwn(rules, 'sometimes') && typeof value === 'undefined') {
skippedAttributes.push(attribute);
continue;
}
tasks.push(async () => {
const doBail = this.#alwaysBail || Object.hasOwn(rules, 'bail');
const isNullable = Object.hasOwn(rules, 'nullable');
let noError = true;
for (const [rule, parameters] of Object.entries(rules)) {
if (rule === '') {
continue;
}
if (
!Validator.#implicitRules.includes(rule) &&
(typeof value === 'undefined' || (typeof value === 'string' && value.trim() === '') || (isNullable && value === null))
rule === '' ||
(!Validator.#implicitRules.includes(rule) &&
(typeof value === 'undefined' || (typeof value === 'string' && value.trim() === '') || (isNullable && value === null)))
) {
skippedAttributes.push(attribute);
continue;
}
let result, success, message;
Expand Down Expand Up @@ -1460,6 +1466,7 @@ var quival = (function (exports) {
await Promise.allSettled(tasks.map((task) => task()));
this.#errors.sortByKeys(Object.keys(this.#rules));
}
this.#skippedAttributes = skippedAttributes.filter((value, index, array) => array.indexOf(value) === index);
return this.#errors;
}
async passes() {
Expand Down Expand Up @@ -1593,6 +1600,9 @@ var quival = (function (exports) {
errors() {
return this.#errors;
}
skippedAttributes() {
return this.#skippedAttributes;
}
}

exports.Checkers = Checkers;
Expand Down
4 changes: 2 additions & 2 deletions dist/quival.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quival",
"version": "0.3.2",
"version": "0.3.3",
"description": "Data validation à la Laravel Validation",
"author": "Mohd Hafizuddin M Marzuki <hafizuddin_83@yahoo.com>",
"license": "MIT",
Expand Down

0 comments on commit 94a02af

Please sign in to comment.