Interface NumericIdentificationKeyCreator

Numeric identification key creator. Creates one or many numeric identification keys.

interface NumericIdentificationKeyCreator {
    get capacity(): number;
    create: {
        (value: number | bigint, sparse?: boolean): string;
        (values: Iterable<number | bigint, any, any>, sparse?: boolean): IterableIterator<string, any, any>;
    };
    createAll: (() => IterableIterator<string, any, any>);
    get leaderType(): LeaderType;
    get identificationKeyType(): IdentificationKeyType;
    get prefixType(): PrefixType;
    get length(): number;
    get referenceCharacterSet(): CharacterSet;
    get referenceValidator(): CharacterSetValidator;
    validate: ((identificationKey: string, validation?: IdentificationKeyValidation) => void);
    get referenceCreator(): CharacterSetCreator;
    get prefixManager(): PrefixManager;
    get prefix(): string;
    get referenceLength(): number;
}

Hierarchy (view full)

Properties

create: {
    (value: number | bigint, sparse?: boolean): string;
    (values: Iterable<number | bigint, any, any>, sparse?: boolean): IterableIterator<string, any, any>;
}

Type declaration

    • (value, sparse?): string
    • Create an identification key with a reference based on a numeric value. The value is converted to a reference of the appropriate length using NUMERIC_CREATOR.

      Parameters

      • value: number | bigint

        Numeric value.

      • Optionalsparse: boolean

        If true, the value is mapped to a sparse sequence resistant to discovery. Default is false.

      Returns string

      Identification key.

    • (values, sparse?): IterableIterator<string, any, any>
    • Create identification keys with references based on numeric values. The values are converted to references of the appropriate length using NUMERIC_CREATOR.

      Parameters

      • values: Iterable<number | bigint, any, any>

        Numeric values.

      • Optionalsparse: boolean

        If true, the values are mapped to a sparse sequence resistant to discovery. Default is false.

      Returns IterableIterator<string, any, any>

      Identification keys.

createAll: (() => IterableIterator<string, any, any>)

Create all identification keys for the prefix from 0 to capacity - 1.

The implementation creates the strings as needed using an internal generator function, so the values are created only as needed.

Type declaration

    • (): IterableIterator<string, any, any>
    • Returns IterableIterator<string, any, any>

      Iterable iterator over created identification keys.

validate: ((identificationKey: string, validation?: IdentificationKeyValidation) => void)

Validate an identification key and throw an exception if validation fails.

Type declaration

    • (identificationKey, validation?): void
    • Parameters

      Returns void

Accessors

  • get capacity(): number
  • Get the capacity (10**referenceLength).

    Returns number

  • get identificationKeyType(): IdentificationKeyType
  • Get the identification key type. Per the GS1 General Specifications, the identification key type determines the remaining properties.

    Returns IdentificationKeyType

  • get prefixType(): PrefixType
  • Get the prefix type supported by the identification key type. For all identification key types except the GTIN, this is PrefixType.GS1CompanyPrefix. For the GTIN, the prefix type determines the length.

    Returns PrefixType

  • get length(): number
  • Get the length. For numeric identification key types, the length is fixed; for alphanumeric identification key types, the length is the maximum.

    Returns number

  • get referenceCharacterSet(): CharacterSet
  • Get the reference character set.

    Returns CharacterSet

  • get prefixManager(): PrefixManager
  • Get the prefix manager to which this identification key creator is bound.

    Returns PrefixManager

  • get referenceLength(): number
  • Get the reference length.

    Returns number