Interface IdentificationKeyValidator<TIdentificationKeyValidation>

Identification key validator. Validates an identification key against its definition in section 3 of the GS1 General Specifications.

interface IdentificationKeyValidator<
    TIdentificationKeyValidation extends
        IdentificationKeyValidation = IdentificationKeyValidation,
> {
    get identificationKeyType(): IdentificationKeyType;
    get prefixType(): PrefixType;
    get length(): number;
    get referenceCharacterSet(): ContentCharacterSet;
    get referenceCreator(): CharacterSetCreator;
    validate: (
        identificationKey: string,
        validation?: TIdentificationKeyValidation,
    ) => void;
}

Type Parameters

Hierarchy (View Summary)

Properties

validate: (
    identificationKey: string,
    validation?: TIdentificationKeyValidation,
) => void

Validate an identification key and throw an error if validation fails.

Type declaration

Accessors

  • get length(): number
  • Get the length. For numeric identification key types, the length is fixed; for alphanumeric identification key types, the length is the maximum.

    Returns number