Skip to content

AIDC Toolkit / GS1 / NonNumericIdentifierValidator

Class: NonNumericIdentifierValidator

Defined in: src/non-numeric-identifier-validator.ts:33

Non-numeric identifier validator.

Extends

Constructors

Constructor

new NonNumericIdentifierValidator(identifierType, length, referenceCharacterSet, requiresCheckCharacterPair): NonNumericIdentifierValidator

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

Constructor.

Parameters

identifierType

IdentifierType

Identifier type.

length

number

Length.

referenceCharacterSet

ContentCharacterSet

Reference character set.

requiresCheckCharacterPair

boolean = false

True if the identifier requires a check character pair.

Returns

NonNumericIdentifierValidator

Overrides

AbstractIdentifierValidator.constructor

Accessors

requiresCheckCharacterPair

Get Signature

get requiresCheckCharacterPair(): boolean

Defined in: src/non-numeric-identifier-validator.ts:75

Determine if the identifier requires a check character pair.

Returns

boolean


identifierType

Get Signature

get identifierType(): IdentifierType

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

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

Returns

IdentifierType

Inherited from

AbstractIdentifierValidator.identifierType


prefixType

Get Signature

get prefixType(): PrefixType

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

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

Inherited from

AbstractIdentifierValidator.prefixType


length

Get Signature

get length(): number

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

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

Returns

number

Inherited from

AbstractIdentifierValidator.length


referenceCharacterSet

Get Signature

get referenceCharacterSet(): ContentCharacterSet

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

Get the reference character set.

Returns

ContentCharacterSet

Inherited from

AbstractIdentifierValidator.referenceCharacterSet


referenceCreator

Get Signature

get referenceCreator(): CharacterSetCreator

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

Get the reference creator.

Returns

CharacterSetCreator

Inherited from

AbstractIdentifierValidator.referenceCreator

Methods

creatorFor()

protected static creatorFor(characterSet): CharacterSetCreator

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

Get the character set creator for a character set.

Parameters

characterSet

ContentCharacterSet

Character set.

Returns

CharacterSetCreator

Character set creator.

Inherited from

AbstractIdentifierValidator.creatorFor


validate()

validate(identifier, validation?): void

Defined in: src/non-numeric-identifier-validator.ts:88

Validate a non-numeric identifier and throw an error if validation fails.

Parameters

identifier

string

Identifier.

validation?

NonNumericIdentifierValidation

Validation parameters.

Returns

void

Overrides

AbstractIdentifierValidator.validate


padIdentifier()

protected padIdentifier(identifier, validation): string

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

Pad an identifier on the left with zero-value character for validation purposes. This is done to align an identifier with a position offset for any error message that may be thrown by the reference validator.

Parameters

identifier

string

Identifier.

validation

Identifier validation parameters.

IdentifierValidation | undefined

Returns

string

Padded identifier.

Inherited from

AbstractIdentifierValidator.padIdentifier


validatePrefix()

protected validatePrefix(partialIdentifier, positionOffset?): void

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

Validate the prefix within an identifier.

Parameters

partialIdentifier

string

Partial identifier.

positionOffset?

number

Position offset within a larger string.

Returns

void

Inherited from

AbstractIdentifierValidator.validatePrefix