@xh/hoist 76.0.0-SNAPSHOT.1757966316621 → 76.0.0-SNAPSHOT.1758029355620

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.
@@ -5,6 +5,7 @@
5
5
  * Copyright © 2025 Extremely Heavy Industries Inc.
6
6
  */
7
7
  import {LocalDate} from '@xh/hoist/utils/datetime';
8
+ import {pluralize} from '@xh/hoist/utils/js';
8
9
  import {isArray, isEmpty, isFinite, isNil, isString, uniq} from 'lodash';
9
10
  import moment from 'moment';
10
11
  import {Constraint} from './Rule';
@@ -43,21 +44,21 @@ export const validEmail: Constraint<string> = ({value, displayName}) => {
43
44
  */
44
45
  export function validEmails(c?: ValidEmailsOptions): Constraint<string> {
45
46
  return ({value, displayName}) => {
46
- if (isNil(value)) return null;
47
+ if (isNil(value) && !c?.minCount) return null;
47
48
 
48
- const emails = value
49
+ const emails = (value ?? '')
49
50
  .split(';')
50
51
  .map(it => it.trim())
51
52
  .filter(Boolean);
52
53
 
53
54
  if (uniq(emails).length !== emails.length) {
54
- return `${displayName} must not contain duplicate email addresses.`;
55
+ return `${displayName} must not contain duplicate emails.`;
55
56
  }
56
57
  if (emails.length < c?.minCount) {
57
- return `${displayName} must contain at least ${c.minCount} email addresses.`;
58
+ return `${displayName} must contain at least ${c.minCount} ${pluralize('email', c.minCount)}.`;
58
59
  }
59
60
  if (!isNil(c?.maxCount) && emails.length > c.maxCount) {
60
- return `${displayName} must contain no more than ${c.maxCount} email addresses.`;
61
+ return `${displayName} must contain no more than ${c.maxCount} ${pluralize('email', c.maxCount)}.`;
61
62
  }
62
63
 
63
64
  const isValid = emails.every(it => emailRegEx.test(it));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "76.0.0-SNAPSHOT.1757966316621",
3
+ "version": "76.0.0-SNAPSHOT.1758029355620",
4
4
  "description": "Hoist add-on for building and deploying React Applications.",
5
5
  "repository": "github:xh/hoist-react",
6
6
  "homepage": "https://xh.io",