Skip to content

AIDC Toolkit / GS1 / IdentifierValidator

Interface: IdentifierValidator<TIdentifierValidation>

Defined in: src/identifier-validator.ts:55

Identifier validator. Validates an identifier against its definition in section 3 of the GS1 General Specifications.

Extends

Extended by

Type Parameters

TIdentifierValidation

TIdentifierValidation extends IdentifierValidation = IdentifierValidation

Identifier validation type.

Properties

validate()

validate: (identifier, validation?) => void

Defined in: src/identifier-validator.ts:93

Validate an identifier and throw an error if validation fails.

Parameters

identifier

string

Identifier.

validation?

TIdentifierValidation

Identifier validation parameters.

Returns

void

Overrides

StringValidator.validate

Accessors

identifierType

Get Signature

get identifierType(): IdentifierType

Defined in: src/identifier-validator.ts:60

Get the identifier type. Per the GS1 General Specifications, the identifier type determines the remaining properties.

Returns

IdentifierType


prefixType

Get Signature

get prefixType(): PrefixType

Defined in: src/identifier-validator.ts:66

Get the prefix type supported by the identifier type. For all identifier types except the GTIN, this is PrefixTypes.GS1CompanyPrefix. For the GTIN, the prefix type determines the length.

Returns

PrefixType


length

Get Signature

get length(): number

Defined in: src/identifier-validator.ts:72

Get the length. For numeric identifier types, the length is fixed; for alphanumeric identifier types, the length is the maximum.

Returns

number


referenceCharacterSet

Get Signature

get referenceCharacterSet(): ContentCharacterSet

Defined in: src/identifier-validator.ts:77

Get the reference character set.

Returns

ContentCharacterSet


referenceCreator

Get Signature

get referenceCreator(): CharacterSetCreator

Defined in: src/identifier-validator.ts:82

Get the reference creator.

Returns

CharacterSetCreator