@sumaris-net/ngx-components 2.4.76 → 2.4.77

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.
@@ -3685,17 +3685,18 @@ class SharedValidators {
3685
3685
  * @param precision
3686
3686
  */
3687
3687
  static precision(precision) {
3688
- if (precision)
3689
- return (control) => {
3690
- const value = control.value;
3691
- if (isNil(value) || Number.isNaN(value)) {
3692
- return null;
3693
- }
3694
- if (value % precision !== 0) {
3695
- return { precision: { precision } };
3696
- }
3688
+ if (precision == null)
3689
+ throw new Error('Missing required precision value. Cannot be null or undefined');
3690
+ return (control) => {
3691
+ const value = control.value;
3692
+ if (isNil(value) || Number.isNaN(value)) {
3697
3693
  return null;
3698
- };
3694
+ }
3695
+ if (value % precision !== 0) {
3696
+ return { precision: { precision } };
3697
+ }
3698
+ return null;
3699
+ };
3699
3700
  }
3700
3701
  static validDate(control) {
3701
3702
  const value = control.value;