Skip to content

AIDC Toolkit / GS1 / PrefixValidator

Variable: PrefixValidator

const PrefixValidator: object

Defined in: src/prefix-validator.ts:183

Prefix validator.

Type Declaration

GS1_COMPANY_PREFIX_MINIMUM_LENGTH

GS1_COMPANY_PREFIX_MINIMUM_LENGTH: 4

GS1 Company Prefix minimum length.

GS1_COMPANY_PREFIX_MAXIMUM_LENGTH

GS1_COMPANY_PREFIX_MAXIMUM_LENGTH: 12

GS1 Company Prefix maximum length.

UPC_COMPANY_PREFIX_MINIMUM_LENGTH

UPC_COMPANY_PREFIX_MINIMUM_LENGTH: 6

U.P.C. Company Prefix minimum length.

UPC_COMPANY_PREFIX_MAXIMUM_LENGTH

UPC_COMPANY_PREFIX_MAXIMUM_LENGTH: 11

U.P.C. Company Prefix maximum length.

GS1_8_PREFIX_MINIMUM_LENGTH

GS1_8_PREFIX_MINIMUM_LENGTH: 2

GS1-8 Prefix minimum length.

GS1_8_PREFIX_MAXIMUM_LENGTH

GS1_8_PREFIX_MAXIMUM_LENGTH: 7

GS1-8 Prefix maximum length.

validate()

validate: (prefixType, allowUPCCompanyPrefix, allowGS18Prefix, prefix, isFromIdentifier, isNumericIdentifier, positionOffset?) => void

Validate a prefix.

Parameters

prefixType

PrefixType

Prefix type.

allowUPCCompanyPrefix

boolean

If true, a U.P.C. Company Prefix expressed as a GS1 Company Prefix is permitted.

allowGS18Prefix

boolean

If true, a GS1-8 Prefix expressed as a GS1 Company Prefix is permitted.

prefix

string

Prefix.

isFromIdentifier

boolean = false

If true, the prefix is from an identifier and should be trimmed before its character set is validated.

isNumericIdentifier

boolean = false

If true, the prefix is from a numeric identifier and its character set will be validated by the caller.

positionOffset?

number

Position offset within a larger string.

Returns

void