AIDC Toolkit / GS1 / NumericIdentifierCreator
Interface: NumericIdentifierCreator
Defined in: src/numeric-identifier-creator.ts:16
Numeric identifier creator. Creates one or many numeric identifiers.
Extends
Properties
create()
create: <
TTransformerInput>(valueOrValues,sparse?) =>TransformerOutput<TTransformerInput,string>
Defined in: src/numeric-identifier-creator.ts:38
Create identifier(s) with reference(s) based on numeric value(s). The value(s) is/are converted to references of the appropriate length using NUMERIC_CREATOR.
Type Parameters
TTransformerInput
TTransformerInput extends TransformerInput<number | bigint>
Transformer input type.
Parameters
valueOrValues
TTransformerInput
Numeric value(s).
sparse?
boolean
If true, the value(s) are mapped to a sparse sequence resistant to discovery. Default is false.
Returns
TransformerOutput<TTransformerInput, string>
Identifier(s).
createAll()
createAll: () =>
Iterable<string>
Defined in: src/numeric-identifier-creator.ts:50
Create all identifiers for the prefix from 0 to capacity - 1.
The implementation creates the strings only as needed using an internal generator function. Although the result is equivalent to calling creator.create(new Sequence(0, creator.capacity)), this method is significantly faster.
Returns
Iterable<string>
All identifiers for the prefix.
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?
Identifier validation parameters.
Returns
void
Inherited from
NumericIdentifierValidator.validate
Accessors
capacity
Get Signature
get capacity():
number
Defined in: src/numeric-identifier-creator.ts:20
Get the capacity (10**referenceLength).
Returns
number
leaderType
Get Signature
get leaderType():
string
Defined in: src/numeric-identifier-validator.ts:57
Get the leader type.
Returns
string
Inherited from
NumericIdentifierValidator.leaderType
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
Inherited from
NumericIdentifierValidator.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
Inherited from
NumericIdentifierValidator.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
Inherited from
NumericIdentifierValidator.length
referenceCharacterSet
Get Signature
get referenceCharacterSet():
ContentCharacterSet
Defined in: src/identifier-validator.ts:77
Get the reference character set.
Returns
Inherited from
NumericIdentifierValidator.referenceCharacterSet
referenceCreator
Get Signature
get referenceCreator():
CharacterSetCreator
Defined in: src/identifier-validator.ts:82
Get the reference creator.
Returns
Inherited from
NumericIdentifierValidator.referenceCreator
prefixProvider
Get Signature
get prefixProvider():
PrefixProvider
Defined in: src/identifier-creator.ts:17
Get the prefix provider to which this identifier creator is bound.
Returns
PrefixProvider
Inherited from
IdentifierCreator.prefixProvider
prefix
Get Signature
get prefix():
string
Defined in: src/identifier-creator.ts:23
Get the prefix, equivalent to calling PrefixProvider.prefix | prefixProvider.prefix for a GTIN or PrefixProvider.gs1CompanyPrefix | prefixProvider.gs1CompanyPrefix for all other identifier types.
Returns
string
Inherited from
referenceLength
Get Signature
get referenceLength():
number
Defined in: src/identifier-creator.ts:28
Get the reference length.
Returns
number