quival 0.2.8 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -29,7 +29,7 @@ There are 2 ways to start using `quival` in your project.
29
29
  Get the script from [jsDelivr CDN page](https://www.jsdelivr.com/package/npm/quival) and include it in your HTML page.
30
30
 
31
31
  ```html
32
- <script src="https://cdn.jsdelivr.net/npm/quival@0.2.x/dist/quival.min.js"></script>
32
+ <script src="https://cdn.jsdelivr.net/npm/quival@0.3.x/dist/quival.min.js"></script>
33
33
  ```
34
34
 
35
35
  Extract `Validator` class from `quival` global variable, and you are good to go.
@@ -129,14 +129,7 @@ const validator = new Validator(data, rules, customMessages, customAttributes, c
129
129
  // Perform validation
130
130
  validator
131
131
  .validate()
132
- .then(() => {
133
- console.log('Successful!');
134
- })
135
- .catch((errorBag) => {
136
- if (errorBag instanceof Error) {
137
- throw errorBag;
138
- }
139
-
132
+ .then((errorBag) => {
140
133
  console.log(errorBag.messages());
141
134
  });
142
135
  ```
@@ -190,6 +183,7 @@ The produced error messages for the code snippet above.
190
183
  The following rules are not implemented and will always pass the validation if used.
191
184
 
192
185
  - `active_url`
186
+ - `can`
193
187
  - `current_password`
194
188
  - `exclude`
195
189
  - `exclude_if`
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * quival v0.2.8 (https://github.com/apih/quival)
2
+ * quival v0.3.1 (https://github.com/apih/quival)
3
3
  * (c) 2023 Mohd Hafizuddin M Marzuki <hafizuddin_83@yahoo.com>
4
4
  * Released under the MIT License.
5
5
  */
@@ -132,6 +132,7 @@ this.quival.locales.en = (function () {
132
132
  required_array_keys: 'The :attribute field must contain entries for: :values.',
133
133
  required_if: 'The :attribute field is required when :other is :value.',
134
134
  required_if_accepted: 'The :attribute field is required when :other is accepted.',
135
+ required_if_declined: 'The :attribute field is required when :other is declined.',
135
136
  required_unless: 'The :attribute field is required unless :other is in :values.',
136
137
  required_with: 'The :attribute field is required when :values is present.',
137
138
  required_with_all: 'The :attribute field is required when :values are present.',
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * quival v0.2.8 (https://github.com/apih/quival)
2
+ * quival v0.3.1 (https://github.com/apih/quival)
3
3
  * (c) 2023 Mohd Hafizuddin M Marzuki <hafizuddin_83@yahoo.com>
4
4
  * Released under the MIT License.
5
5
  */
6
- this.quival=this.quival||{},this.quival.locales=this.quival.locales||{},this.quival.locales.en=function(){"use strict";return{accepted:"The :attribute field must be accepted.",accepted_if:"The :attribute field must be accepted when :other is :value.",active_url:"The :attribute field must be a valid URL.",after:"The :attribute field must be a date after :date.",after_or_equal:"The :attribute field must be a date after or equal to :date.",alpha:"The :attribute field must only contain letters.",alpha_dash:"The :attribute field must only contain letters, numbers, dashes, and underscores.",alpha_num:"The :attribute field must only contain letters and numbers.",array:"The :attribute field must be an array.",ascii:"The :attribute field must only contain single-byte alphanumeric characters and symbols.",before:"The :attribute field must be a date before :date.",before_or_equal:"The :attribute field must be a date before or equal to :date.",between:{array:"The :attribute field must have between :min and :max items.",file:"The :attribute field must be between :min and :max kilobytes.",numeric:"The :attribute field must be between :min and :max.",string:"The :attribute field must be between :min and :max characters."},boolean:"The :attribute field must be true or false.",can:"The :attribute field contains an unauthorized value.",confirmed:"The :attribute field confirmation does not match.",current_password:"The password is incorrect.",date:"The :attribute field must be a valid date.",date_equals:"The :attribute field must be a date equal to :date.",date_format:"The :attribute field must match the format :format.",decimal:"The :attribute field must have :decimal decimal places.",declined:"The :attribute field must be declined.",declined_if:"The :attribute field must be declined when :other is :value.",different:"The :attribute field and :other must be different.",digits:"The :attribute field must be :digits digits.",digits_between:"The :attribute field must be between :min and :max digits.",dimensions:"The :attribute field has invalid image dimensions.",distinct:"The :attribute field has a duplicate value.",doesnt_end_with:"The :attribute field must not end with one of the following: :values.",doesnt_start_with:"The :attribute field must not start with one of the following: :values.",email:"The :attribute field must be a valid email address.",ends_with:"The :attribute field must end with one of the following: :values.",enum:"The selected :attribute is invalid.",exists:"The selected :attribute is invalid.",extensions:"The :attribute field must have one of the following extensions: :values.",file:"The :attribute field must be a file.",filled:"The :attribute field must have a value.",gt:{array:"The :attribute field must have more than :value items.",file:"The :attribute field must be greater than :value kilobytes.",numeric:"The :attribute field must be greater than :value.",string:"The :attribute field must be greater than :value characters."},gte:{array:"The :attribute field must have :value items or more.",file:"The :attribute field must be greater than or equal to :value kilobytes.",numeric:"The :attribute field must be greater than or equal to :value.",string:"The :attribute field must be greater than or equal to :value characters."},hex_color:"The :attribute field must be a valid hexadecimal color.",image:"The :attribute field must be an image.",in:"The selected :attribute is invalid.",in_array:"The :attribute field must exist in :other.",integer:"The :attribute field must be an integer.",ip:"The :attribute field must be a valid IP address.",ipv4:"The :attribute field must be a valid IPv4 address.",ipv6:"The :attribute field must be a valid IPv6 address.",json:"The :attribute field must be a valid JSON string.",list:"The :attribute field must be a list.",lowercase:"The :attribute field must be lowercase.",lt:{array:"The :attribute field must have less than :value items.",file:"The :attribute field must be less than :value kilobytes.",numeric:"The :attribute field must be less than :value.",string:"The :attribute field must be less than :value characters."},lte:{array:"The :attribute field must not have more than :value items.",file:"The :attribute field must be less than or equal to :value kilobytes.",numeric:"The :attribute field must be less than or equal to :value.",string:"The :attribute field must be less than or equal to :value characters."},mac_address:"The :attribute field must be a valid MAC address.",max:{array:"The :attribute field must not have more than :max items.",file:"The :attribute field must not be greater than :max kilobytes.",numeric:"The :attribute field must not be greater than :max.",string:"The :attribute field must not be greater than :max characters."},max_digits:"The :attribute field must not have more than :max digits.",mimes:"The :attribute field must be a file of type: :values.",mimetypes:"The :attribute field must be a file of type: :values.",min:{array:"The :attribute field must have at least :min items.",file:"The :attribute field must be at least :min kilobytes.",numeric:"The :attribute field must be at least :min.",string:"The :attribute field must be at least :min characters."},min_digits:"The :attribute field must have at least :min digits.",missing:"The :attribute field must be missing.",missing_if:"The :attribute field must be missing when :other is :value.",missing_unless:"The :attribute field must be missing unless :other is :value.",missing_with:"The :attribute field must be missing when :values is present.",missing_with_all:"The :attribute field must be missing when :values are present.",multiple_of:"The :attribute field must be a multiple of :value.",not_in:"The selected :attribute is invalid.",not_regex:"The :attribute field format is invalid.",numeric:"The :attribute field must be a number.",password:{letters:"The :attribute field must contain at least one letter.",mixed:"The :attribute field must contain at least one uppercase and one lowercase letter.",numbers:"The :attribute field must contain at least one number.",symbols:"The :attribute field must contain at least one symbol.",uncompromised:"The given :attribute has appeared in a data leak. Please choose a different :attribute."},present:"The :attribute field must be present.",prohibited:"The :attribute field is prohibited.",prohibited_if:"The :attribute field is prohibited when :other is :value.",prohibited_unless:"The :attribute field is prohibited unless :other is in :values.",prohibits:"The :attribute field prohibits :other from being present.",regex:"The :attribute field format is invalid.",required:"The :attribute field is required.",required_array_keys:"The :attribute field must contain entries for: :values.",required_if:"The :attribute field is required when :other is :value.",required_if_accepted:"The :attribute field is required when :other is accepted.",required_unless:"The :attribute field is required unless :other is in :values.",required_with:"The :attribute field is required when :values is present.",required_with_all:"The :attribute field is required when :values are present.",required_without:"The :attribute field is required when :values is not present.",required_without_all:"The :attribute field is required when none of :values are present.",same:"The :attribute field must match :other.",size:{array:"The :attribute field must contain :size items.",file:"The :attribute field must be :size kilobytes.",numeric:"The :attribute field must be :size.",string:"The :attribute field must be :size characters."},starts_with:"The :attribute field must start with one of the following: :values.",string:"The :attribute field must be a string.",timezone:"The :attribute field must be a valid timezone.",unique:"The :attribute has already been taken.",uploaded:"The :attribute failed to upload.",uppercase:"The :attribute field must be uppercase.",url:"The :attribute field must be a valid URL.",ulid:"The :attribute field must be a valid ULID.",uuid:"The :attribute field must be a valid UUID.",custom:{"attribute-name":{"rule-name":"custom-message"}},attributes:{},values:{}}}();
6
+ this.quival=this.quival||{},this.quival.locales=this.quival.locales||{},this.quival.locales.en=function(){"use strict";return{accepted:"The :attribute field must be accepted.",accepted_if:"The :attribute field must be accepted when :other is :value.",active_url:"The :attribute field must be a valid URL.",after:"The :attribute field must be a date after :date.",after_or_equal:"The :attribute field must be a date after or equal to :date.",alpha:"The :attribute field must only contain letters.",alpha_dash:"The :attribute field must only contain letters, numbers, dashes, and underscores.",alpha_num:"The :attribute field must only contain letters and numbers.",array:"The :attribute field must be an array.",ascii:"The :attribute field must only contain single-byte alphanumeric characters and symbols.",before:"The :attribute field must be a date before :date.",before_or_equal:"The :attribute field must be a date before or equal to :date.",between:{array:"The :attribute field must have between :min and :max items.",file:"The :attribute field must be between :min and :max kilobytes.",numeric:"The :attribute field must be between :min and :max.",string:"The :attribute field must be between :min and :max characters."},boolean:"The :attribute field must be true or false.",can:"The :attribute field contains an unauthorized value.",confirmed:"The :attribute field confirmation does not match.",current_password:"The password is incorrect.",date:"The :attribute field must be a valid date.",date_equals:"The :attribute field must be a date equal to :date.",date_format:"The :attribute field must match the format :format.",decimal:"The :attribute field must have :decimal decimal places.",declined:"The :attribute field must be declined.",declined_if:"The :attribute field must be declined when :other is :value.",different:"The :attribute field and :other must be different.",digits:"The :attribute field must be :digits digits.",digits_between:"The :attribute field must be between :min and :max digits.",dimensions:"The :attribute field has invalid image dimensions.",distinct:"The :attribute field has a duplicate value.",doesnt_end_with:"The :attribute field must not end with one of the following: :values.",doesnt_start_with:"The :attribute field must not start with one of the following: :values.",email:"The :attribute field must be a valid email address.",ends_with:"The :attribute field must end with one of the following: :values.",enum:"The selected :attribute is invalid.",exists:"The selected :attribute is invalid.",extensions:"The :attribute field must have one of the following extensions: :values.",file:"The :attribute field must be a file.",filled:"The :attribute field must have a value.",gt:{array:"The :attribute field must have more than :value items.",file:"The :attribute field must be greater than :value kilobytes.",numeric:"The :attribute field must be greater than :value.",string:"The :attribute field must be greater than :value characters."},gte:{array:"The :attribute field must have :value items or more.",file:"The :attribute field must be greater than or equal to :value kilobytes.",numeric:"The :attribute field must be greater than or equal to :value.",string:"The :attribute field must be greater than or equal to :value characters."},hex_color:"The :attribute field must be a valid hexadecimal color.",image:"The :attribute field must be an image.",in:"The selected :attribute is invalid.",in_array:"The :attribute field must exist in :other.",integer:"The :attribute field must be an integer.",ip:"The :attribute field must be a valid IP address.",ipv4:"The :attribute field must be a valid IPv4 address.",ipv6:"The :attribute field must be a valid IPv6 address.",json:"The :attribute field must be a valid JSON string.",list:"The :attribute field must be a list.",lowercase:"The :attribute field must be lowercase.",lt:{array:"The :attribute field must have less than :value items.",file:"The :attribute field must be less than :value kilobytes.",numeric:"The :attribute field must be less than :value.",string:"The :attribute field must be less than :value characters."},lte:{array:"The :attribute field must not have more than :value items.",file:"The :attribute field must be less than or equal to :value kilobytes.",numeric:"The :attribute field must be less than or equal to :value.",string:"The :attribute field must be less than or equal to :value characters."},mac_address:"The :attribute field must be a valid MAC address.",max:{array:"The :attribute field must not have more than :max items.",file:"The :attribute field must not be greater than :max kilobytes.",numeric:"The :attribute field must not be greater than :max.",string:"The :attribute field must not be greater than :max characters."},max_digits:"The :attribute field must not have more than :max digits.",mimes:"The :attribute field must be a file of type: :values.",mimetypes:"The :attribute field must be a file of type: :values.",min:{array:"The :attribute field must have at least :min items.",file:"The :attribute field must be at least :min kilobytes.",numeric:"The :attribute field must be at least :min.",string:"The :attribute field must be at least :min characters."},min_digits:"The :attribute field must have at least :min digits.",missing:"The :attribute field must be missing.",missing_if:"The :attribute field must be missing when :other is :value.",missing_unless:"The :attribute field must be missing unless :other is :value.",missing_with:"The :attribute field must be missing when :values is present.",missing_with_all:"The :attribute field must be missing when :values are present.",multiple_of:"The :attribute field must be a multiple of :value.",not_in:"The selected :attribute is invalid.",not_regex:"The :attribute field format is invalid.",numeric:"The :attribute field must be a number.",password:{letters:"The :attribute field must contain at least one letter.",mixed:"The :attribute field must contain at least one uppercase and one lowercase letter.",numbers:"The :attribute field must contain at least one number.",symbols:"The :attribute field must contain at least one symbol.",uncompromised:"The given :attribute has appeared in a data leak. Please choose a different :attribute."},present:"The :attribute field must be present.",prohibited:"The :attribute field is prohibited.",prohibited_if:"The :attribute field is prohibited when :other is :value.",prohibited_unless:"The :attribute field is prohibited unless :other is in :values.",prohibits:"The :attribute field prohibits :other from being present.",regex:"The :attribute field format is invalid.",required:"The :attribute field is required.",required_array_keys:"The :attribute field must contain entries for: :values.",required_if:"The :attribute field is required when :other is :value.",required_if_accepted:"The :attribute field is required when :other is accepted.",required_if_declined:"The :attribute field is required when :other is declined.",required_unless:"The :attribute field is required unless :other is in :values.",required_with:"The :attribute field is required when :values is present.",required_with_all:"The :attribute field is required when :values are present.",required_without:"The :attribute field is required when :values is not present.",required_without_all:"The :attribute field is required when none of :values are present.",same:"The :attribute field must match :other.",size:{array:"The :attribute field must contain :size items.",file:"The :attribute field must be :size kilobytes.",numeric:"The :attribute field must be :size.",string:"The :attribute field must be :size characters."},starts_with:"The :attribute field must start with one of the following: :values.",string:"The :attribute field must be a string.",timezone:"The :attribute field must be a valid timezone.",unique:"The :attribute has already been taken.",uploaded:"The :attribute failed to upload.",uppercase:"The :attribute field must be uppercase.",url:"The :attribute field must be a valid URL.",ulid:"The :attribute field must be a valid ULID.",uuid:"The :attribute field must be a valid UUID.",custom:{"attribute-name":{"rule-name":"custom-message"}},attributes:{},values:{}}}();
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * quival v0.2.8 (https://github.com/apih/quival)
2
+ * quival v0.3.1 (https://github.com/apih/quival)
3
3
  * (c) 2023 Mohd Hafizuddin M Marzuki <hafizuddin_83@yahoo.com>
4
4
  * Released under the MIT License.
5
5
  */
@@ -132,6 +132,7 @@ this.quival.locales.ms = (function () {
132
132
  required_array_keys: 'Medan :attribute mesti mengandungi entri untuk: :values.',
133
133
  required_if: 'Medan :attribute diperlukan apabila :other adalah :value.',
134
134
  required_if_accepted: 'Medan :attribute diperlukan apabila :other diterima.',
135
+ required_if_declined: 'Medan :attribute diperlukan apabila :other ditolak.',
135
136
  required_unless: 'Medan :attribute diperlukan melainkan :other berada dalam :values.',
136
137
  required_with: 'Medan :attribute diperlukan apabila :values wujud.',
137
138
  required_with_all: 'Medan :attribute diperlukan apabila semua :values wujud.',
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * quival v0.2.8 (https://github.com/apih/quival)
2
+ * quival v0.3.1 (https://github.com/apih/quival)
3
3
  * (c) 2023 Mohd Hafizuddin M Marzuki <hafizuddin_83@yahoo.com>
4
4
  * Released under the MIT License.
5
5
  */
6
- this.quival=this.quival||{},this.quival.locales=this.quival.locales||{},this.quival.locales.ms=function(){"use strict";return{accepted:"Medan :attribute mesti diterima.",accepted_if:"Medan :attribute mesti diterima apabila :other ialah :value.",active_url:"Medan :attribute mesti URL yang sah.",after:"Medan :attribute mesti tarikh selepas :date.",after_or_equal:"Medan :attribute mesti tarikh selepas atau sama dengan :date.",alpha:"Medan :attribute hanya boleh mengandungi huruf.",alpha_dash:"Medan :attribute hanya boleh mengandungi huruf, nombor, tanda sengkang, dan garis bawah.",alpha_num:"Medan :attribute hanya boleh mengandungi huruf dan nombor.",array:"Medan :attribute mesti jujukan.",ascii:"Medan :attribute hanya boleh mengandungi abjad, angka dan simbol berjenis bait tunggal.",before:"Medan :attribute mesti tarikh sebelum :date.",before_or_equal:"Medan :attribute mesti tarikh sebelum atau sama dengan :date.",between:{array:"Medan :attribute mesti mempunyai antara :min dan :max item.",file:"Medan :attribute mesti antara :min dan :max kilobait.",numeric:"Medan :attribute mesti antara :min dan :max.",string:"Medan :attribute mesti antara :min dan :max huruf."},boolean:"Medan :attribute mesti benar atau salah.",can:"Medan :attribute field mengandungi nilai yang tidak dibenarkan.",confirmed:"Pengesahan medan :attribute tidak sepadan.",current_password:"Kata laluan tidak sah.",date:"Medan :attribute mesti tarikh yang sah.",date_equals:"Medan :attribute mesti bersamaan dengan :date.",date_format:"Medan :attribute mesti sepadan dengan format :format.",decimal:"Medan :attribute mesti mempunyai :decimal tempat perpuluhan.",declined:"Medan :attribute mesti ditolak.",declined_if:"Medan :attribute mesti ditolak apabila :other adalah :value.",different:"Medan :attribute dan :other mesti berbeza.",digits:"Medan :attribute mesti mengandungi :digits digit.",digits_between:"Medan :attribute mesti mengandungi antara :min dan :max digit.",dimensions:"Medan :attribute mempunyai dimensi imej yang tidak sah.",distinct:"Medan :attribute mempunyai nilai yang berulang.",doesnt_end_with:"Medan :attribute tidak boleh berakhir dengan salah satu daripada berikut: :values.",doesnt_start_with:"Medan :attribute tidak boleh bermula dengan salah satu daripada berikut: :values.",email:"Medan :attribute mesti alamat emel yang sah.",ends_with:"Medan :attribute mesti berakhir dengan salah satu daripada berikut: :values.",enum:"Nilai :attribute yang dipilih tidak sah.",exists:"Nilai :attribute yang dipilih tidak sah.",extensions:"Medan :attribute mesti salah satu daripada sambungan berikut: :values.",file:"Medan :attribute mesti fail.",filled:"Medan :attribute mesti mempunyai nilai.",gt:{array:"Medan :attribute mesti mempunyai lebih daripada :value item.",file:"Medan :attribute mesti lebih besar daripada :value kilobait.",numeric:"Medan :attribute mesti lebih besar daripada :value.",string:"Medan :attribute mesti lebih besar daripada :value huruf."},gte:{array:"Medan :attribute mesti mempunyai :value item atau lebih.",file:"Medan :attribute mesti lebih besar daripada atau sama dengan :value kilobait.",numeric:"Medan :attribute mesti lebih besar daripada atau sama dengan :value.",string:"Medan :attribute mesti lebih besar daripada atau sama dengan :value huruf."},hex_color:"Medan :attribute mesti warna heksadesimal yang sah.",image:"Medan :attribute mesti imej.",in:"Nilai :attribute yang dipilih tidak sah.",in_array:"Medan :attribute mesti wujud dalam :other.",integer:"Medan :attribute mesti nombor bulat.",ip:"Medan :attribute mesti alamat IP yang sah.",ipv4:"Medan :attribute mesti alamat IPv4 yang sah.",ipv6:"Medan :attribute mesti alamat IPv6 yang sah.",json:"Medan :attribute mesti rentetan JSON yang sah.",list:"Medan :attribute mesti berbentuk senarai.",lowercase:"Medan :attribute mesti dalam huruf kecil.",lt:{array:"Medan :attribute mesti mempunyai kurang daripada :value item.",file:"Medan :attribute mesti kurang daripada :value kilobait.",numeric:"Medan :attribute mesti kurang daripada :value.",string:"Medan :attribute mesti kurang daripada :value huruf."},lte:{array:"Medan :attribute tidak boleh mempunyai lebih daripada :value item.",file:"Medan :attribute mesti kurang daripada atau sama dengan :value kilobait.",numeric:"Medan :attribute mesti kurang daripada atau sama dengan :value.",string:"Medan :attribute mesti kurang daripada atau sama dengan :value huruf."},mac_address:"Medan :attribute mesti alamat MAC yang sah.",max:{array:"Medan :attribute tidak boleh mempunyai lebih daripada :max item.",file:"Medan :attribute tidak boleh lebih besar daripada :max kilobait.",numeric:"Medan :attribute tidak boleh melebihi :max.",string:"Medan :attribute tidak boleh melebihi :max huruf."},max_digits:"Medan :attribute tidak boleh mempunyai lebih daripada :max digit.",mimes:"Medan :attribute mesti jenis fail: :values.",mimetypes:"Medan :attribute mesti jenis fail: :values.",min:{array:"Medan :attribute mesti mempunyai sekurang-kurangnya :min item.",file:"Medan :attribute mesti sekurang-kurangnya :min kilobait.",numeric:"Medan :attribute mesti sekurang-kurangnya :min.",string:"Medan :attribute mesti sekurang-kurangnya :min huruf."},min_digits:"Medan :attribute mesti mempunyai sekurang-kurangnya :min digit.",missing:"Medan :attribute mesti tiada.",missing_if:"Medan :attribute mesti tiada apabila :other adalah :value.",missing_unless:"Medan :attribute mesti tiada kecuali :other adalah :value.",missing_with:"Medan :attribute mesti tiada apabila :values wujud.",missing_with_all:"Medan :attribute mesti tiada apabila :values wujud.",multiple_of:"Medan :attribute mesti gandaan :value.",not_in:"Nilai :attribute yang dipilih tidak sah.",not_regex:"Format medan :attribute tidak sah.",numeric:"Medan :attribute mesti nombor.",password:{letters:"Medan :attribute mesti mengandungi sekurang-kurangnya satu huruf.",mixed:"Medan :attribute mesti mengandungi sekurang-kurangnya satu huruf besar dan satu huruf kecil.",numbers:"Medan :attribute mesti mengandungi sekurang-kurangnya satu nombor.",symbols:"Medan :attribute mesti mengandungi sekurang-kurangnya satu simbol.",uncompromised:"Nilai :attribute yang diberikan telah muncul dalam kebocoran data. Sila pilih :attribute yang berbeza."},present:"Medan :attribute mesti wujud.",prohibited:"Medan :attribute dilarang.",prohibited_if:"Medan :attribute dilarang apabila :other adalah :value.",prohibited_unless:"Medan :attribute dilarang melainkan :other berada dalam :values.",prohibits:"Medan :attribute melarang :other daripada wujud.",regex:"Format medan :attribute tidak sah.",required:"Medan :attribute diperlukan.",required_array_keys:"Medan :attribute mesti mengandungi entri untuk: :values.",required_if:"Medan :attribute diperlukan apabila :other adalah :value.",required_if_accepted:"Medan :attribute diperlukan apabila :other diterima.",required_unless:"Medan :attribute diperlukan melainkan :other berada dalam :values.",required_with:"Medan :attribute diperlukan apabila :values wujud.",required_with_all:"Medan :attribute diperlukan apabila semua :values wujud.",required_without:"Medan :attribute diperlukan apabila :values tidak wujud.",required_without_all:"Medan :attribute diperlukan apabila tiada satu pun daripada :values wujud.",same:"Medan :attribute mesti sepadan dengan :other.",size:{array:"Medan :attribute mesti mengandungi :size item.",file:"Medan :attribute mesti :size kilobait.",numeric:"Medan :attribute mesti :size.",string:"Medan :attribute mesti :size huruf."},starts_with:"Medan :attribute mesti bermula dengan salah satu dari berikut: :values.",string:"Medan :attribute mesti perkataan / rentetan aksara.",timezone:"Medan :attribute mesti zon masa yang sah.",unique:"Medan :attribute telah wujud.",uploaded:"Medan :attribute gagal dimuat naik.",uppercase:"Medan :attribute mesti dalam huruf besar.",url:"Medan :attribute mesti URL yang sah.",ulid:"Medan :attribute mesti ULID yang sah.",uuid:"Medan :attribute mesti UUID yang sah.",custom:{"attribute-name":{"rule-name":"custom-message"}},attributes:{},values:{}}}();
6
+ this.quival=this.quival||{},this.quival.locales=this.quival.locales||{},this.quival.locales.ms=function(){"use strict";return{accepted:"Medan :attribute mesti diterima.",accepted_if:"Medan :attribute mesti diterima apabila :other ialah :value.",active_url:"Medan :attribute mesti URL yang sah.",after:"Medan :attribute mesti tarikh selepas :date.",after_or_equal:"Medan :attribute mesti tarikh selepas atau sama dengan :date.",alpha:"Medan :attribute hanya boleh mengandungi huruf.",alpha_dash:"Medan :attribute hanya boleh mengandungi huruf, nombor, tanda sengkang, dan garis bawah.",alpha_num:"Medan :attribute hanya boleh mengandungi huruf dan nombor.",array:"Medan :attribute mesti jujukan.",ascii:"Medan :attribute hanya boleh mengandungi abjad, angka dan simbol berjenis bait tunggal.",before:"Medan :attribute mesti tarikh sebelum :date.",before_or_equal:"Medan :attribute mesti tarikh sebelum atau sama dengan :date.",between:{array:"Medan :attribute mesti mempunyai antara :min dan :max item.",file:"Medan :attribute mesti antara :min dan :max kilobait.",numeric:"Medan :attribute mesti antara :min dan :max.",string:"Medan :attribute mesti antara :min dan :max huruf."},boolean:"Medan :attribute mesti benar atau salah.",can:"Medan :attribute field mengandungi nilai yang tidak dibenarkan.",confirmed:"Pengesahan medan :attribute tidak sepadan.",current_password:"Kata laluan tidak sah.",date:"Medan :attribute mesti tarikh yang sah.",date_equals:"Medan :attribute mesti bersamaan dengan :date.",date_format:"Medan :attribute mesti sepadan dengan format :format.",decimal:"Medan :attribute mesti mempunyai :decimal tempat perpuluhan.",declined:"Medan :attribute mesti ditolak.",declined_if:"Medan :attribute mesti ditolak apabila :other adalah :value.",different:"Medan :attribute dan :other mesti berbeza.",digits:"Medan :attribute mesti mengandungi :digits digit.",digits_between:"Medan :attribute mesti mengandungi antara :min dan :max digit.",dimensions:"Medan :attribute mempunyai dimensi imej yang tidak sah.",distinct:"Medan :attribute mempunyai nilai yang berulang.",doesnt_end_with:"Medan :attribute tidak boleh berakhir dengan salah satu daripada berikut: :values.",doesnt_start_with:"Medan :attribute tidak boleh bermula dengan salah satu daripada berikut: :values.",email:"Medan :attribute mesti alamat emel yang sah.",ends_with:"Medan :attribute mesti berakhir dengan salah satu daripada berikut: :values.",enum:"Nilai :attribute yang dipilih tidak sah.",exists:"Nilai :attribute yang dipilih tidak sah.",extensions:"Medan :attribute mesti salah satu daripada sambungan berikut: :values.",file:"Medan :attribute mesti fail.",filled:"Medan :attribute mesti mempunyai nilai.",gt:{array:"Medan :attribute mesti mempunyai lebih daripada :value item.",file:"Medan :attribute mesti lebih besar daripada :value kilobait.",numeric:"Medan :attribute mesti lebih besar daripada :value.",string:"Medan :attribute mesti lebih besar daripada :value huruf."},gte:{array:"Medan :attribute mesti mempunyai :value item atau lebih.",file:"Medan :attribute mesti lebih besar daripada atau sama dengan :value kilobait.",numeric:"Medan :attribute mesti lebih besar daripada atau sama dengan :value.",string:"Medan :attribute mesti lebih besar daripada atau sama dengan :value huruf."},hex_color:"Medan :attribute mesti warna heksadesimal yang sah.",image:"Medan :attribute mesti imej.",in:"Nilai :attribute yang dipilih tidak sah.",in_array:"Medan :attribute mesti wujud dalam :other.",integer:"Medan :attribute mesti nombor bulat.",ip:"Medan :attribute mesti alamat IP yang sah.",ipv4:"Medan :attribute mesti alamat IPv4 yang sah.",ipv6:"Medan :attribute mesti alamat IPv6 yang sah.",json:"Medan :attribute mesti rentetan JSON yang sah.",list:"Medan :attribute mesti berbentuk senarai.",lowercase:"Medan :attribute mesti dalam huruf kecil.",lt:{array:"Medan :attribute mesti mempunyai kurang daripada :value item.",file:"Medan :attribute mesti kurang daripada :value kilobait.",numeric:"Medan :attribute mesti kurang daripada :value.",string:"Medan :attribute mesti kurang daripada :value huruf."},lte:{array:"Medan :attribute tidak boleh mempunyai lebih daripada :value item.",file:"Medan :attribute mesti kurang daripada atau sama dengan :value kilobait.",numeric:"Medan :attribute mesti kurang daripada atau sama dengan :value.",string:"Medan :attribute mesti kurang daripada atau sama dengan :value huruf."},mac_address:"Medan :attribute mesti alamat MAC yang sah.",max:{array:"Medan :attribute tidak boleh mempunyai lebih daripada :max item.",file:"Medan :attribute tidak boleh lebih besar daripada :max kilobait.",numeric:"Medan :attribute tidak boleh melebihi :max.",string:"Medan :attribute tidak boleh melebihi :max huruf."},max_digits:"Medan :attribute tidak boleh mempunyai lebih daripada :max digit.",mimes:"Medan :attribute mesti jenis fail: :values.",mimetypes:"Medan :attribute mesti jenis fail: :values.",min:{array:"Medan :attribute mesti mempunyai sekurang-kurangnya :min item.",file:"Medan :attribute mesti sekurang-kurangnya :min kilobait.",numeric:"Medan :attribute mesti sekurang-kurangnya :min.",string:"Medan :attribute mesti sekurang-kurangnya :min huruf."},min_digits:"Medan :attribute mesti mempunyai sekurang-kurangnya :min digit.",missing:"Medan :attribute mesti tiada.",missing_if:"Medan :attribute mesti tiada apabila :other adalah :value.",missing_unless:"Medan :attribute mesti tiada kecuali :other adalah :value.",missing_with:"Medan :attribute mesti tiada apabila :values wujud.",missing_with_all:"Medan :attribute mesti tiada apabila :values wujud.",multiple_of:"Medan :attribute mesti gandaan :value.",not_in:"Nilai :attribute yang dipilih tidak sah.",not_regex:"Format medan :attribute tidak sah.",numeric:"Medan :attribute mesti nombor.",password:{letters:"Medan :attribute mesti mengandungi sekurang-kurangnya satu huruf.",mixed:"Medan :attribute mesti mengandungi sekurang-kurangnya satu huruf besar dan satu huruf kecil.",numbers:"Medan :attribute mesti mengandungi sekurang-kurangnya satu nombor.",symbols:"Medan :attribute mesti mengandungi sekurang-kurangnya satu simbol.",uncompromised:"Nilai :attribute yang diberikan telah muncul dalam kebocoran data. Sila pilih :attribute yang berbeza."},present:"Medan :attribute mesti wujud.",prohibited:"Medan :attribute dilarang.",prohibited_if:"Medan :attribute dilarang apabila :other adalah :value.",prohibited_unless:"Medan :attribute dilarang melainkan :other berada dalam :values.",prohibits:"Medan :attribute melarang :other daripada wujud.",regex:"Format medan :attribute tidak sah.",required:"Medan :attribute diperlukan.",required_array_keys:"Medan :attribute mesti mengandungi entri untuk: :values.",required_if:"Medan :attribute diperlukan apabila :other adalah :value.",required_if_accepted:"Medan :attribute diperlukan apabila :other diterima.",required_if_declined:"Medan :attribute diperlukan apabila :other ditolak.",required_unless:"Medan :attribute diperlukan melainkan :other berada dalam :values.",required_with:"Medan :attribute diperlukan apabila :values wujud.",required_with_all:"Medan :attribute diperlukan apabila semua :values wujud.",required_without:"Medan :attribute diperlukan apabila :values tidak wujud.",required_without_all:"Medan :attribute diperlukan apabila tiada satu pun daripada :values wujud.",same:"Medan :attribute mesti sepadan dengan :other.",size:{array:"Medan :attribute mesti mengandungi :size item.",file:"Medan :attribute mesti :size kilobait.",numeric:"Medan :attribute mesti :size.",string:"Medan :attribute mesti :size huruf."},starts_with:"Medan :attribute mesti bermula dengan salah satu dari berikut: :values.",string:"Medan :attribute mesti perkataan / rentetan aksara.",timezone:"Medan :attribute mesti zon masa yang sah.",unique:"Medan :attribute telah wujud.",uploaded:"Medan :attribute gagal dimuat naik.",uppercase:"Medan :attribute mesti dalam huruf besar.",url:"Medan :attribute mesti URL yang sah.",ulid:"Medan :attribute mesti ULID yang sah.",uuid:"Medan :attribute mesti UUID yang sah.",custom:{"attribute-name":{"rule-name":"custom-message"}},attributes:{},values:{}}}();
package/dist/quival.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * quival v0.2.8 (https://github.com/apih/quival)
2
+ * quival v0.3.1 (https://github.com/apih/quival)
3
3
  * (c) 2023 Mohd Hafizuddin M Marzuki <hafizuddin_83@yahoo.com>
4
4
  * Released under the MIT License.
5
5
  */
@@ -23,7 +23,7 @@ var quival = (function (exports) {
23
23
  const keys = path.split('.');
24
24
  let current = obj;
25
25
  for (const key of keys) {
26
- if (!current.hasOwnProperty(key)) {
26
+ if (!Object.hasOwn(current, key)) {
27
27
  return defaultValue;
28
28
  }
29
29
  current = current[key];
@@ -136,7 +136,7 @@ var quival = (function (exports) {
136
136
  };
137
137
  let index = 1;
138
138
  for (const char of format) {
139
- if (formats.hasOwnProperty(char)) {
139
+ if (Object.hasOwn(formats, char)) {
140
140
  pattern += formats[char];
141
141
  if (['Y', 'y'].indexOf(char) !== -1) {
142
142
  indices.years = index++;
@@ -279,7 +279,7 @@ var quival = (function (exports) {
279
279
  }
280
280
  compareDates(attribute, value, parameters, callback) {
281
281
  const rule = this.validator.getRule(attribute);
282
- value = rule.hasOwnProperty('date_format') ? parseDateByFormat(value, rule.date_format[0]) : parseDate(value);
282
+ value = Object.hasOwn(rule, 'date_format') ? parseDateByFormat(value, rule.date_format[0]) : parseDate(value);
283
283
  if (!isValidDate(value)) {
284
284
  return false;
285
285
  }
@@ -289,7 +289,7 @@ var quival = (function (exports) {
289
289
  otherValue = parseDate(other);
290
290
  } else {
291
291
  const otherRule = this.validator.getRule(other);
292
- otherValue = otherRule.hasOwnProperty('date_format') ? parseDateByFormat(otherValue, otherRule.date_format[0]) : parseDate(otherValue);
292
+ otherValue = Object.hasOwn(otherRule, 'date_format') ? parseDateByFormat(otherValue, otherRule.date_format[0]) : parseDate(otherValue);
293
293
  }
294
294
  if (!isValidDate(otherValue)) {
295
295
  return false;
@@ -412,6 +412,12 @@ var quival = (function (exports) {
412
412
  }
413
413
  return true;
414
414
  }
415
+ checkRequiredIfDeclined(attribute, value, parameters) {
416
+ if (this.checkDeclined(parameters[0], this.validator.getValue(parameters[0]))) {
417
+ return this.checkRequired(attribute, value);
418
+ }
419
+ return true;
420
+ }
415
421
  checkRequiredUnless(attribute, value, parameters) {
416
422
  if (!this.isDependent(parameters)) {
417
423
  return this.checkRequired(attribute, value);
@@ -647,7 +653,7 @@ var quival = (function (exports) {
647
653
  };
648
654
  let pattern = '^';
649
655
  for (const char of format) {
650
- if (formats.hasOwnProperty(char)) {
656
+ if (Object.hasOwn(formats, char)) {
651
657
  pattern += formats[char];
652
658
  } else {
653
659
  pattern += '\\' + char;
@@ -665,7 +671,7 @@ var quival = (function (exports) {
665
671
  const index = unparsed.indexOf('*');
666
672
  const parentPath = unparsed.substring(0, index - 1);
667
673
  let stringified;
668
- if (this.#distinctCache.hasOwnProperty(parentPath)) {
674
+ if (Object.hasOwn(this.#distinctCache, parentPath)) {
669
675
  stringified = this.#distinctCache[parentPath];
670
676
  } else {
671
677
  stringified = JSON.stringify(flattenObject(this.validator.getValue(parentPath) ?? {}));
@@ -750,7 +756,7 @@ var quival = (function (exports) {
750
756
  return result;
751
757
  }
752
758
  async checkDimensions(attribute, value, parameters) {
753
- if (!this.checkImage(attribute, value) || !this.#imageCache.hasOwnProperty(attribute)) {
759
+ if (!this.checkImage(attribute, value) || !Object.hasOwn(this.#imageCache, attribute)) {
754
760
  return false;
755
761
  }
756
762
  const constraints = {};
@@ -767,16 +773,16 @@ var quival = (function (exports) {
767
773
  const width = image.naturalWidth;
768
774
  const height = image.naturalHeight;
769
775
  if (
770
- (constraints.hasOwnProperty('width') && constraints.width !== width) ||
771
- (constraints.hasOwnProperty('height') && constraints.height !== height) ||
772
- (constraints.hasOwnProperty('min_width') && constraints.min_width > width) ||
773
- (constraints.hasOwnProperty('min_height') && constraints.min_height > height) ||
774
- (constraints.hasOwnProperty('max_width') && constraints.max_width < width) ||
775
- (constraints.hasOwnProperty('max_height') && constraints.max_height < height)
776
+ (Object.hasOwn(constraints, 'width') && constraints.width !== width) ||
777
+ (Object.hasOwn(constraints, 'height') && constraints.height !== height) ||
778
+ (Object.hasOwn(constraints, 'min_width') && constraints.min_width > width) ||
779
+ (Object.hasOwn(constraints, 'min_height') && constraints.min_height > height) ||
780
+ (Object.hasOwn(constraints, 'max_width') && constraints.max_width < width) ||
781
+ (Object.hasOwn(constraints, 'max_height') && constraints.max_height < height)
776
782
  ) {
777
783
  return false;
778
784
  }
779
- if (constraints.hasOwnProperty('ratio')) {
785
+ if (Object.hasOwn(constraints, 'ratio')) {
780
786
  return Math.abs(constraints.ratio - width / height) <= 1 / (Math.max(width, height) + 1);
781
787
  }
782
788
  return true;
@@ -901,7 +907,7 @@ var quival = (function (exports) {
901
907
  return Object.entries(this.#data);
902
908
  }
903
909
  add(key, message) {
904
- if (this.#data.hasOwnProperty(key)) {
910
+ if (Object.hasOwn(this.#data, key)) {
905
911
  this.#data[key].push(message);
906
912
  } else {
907
913
  this.#data[key] = [message];
@@ -909,7 +915,7 @@ var quival = (function (exports) {
909
915
  }
910
916
  get(key) {
911
917
  if (!key.includes('*')) {
912
- return this.#data.hasOwnProperty(key) ? this.#data[key] : {};
918
+ return Object.hasOwn(this.#data, key) ? this.#data[key] : {};
913
919
  }
914
920
  const pattern = new RegExp('^' + key.replaceAll('*', '.*?') + '$');
915
921
  const result = {};
@@ -948,6 +954,15 @@ var quival = (function (exports) {
948
954
  isNotEmpty() {
949
955
  return !this.isEmpty();
950
956
  }
957
+ sortByKeys(keys) {
958
+ const data = {};
959
+ for (const key of keys) {
960
+ if (Object.hasOwn(this.#data, key)) {
961
+ data[key] = this.#data[key];
962
+ }
963
+ }
964
+ this.#data = data;
965
+ }
951
966
  constructor() {
952
967
  this.#data = {};
953
968
  }
@@ -1021,6 +1036,9 @@ var quival = (function (exports) {
1021
1036
  replaceRequiredIfAccepted(message, attribute, rule, parameters) {
1022
1037
  return this.replaceAcceptedIf(message, attribute, rule, parameters);
1023
1038
  }
1039
+ replaceRequiredIfDeclined(message, attribute, rule, parameters) {
1040
+ return this.replaceAcceptedIf(message, attribute, rule, parameters);
1041
+ }
1024
1042
  replaceRequiredUnless(message, attribute, rule, parameters) {
1025
1043
  return this.replace(message, {
1026
1044
  other: this.validator.getDisplayableAttribute(parameters[0]),
@@ -1225,6 +1243,7 @@ var quival = (function (exports) {
1225
1243
  'required',
1226
1244
  'required_if',
1227
1245
  'required_if_accepted',
1246
+ 'required_if_declined',
1228
1247
  'required_unless',
1229
1248
  'required_with',
1230
1249
  'required_with_all',
@@ -1375,63 +1394,66 @@ var quival = (function (exports) {
1375
1394
  async validate() {
1376
1395
  this.#checkers.clearCaches();
1377
1396
  this.#errors = new ErrorBag();
1397
+ const tasks = [];
1378
1398
  for (const [attribute, rules] of Object.entries(this.#rules)) {
1379
1399
  let value = this.getValue(attribute);
1380
- if (rules.hasOwnProperty('sometimes') && typeof value === 'undefined') {
1400
+ if (Object.hasOwn(rules, 'sometimes') && typeof value === 'undefined') {
1381
1401
  continue;
1382
1402
  }
1383
- const doBail = this.#alwaysBail || rules.hasOwnProperty('bail');
1384
- const isNullable = rules.hasOwnProperty('nullable');
1385
- let hasError = false;
1386
- for (const [rule, parameters] of Object.entries(rules)) {
1387
- if (rule === '') {
1388
- continue;
1389
- }
1390
- if (
1391
- !Validator.#implicitRules.includes(rule) &&
1392
- (typeof value === 'undefined' || (typeof value === 'string' && value.trim() === '') || (isNullable && value === null))
1393
- ) {
1394
- continue;
1395
- }
1396
- let result, status, message;
1397
- const camelRule = toCamelCase('check_' + rule);
1398
- if (typeof this.#checkers[camelRule] === 'function') {
1399
- result = await this.#checkers[camelRule](attribute, value, parameters);
1400
- } else if (Validator.#dummyRules.includes(rule)) {
1401
- result = true;
1402
- } else {
1403
- throw new Error(`Invalid validation rule: ${rule}`);
1404
- }
1405
- if (typeof result === 'boolean') {
1406
- status = result;
1407
- } else {
1408
- ({ status, message } = result);
1409
- }
1410
- if (!status) {
1411
- hasError = true;
1412
- message = isEmpty(message) ? this.getMessage(attribute, rule) : message;
1413
- message = this.makeReplacements(message, attribute, rule, parameters);
1414
- this.#errors.add(attribute, message);
1415
- if (doBail || Validator.#implicitRules.includes(rule)) {
1416
- break;
1403
+ tasks.push(async () => {
1404
+ const doBail = this.#alwaysBail || Object.hasOwn(rules, 'bail');
1405
+ const isNullable = Object.hasOwn(rules, 'nullable');
1406
+ let noError = true;
1407
+ for (const [rule, parameters] of Object.entries(rules)) {
1408
+ if (rule === '') {
1409
+ continue;
1410
+ }
1411
+ if (
1412
+ !Validator.#implicitRules.includes(rule) &&
1413
+ (typeof value === 'undefined' || (typeof value === 'string' && value.trim() === '') || (isNullable && value === null))
1414
+ ) {
1415
+ continue;
1416
+ }
1417
+ let result, success, message;
1418
+ const camelRule = toCamelCase('check_' + rule);
1419
+ if (typeof this.#checkers[camelRule] === 'function') {
1420
+ result = await this.#checkers[camelRule](attribute, value, parameters);
1421
+ } else if (Validator.#dummyRules.includes(rule)) {
1422
+ result = true;
1423
+ } else {
1424
+ throw new Error(`Invalid validation rule: ${rule}`);
1425
+ }
1426
+ if (typeof result === 'boolean') {
1427
+ success = result;
1428
+ } else {
1429
+ ({ success, message } = result);
1430
+ }
1431
+ if (!success) {
1432
+ noError = false;
1433
+ message = isEmpty(message) ? this.getMessage(attribute, rule) : message;
1434
+ message = this.makeReplacements(message, attribute, rule, parameters);
1435
+ this.#errors.add(attribute, message);
1436
+ if (doBail || Validator.#implicitRules.includes(rule)) {
1437
+ break;
1438
+ }
1417
1439
  }
1418
1440
  }
1419
- }
1420
- if (this.#stopOnFirstFailure && hasError) {
1421
- break;
1422
- }
1441
+ return noError;
1442
+ });
1423
1443
  }
1424
- if (this.#errors.isNotEmpty()) {
1425
- throw this.#errors;
1444
+ if (this.#stopOnFirstFailure) {
1445
+ for (const task of tasks) {
1446
+ if (!(await task())) break;
1447
+ }
1448
+ } else {
1449
+ await Promise.allSettled(tasks.map((task) => task()));
1450
+ this.#errors.sortByKeys(Object.keys(this.#rules));
1426
1451
  }
1452
+ return this.#errors;
1427
1453
  }
1428
1454
  async passes() {
1429
- try {
1430
- await this.validate();
1431
- } catch (error) {
1432
- if (error instanceof Error) {
1433
- throw error;
1434
- }
1455
+ await this.validate();
1456
+ if (this.#errors.isNotEmpty()) {
1435
1457
  return false;
1436
1458
  }
1437
1459
  return true;
@@ -1444,7 +1466,7 @@ var quival = (function (exports) {
1444
1466
  attribute = this.getPrimaryAttribute(attribute);
1445
1467
  let message;
1446
1468
  for (const key of [`${attribute}.${rule}`, rule]) {
1447
- if (this.#customMessages.hasOwnProperty(key)) {
1469
+ if (Object.hasOwn(this.#customMessages, key)) {
1448
1470
  message = this.#customMessages[key];
1449
1471
  break;
1450
1472
  }
@@ -1456,7 +1478,7 @@ var quival = (function (exports) {
1456
1478
  key += '.array';
1457
1479
  } else if (value instanceof File || this.hasRule(attribute, this.fileRules)) {
1458
1480
  key += '.file';
1459
- } else if (typeof value === 'number' || this.hasRule(attribute, this.numericRules)) {
1481
+ } else if (isNumeric(value) || this.hasRule(attribute, this.numericRules)) {
1460
1482
  key += '.numeric';
1461
1483
  } else {
1462
1484
  key += '.string';
@@ -1492,13 +1514,13 @@ var quival = (function (exports) {
1492
1514
  getDisplayableAttribute(attribute) {
1493
1515
  const unparsed = this.getPrimaryAttribute(attribute);
1494
1516
  for (const name of [attribute, unparsed]) {
1495
- if (this.#customAttributes.hasOwnProperty(name)) {
1517
+ if (Object.hasOwn(this.#customAttributes, name)) {
1496
1518
  return this.#customAttributes[name];
1497
1519
  } else if (Lang.has(`attributes.${name}`)) {
1498
1520
  return Lang.get(`attributes.${name}`);
1499
1521
  }
1500
1522
  }
1501
- if (this.#implicitAttributes.hasOwnProperty(attribute)) {
1523
+ if (Object.hasOwn(this.#implicitAttributes, attribute)) {
1502
1524
  return attribute;
1503
1525
  }
1504
1526
  return toSnakeCase(attribute).replaceAll('_', ' ');
@@ -1510,7 +1532,7 @@ var quival = (function (exports) {
1510
1532
  return 'empty';
1511
1533
  } else if (typeof value === 'boolean' || this.hasRule(attribute, 'boolean')) {
1512
1534
  return Number(value) ? 'true' : 'false';
1513
- } else if (this.#customValues.hasOwnProperty(path)) {
1535
+ } else if (Object.hasOwn(this.#customValues, path)) {
1514
1536
  return this.#customValues[path];
1515
1537
  } else if (Lang.has(`values.${path}`)) {
1516
1538
  return Lang.get(`values.${path}`);
@@ -1526,7 +1548,7 @@ var quival = (function (exports) {
1526
1548
  return value.size / 1024;
1527
1549
  } else if (isPlainObject(value)) {
1528
1550
  return Object.keys(value).length;
1529
- } else if (value.hasOwnProperty('length')) {
1551
+ } else if (Object.hasOwn(value, 'length')) {
1530
1552
  return value.length;
1531
1553
  }
1532
1554
  return value;
@@ -1538,7 +1560,7 @@ var quival = (function (exports) {
1538
1560
  hasRule(attribute, rules) {
1539
1561
  attribute = this.getPrimaryAttribute(attribute);
1540
1562
  rules = typeof rules === 'string' ? [rules] : rules;
1541
- if (!this.#rules.hasOwnProperty(attribute)) {
1563
+ if (!Object.hasOwn(this.#rules, attribute)) {
1542
1564
  return false;
1543
1565
  }
1544
1566
  for (const rule of rules) {
@@ -1549,7 +1571,7 @@ var quival = (function (exports) {
1549
1571
  return false;
1550
1572
  }
1551
1573
  getPrimaryAttribute(attribute) {
1552
- return this.#implicitAttributes.hasOwnProperty(attribute) ? this.#implicitAttributes[attribute] : attribute;
1574
+ return Object.hasOwn(this.#implicitAttributes, attribute) ? this.#implicitAttributes[attribute] : attribute;
1553
1575
  }
1554
1576
  hasAttribute(attribute) {
1555
1577
  return typeof this.getValue(attribute) !== 'undefined';