AIDC Toolkit / GS1 / IdentifierCreator
Interface: IdentifierCreator<TIdentifierType, TIdentifierValidation> ​
Defined in: src/identifier-creator.ts:17
Identifier creator. Creates an identifier based on its definition in section 3 of the GS1 General Specifications.
Keys are created based on a prefix defined in a prefix provider to which the identifier creator is bound.
Extends ​
IdentifierValidator<TIdentifierType,TIdentifierValidation>
Extended by ​
Type Parameters ​
TIdentifierType ​
TIdentifierType extends IdentifierType = IdentifierType
Identifier type type.
TIdentifierValidation ​
TIdentifierValidation extends IdentifierValidation = IdentifierValidation
Identifier validation type.
Accessors ​
prefixProvider ​
Get Signature ​
get prefixProvider():
PrefixProvider
Defined in: src/identifier-creator.ts:21
Get the prefix provider to which this identifier creator is bound.
Returns ​
prefix ​
Get Signature ​
get prefix():
string
Defined in: src/identifier-creator.ts:27
Get the prefix, equivalent to calling prefixProvider.prefix for a GTIN or prefixProvider.gs1CompanyPrefix for all other identifier types.
Returns ​
string
referenceLength ​
Get Signature ​
get referenceLength():
number
Defined in: src/identifier-creator.ts:32
Get the reference length.
Returns ​
number
identifierType ​
Get Signature ​
get identifierType():
IdentifierTypeDescriptor<TIdentifierType>["identifierType"]
Defined in: src/identifier-validator.ts:65
Get the identifier type. Per the GS1 General Specifications, the identifier type determines the remaining properties.
Returns ​
IdentifierTypeDescriptor<TIdentifierType>["identifierType"]
Identifier type. Per the GS1 General Specifications, the identifier type determines the remaining properties.
Inherited from ​
IdentifierValidator.identifierType
prefixType ​
Get Signature ​
get prefixType():
IdentifierTypeDescriptor<TIdentifierType>["prefixType"]
Defined in: src/identifier-validator.ts:73
Get the prefix type supported by the identifier type. For all identifier types except the GTIN, this is a GS1 Company Prefix. For the GTIN, the prefix type determines the length.
Returns ​
IdentifierTypeDescriptor<TIdentifierType>["prefixType"]
Prefix type supported by the identifier type. For all identifier types except the GTIN, this is a GS1 Company Prefix. For the GTIN, the prefix type determines the length.
Inherited from ​
IdentifierValidator.prefixType
length ​
Get Signature ​
get length():
IdentifierTypeDescriptor<TIdentifierType>["length"]
Defined in: src/identifier-validator.ts:82
Get the length. For numeric identifier types, the length is fixed; for alphanumeric identifier types, the length is the maximum.
Returns ​
IdentifierTypeDescriptor<TIdentifierType>["length"]
Length. For numeric identifier types, the length is fixed; for non-numeric identifier types, the length is the maximum.
Inherited from ​
referenceCharacterSet ​
Get Signature ​
get referenceCharacterSet():
IdentifierTypeDescriptor<TIdentifierType>["referenceCharacterSet"]
Defined in: src/identifier-validator.ts:89
Get the reference character set.
Returns ​
IdentifierTypeDescriptor<TIdentifierType>["referenceCharacterSet"]
Reference character set.
Inherited from ​
IdentifierValidator.referenceCharacterSet
referenceCreator ​
Get Signature ​
get referenceCreator():
CharacterSetCreator
Defined in: src/identifier-validator.ts:96
Get the reference creator.
Returns ​
Inherited from ​
IdentifierValidator.referenceCreator
Methods ​
padIdentifier() ​
protectedpadIdentifier(identifier,positionOffset?):string
Defined in: src/identifier-validator.ts:113
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.
positionOffset? ​
number
Position offset within a larger string.
Returns ​
string
Padded identifier.
Inherited from ​
IdentifierValidator.padIdentifier
validatePrefix() ​
protectedvalidatePrefix(partialIdentifier):void
Defined in: src/identifier-validator.ts:124
Validate the prefix within an identifier.
Parameters ​
partialIdentifier ​
string
Partial identifier.
Returns ​
void
Inherited from ​
IdentifierValidator.validatePrefix
validate() ​
abstractvalidate(identifier,validation?):void
Defined in: src/identifier-validator.ts:138
Validate an identifier and throw an error if validation fails.
Parameters ​
identifier ​
string
Identifier.
validation? ​
TIdentifierValidation
Identifier validation parameters.
Returns ​
void