Static
Readonly
GS1_GS1 Company Prefix minimum length.
Static
Readonly
GS1_GS1 Company Prefix maximum length.
Static
Readonly
UPC_U.P.C. Company Prefix minimum length.
Static
Readonly
UPC_U.P.C. Company Prefix maximum length.
Static
Readonly
GS1_GS1-8 Prefix minimum length.
Static
Readonly
GS1_GS1-8 Prefix maximum length.
Get the prefix type.
Get the prefix.
Get the GS1 Company Prefix.
Get the U.P.C. Company Prefix if prefix type is PrefixType.UPCCompanyPrefix or undefined if not.
Get the GS1-8 Prefix if prefix type is PrefixType.GS18Prefix or undefined if not.
Get the tweak factor.
Set the tweak factor.
Tweak factor.
Get GTIN creator.
Get GLN creator.
Get SSCC creator.
Get GRAI creator.
Get GIAI creator.
Get GSRN creator.
Get GDTI creator.
Get GINC creator.
Get GSIN creator.
Get GCN creator.
Get CPID creator.
Get GMN creator.
Static
getGet a prefix manager.
Prefix type.
Prefix.
Prefix manager with normalized prefix type and prefix.
Static
validateValidate a prefix.
Prefix type.
If true, a U.P.C. Company Prefix expressed as a GS1 Company Prefix is permitted.
If true, a GS1-8 Prefix expressed as a GS1 Company Prefix is permitted.
Prefix.
If true, the prefix is from an identification key and should be trimmed before its character set is validated.
If true, the prefix is from a numeric identification key and its character set will be validated by the caller.
Optional
positionOffset: numberPosition offset within a larger string.
Prefix manager. This is the core class for identification key creation.
A prefix manager may be created for any prefix type. As most applications work with a limited number of prefixes for creating identification keys, prefix managers are cached in memory and may be reused.
Prefix managers are keyed by GS1 Company Prefix, so the prefix type that is requested may not match the prefix type of the returned prefix manager. For example, the prefix manager for GS1 Company Prefix 0614141 is identical to the one for U.P.C. Company Prefix 614141, with the prefix type equal to PrefixType.UPCCompanyPrefix and the prefix equal to "614141".
To support the creation of sparse identification keys, a prefix manager maintains a tweak which is used, along with a type-specific multiplier, as the tweak when creating numeric identification keys. The default tweak factor is the numeric value of the GS1 Company Prefix representation of the prefix preceded by '1' to ensure uniqueness (i.e., so that prefixes 0 N1 N2 N3... and N1 N2 N3... produce different tweak factors). This is usually sufficient for obfuscation, but as the sparse creation algorithm is reversible and as the GS1 Company Prefix is discoverable via Verified by GS1, a user-defined tweak factor should be used if a higher degree of obfuscation is required. When using a tweak factor other than the default, care should be taken to restore it when resuming the application. A tweak factor of 0 creates a straight sequence.