typebox 1.3.18 → 1.3.19

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.
@@ -14,14 +14,16 @@ function IsLabel(value) {
14
14
  // ------------------------------------------------------------------
15
15
  // NormalizeHostname
16
16
  //
17
- // Normalizes a hostname for label validation. Normalizes for NFC
18
- // such that equivalent codepoint sequences can be uniformly
19
- // compared. It also removes codepoints that IDNA mapping ignores,
20
- // and converts full stop variants to ASCII '.' so the hostname can
21
- // be split into labels.
17
+ // Normalizes a hostname for label validation. Maps fullwidth
18
+ // codepoints to their ASCII equivalent (e.g. 'a' U+FF41 maps to
19
+ // 'a'), then normalizes for NFC such that equivalent codepoint
20
+ // sequences can be uniformly compared. It also removes codepoints
21
+ // that IDNA mapping ignores, and converts full stop variants to
22
+ // ASCII '.' so the hostname can be split into labels.
22
23
  // ------------------------------------------------------------------
23
24
  function NormalizeHostname(value) {
24
25
  return value
26
+ .replace(/[\uff01-\uff5e]/g, (char) => String.fromCharCode(char.charCodeAt(0) - 0xfee0)) // RE_FULLWIDTH_MAPPING
25
27
  .normalize('NFC')
26
28
  .replace(/[\u00ad\u034f\u180b-\u180d\u200b\ufe00-\ufe0f\u{e0100}-\u{e01ef}]/gu, '') // RE_IGNORED_MAPPING
27
29
  .replace(/[\u002E\u3002\uFF0E\uFF61]/g, '.'); // RE_FULL_STOP_MAPPING
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "typebox",
3
3
  "description": "Json Schema Type Builder with Static Type Resolution for TypeScript",
4
- "version": "1.3.18",
4
+ "version": "1.3.19",
5
5
  "keywords": [
6
6
  "typescript",
7
7
  "jsonschema"