keeperboard 2.0.2 → 2.0.3
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/dist/index.d.mts +5 -8
- package/dist/index.d.ts +5 -8
- package/dist/index.js +2 -6
- package/dist/index.mjs +2 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -139,8 +139,6 @@ interface NameValidationOptions {
|
|
|
139
139
|
minLength?: number;
|
|
140
140
|
/** Maximum length — input is truncated to this (default 12). */
|
|
141
141
|
maxLength?: number;
|
|
142
|
-
/** Convert to uppercase (default true). */
|
|
143
|
-
uppercase?: boolean;
|
|
144
142
|
/** Regex of allowed characters applied after case conversion (default /[^A-Z0-9_]/g removes non-matching). */
|
|
145
143
|
allowedPattern?: RegExp;
|
|
146
144
|
}
|
|
@@ -424,14 +422,13 @@ declare class PlayerIdentity {
|
|
|
424
422
|
* Validate and sanitize a player name.
|
|
425
423
|
*
|
|
426
424
|
* 1. Trims whitespace
|
|
427
|
-
* 2.
|
|
428
|
-
* 3.
|
|
429
|
-
* 4.
|
|
430
|
-
* 5. Returns `null` if result is shorter than `minLength`
|
|
425
|
+
* 2. Strips characters not matching `allowedPattern`
|
|
426
|
+
* 3. Truncates to `maxLength`
|
|
427
|
+
* 4. Returns `null` if result is shorter than `minLength`
|
|
431
428
|
*
|
|
432
429
|
* @example
|
|
433
|
-
* validateName(' Ace Pilot! ') // '
|
|
434
|
-
* validateName('ab') // '
|
|
430
|
+
* validateName(' Ace Pilot! ') // 'AcePilot'
|
|
431
|
+
* validateName('ab') // 'ab'
|
|
435
432
|
* validateName('x') // null (too short)
|
|
436
433
|
*/
|
|
437
434
|
declare function validateName(input: string, options?: NameValidationOptions): string | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -139,8 +139,6 @@ interface NameValidationOptions {
|
|
|
139
139
|
minLength?: number;
|
|
140
140
|
/** Maximum length — input is truncated to this (default 12). */
|
|
141
141
|
maxLength?: number;
|
|
142
|
-
/** Convert to uppercase (default true). */
|
|
143
|
-
uppercase?: boolean;
|
|
144
142
|
/** Regex of allowed characters applied after case conversion (default /[^A-Z0-9_]/g removes non-matching). */
|
|
145
143
|
allowedPattern?: RegExp;
|
|
146
144
|
}
|
|
@@ -424,14 +422,13 @@ declare class PlayerIdentity {
|
|
|
424
422
|
* Validate and sanitize a player name.
|
|
425
423
|
*
|
|
426
424
|
* 1. Trims whitespace
|
|
427
|
-
* 2.
|
|
428
|
-
* 3.
|
|
429
|
-
* 4.
|
|
430
|
-
* 5. Returns `null` if result is shorter than `minLength`
|
|
425
|
+
* 2. Strips characters not matching `allowedPattern`
|
|
426
|
+
* 3. Truncates to `maxLength`
|
|
427
|
+
* 4. Returns `null` if result is shorter than `minLength`
|
|
431
428
|
*
|
|
432
429
|
* @example
|
|
433
|
-
* validateName(' Ace Pilot! ') // '
|
|
434
|
-
* validateName('ab') // '
|
|
430
|
+
* validateName(' Ace Pilot! ') // 'AcePilot'
|
|
431
|
+
* validateName('ab') // 'ab'
|
|
435
432
|
* validateName('x') // null (too short)
|
|
436
433
|
*/
|
|
437
434
|
declare function validateName(input: string, options?: NameValidationOptions): string | null;
|
package/dist/index.js
CHANGED
|
@@ -720,16 +720,12 @@ var RetryQueue = class {
|
|
|
720
720
|
var DEFAULTS = {
|
|
721
721
|
minLength: 2,
|
|
722
722
|
maxLength: 12,
|
|
723
|
-
|
|
724
|
-
allowedPattern: /[^A-Z0-9_]/g
|
|
723
|
+
allowedPattern: /[^A-Za-z0-9_]/g
|
|
725
724
|
};
|
|
726
725
|
function validateName(input, options) {
|
|
727
726
|
const opts = { ...DEFAULTS, ...options };
|
|
728
727
|
let name = input.trim();
|
|
729
|
-
|
|
730
|
-
name = name.toUpperCase();
|
|
731
|
-
}
|
|
732
|
-
const pattern = options?.allowedPattern ?? (opts.uppercase ? /[^A-Z0-9_]/g : /[^A-Za-z0-9_]/g);
|
|
728
|
+
const pattern = options?.allowedPattern ?? /[^A-Za-z0-9_]/g;
|
|
733
729
|
name = name.replace(pattern, "");
|
|
734
730
|
name = name.substring(0, opts.maxLength);
|
|
735
731
|
if (name.length < opts.minLength) {
|
package/dist/index.mjs
CHANGED
|
@@ -687,16 +687,12 @@ var RetryQueue = class {
|
|
|
687
687
|
var DEFAULTS = {
|
|
688
688
|
minLength: 2,
|
|
689
689
|
maxLength: 12,
|
|
690
|
-
|
|
691
|
-
allowedPattern: /[^A-Z0-9_]/g
|
|
690
|
+
allowedPattern: /[^A-Za-z0-9_]/g
|
|
692
691
|
};
|
|
693
692
|
function validateName(input, options) {
|
|
694
693
|
const opts = { ...DEFAULTS, ...options };
|
|
695
694
|
let name = input.trim();
|
|
696
|
-
|
|
697
|
-
name = name.toUpperCase();
|
|
698
|
-
}
|
|
699
|
-
const pattern = options?.allowedPattern ?? (opts.uppercase ? /[^A-Z0-9_]/g : /[^A-Za-z0-9_]/g);
|
|
695
|
+
const pattern = options?.allowedPattern ?? /[^A-Za-z0-9_]/g;
|
|
700
696
|
name = name.replace(pattern, "");
|
|
701
697
|
name = name.substring(0, opts.maxLength);
|
|
702
698
|
if (name.length < opts.minLength) {
|