@hmcts/opal-frontend-common 0.0.52 → 0.0.53

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,11 +2,9 @@ function nationalInsuranceNumberValidator() {
2
2
  return (control) => {
3
3
  const value = control.value;
4
4
  if (value) {
5
- // Remove all spaces and convert to uppercase for uniformity
6
- const cleanedValue = value.replaceAll(/\s+/g, '').toUpperCase();
7
- // Check if the cleaned value has exactly 9 characters and matches the National Insurance number format
5
+ // Check if the value has exactly 9 characters and matches the National Insurance number format
8
6
  const ninoRegex = /^[A-Z]{2}\d{6}[A-D]$/;
9
- if (cleanedValue.length !== 9 || !ninoRegex.test(cleanedValue)) {
7
+ if (value.length !== 9 || !ninoRegex.test(value)) {
10
8
  return { nationalInsuranceNumberPattern: { value: value } };
11
9
  }
12
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hmcts-opal-frontend-common-validators-national-insurance-number.mjs","sources":["../../../projects/opal-frontend-common/validators/national-insurance-number/national-insurance-number.validator.ts","../../../projects/opal-frontend-common/validators/national-insurance-number/hmcts-opal-frontend-common-validators-national-insurance-number.ts"],"sourcesContent":["import { ValidatorFn, AbstractControl } from '@angular/forms';\n\nexport function nationalInsuranceNumberValidator(): ValidatorFn {\n return (control: AbstractControl): { [key: string]: unknown } | null => {\n const value = control.value;\n if (value) {\n // Remove all spaces and convert to uppercase for uniformity\n const cleanedValue = value.replaceAll(/\\s+/g, '').toUpperCase();\n\n // Check if the cleaned value has exactly 9 characters and matches the National Insurance number format\n const ninoRegex = /^[A-Z]{2}\\d{6}[A-D]$/;\n if (cleanedValue.length !== 9 || !ninoRegex.test(cleanedValue)) {\n return { nationalInsuranceNumberPattern: { value: value } };\n }\n }\n return null;\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"SAEgB,gCAAgC,GAAA;IAC9C,OAAO,CAAC,OAAwB,KAAuC;AACrE,QAAA,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK;QAC3B,IAAI,KAAK,EAAE;;AAET,YAAA,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE;;YAG/D,MAAM,SAAS,GAAG,sBAAsB;AACxC,YAAA,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE;gBAC9D,OAAO,EAAE,8BAA8B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YAC7D;QACF;AACA,QAAA,OAAO,IAAI;AACb,IAAA,CAAC;AACH;;ACjBA;;AAEG;;;;"}
1
+ {"version":3,"file":"hmcts-opal-frontend-common-validators-national-insurance-number.mjs","sources":["../../../projects/opal-frontend-common/validators/national-insurance-number/national-insurance-number.validator.ts","../../../projects/opal-frontend-common/validators/national-insurance-number/hmcts-opal-frontend-common-validators-national-insurance-number.ts"],"sourcesContent":["import { ValidatorFn, AbstractControl } from '@angular/forms';\n\nexport function nationalInsuranceNumberValidator(): ValidatorFn {\n return (control: AbstractControl): { [key: string]: unknown } | null => {\n const value = control.value;\n if (value) {\n // Check if the value has exactly 9 characters and matches the National Insurance number format\n const ninoRegex = /^[A-Z]{2}\\d{6}[A-D]$/;\n if (value.length !== 9 || !ninoRegex.test(value)) {\n return { nationalInsuranceNumberPattern: { value: value } };\n }\n }\n return null;\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"SAEgB,gCAAgC,GAAA;IAC9C,OAAO,CAAC,OAAwB,KAAuC;AACrE,QAAA,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK;QAC3B,IAAI,KAAK,EAAE;;YAET,MAAM,SAAS,GAAG,sBAAsB;AACxC,YAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;gBAChD,OAAO,EAAE,8BAA8B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YAC7D;QACF;AACA,QAAA,OAAO,IAAI;AACb,IAAA,CAAC;AACH;;ACdA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hmcts/opal-frontend-common",
3
- "version": "0.0.52",
3
+ "version": "0.0.53",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {
6
6
  "@angular/common": "^18.2.0 || ^19.0.0 || ^20.0.0",