volleyballsimtypes 0.0.371 → 0.0.372

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.
@@ -2,3 +2,4 @@ export * from './team';
2
2
  export * from './team-generator';
3
3
  export * from './formation';
4
4
  export * from './tactics';
5
+ export * from './team-name';
@@ -18,3 +18,4 @@ __exportStar(require("./team"), exports);
18
18
  __exportStar(require("./team-generator"), exports);
19
19
  __exportStar(require("./formation"), exports);
20
20
  __exportStar(require("./tactics"), exports);
21
+ __exportStar(require("./team-name"), exports);
@@ -0,0 +1,15 @@
1
+ export declare const TEAM_NAME_MIN_LENGTH = 3;
2
+ export declare const TEAM_NAME_MAX_LENGTH = 40;
3
+ /**
4
+ * Allowed team-name characters: Unicode letters (any script — Latin incl. ñ and
5
+ * Polish letters, Cyrillic, Greek, etc.), combining marks, digits, spaces, and
6
+ * basic name punctuation (hyphen, apostrophe, period).
7
+ */
8
+ export declare const TEAM_NAME_PATTERN: RegExp;
9
+ /** Trim surrounding whitespace and normalise to NFC for consistent Unicode handling. */
10
+ export declare function normalizeTeamName(raw: string): string;
11
+ /**
12
+ * Validate a raw (untrimmed) team name. Normalises first (NFC + trim), then checks
13
+ * length, the allowed character set, and that it contains at least one letter or digit.
14
+ */
15
+ export declare function isValidTeamName(raw: string): boolean;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TEAM_NAME_PATTERN = exports.TEAM_NAME_MAX_LENGTH = exports.TEAM_NAME_MIN_LENGTH = void 0;
4
+ exports.normalizeTeamName = normalizeTeamName;
5
+ exports.isValidTeamName = isValidTeamName;
6
+ exports.TEAM_NAME_MIN_LENGTH = 3;
7
+ exports.TEAM_NAME_MAX_LENGTH = 40;
8
+ /**
9
+ * Allowed team-name characters: Unicode letters (any script — Latin incl. ñ and
10
+ * Polish letters, Cyrillic, Greek, etc.), combining marks, digits, spaces, and
11
+ * basic name punctuation (hyphen, apostrophe, period).
12
+ */
13
+ exports.TEAM_NAME_PATTERN = /^[\p{L}\p{M}\p{N} .'-]+$/u;
14
+ const HAS_ALPHANUMERIC = /[\p{L}\p{N}]/u;
15
+ /** Trim surrounding whitespace and normalise to NFC for consistent Unicode handling. */
16
+ function normalizeTeamName(raw) {
17
+ return raw.normalize('NFC').trim();
18
+ }
19
+ /**
20
+ * Validate a raw (untrimmed) team name. Normalises first (NFC + trim), then checks
21
+ * length, the allowed character set, and that it contains at least one letter or digit.
22
+ */
23
+ function isValidTeamName(raw) {
24
+ const name = normalizeTeamName(raw);
25
+ return (name.length >= exports.TEAM_NAME_MIN_LENGTH &&
26
+ name.length <= exports.TEAM_NAME_MAX_LENGTH &&
27
+ exports.TEAM_NAME_PATTERN.test(name) &&
28
+ HAS_ALPHANUMERIC.test(name));
29
+ }
@@ -2,3 +2,4 @@ export * from './team';
2
2
  export * from './team-generator';
3
3
  export * from './formation';
4
4
  export * from './tactics';
5
+ export * from './team-name';
@@ -2,3 +2,4 @@ export * from './team';
2
2
  export * from './team-generator';
3
3
  export * from './formation';
4
4
  export * from './tactics';
5
+ export * from './team-name';
@@ -0,0 +1,15 @@
1
+ export declare const TEAM_NAME_MIN_LENGTH = 3;
2
+ export declare const TEAM_NAME_MAX_LENGTH = 40;
3
+ /**
4
+ * Allowed team-name characters: Unicode letters (any script — Latin incl. ñ and
5
+ * Polish letters, Cyrillic, Greek, etc.), combining marks, digits, spaces, and
6
+ * basic name punctuation (hyphen, apostrophe, period).
7
+ */
8
+ export declare const TEAM_NAME_PATTERN: RegExp;
9
+ /** Trim surrounding whitespace and normalise to NFC for consistent Unicode handling. */
10
+ export declare function normalizeTeamName(raw: string): string;
11
+ /**
12
+ * Validate a raw (untrimmed) team name. Normalises first (NFC + trim), then checks
13
+ * length, the allowed character set, and that it contains at least one letter or digit.
14
+ */
15
+ export declare function isValidTeamName(raw: string): boolean;
@@ -0,0 +1,24 @@
1
+ export const TEAM_NAME_MIN_LENGTH = 3;
2
+ export const TEAM_NAME_MAX_LENGTH = 40;
3
+ /**
4
+ * Allowed team-name characters: Unicode letters (any script — Latin incl. ñ and
5
+ * Polish letters, Cyrillic, Greek, etc.), combining marks, digits, spaces, and
6
+ * basic name punctuation (hyphen, apostrophe, period).
7
+ */
8
+ export const TEAM_NAME_PATTERN = /^[\p{L}\p{M}\p{N} .'-]+$/u;
9
+ const HAS_ALPHANUMERIC = /[\p{L}\p{N}]/u;
10
+ /** Trim surrounding whitespace and normalise to NFC for consistent Unicode handling. */
11
+ export function normalizeTeamName(raw) {
12
+ return raw.normalize('NFC').trim();
13
+ }
14
+ /**
15
+ * Validate a raw (untrimmed) team name. Normalises first (NFC + trim), then checks
16
+ * length, the allowed character set, and that it contains at least one letter or digit.
17
+ */
18
+ export function isValidTeamName(raw) {
19
+ const name = normalizeTeamName(raw);
20
+ return (name.length >= TEAM_NAME_MIN_LENGTH &&
21
+ name.length <= TEAM_NAME_MAX_LENGTH &&
22
+ TEAM_NAME_PATTERN.test(name) &&
23
+ HAS_ALPHANUMERIC.test(name));
24
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.371",
3
+ "version": "0.0.372",
4
4
  "description": "vbsim types",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",