Skip to content

AIDC Toolkit / GS1 / VariableMeasure

Class: VariableMeasure ​

Defined in: src/variable-measure.ts:24

Variable measure trade item support functions.

Constructors ​

Constructor ​

new VariableMeasure(): VariableMeasure

Returns ​

VariableMeasure

Methods ​

parseRCN() ​

static parseRCN(format, rcn): RCNReference

Defined in: src/variable-measure.ts:56

Parse a Restricted Circulation Number (RCN) using a variable measure trade item format. The format is a 12- or 13-character string (for RCN-12 or RCN-13 respectively), containing the following:

  • '2' - The first character of the RCN.
  • '0'-'9' - The second character of the RCN (RCN-13 only).
  • 'I' - One or more, in sequence, for the item reference.
  • 'P' - One or more, in sequence, for the price or weight.
  • 'V' - Zero or one, for the price or weight check digit.
  • 'C' - The check digit of the entire RCN.

The 'I', 'P', and 'V' formats may be in any order.

Some examples:

  • 2IIIIIVPPPPC - RCN-12 with a five-digit item reference, a price or weight check digit, and a four-digit price or weight.
  • 23IIIIVPPPPPC - RCN-13 with a four-digit item reference, a price or weight check digit, and a five-digit price or weight.
  • 2IIIIIIPPPPC - RCN-12 with a six-digit item reference and a four-digit price or eight.
  • 29IIIIIPPPPPC - RCN-13 with a five-digit item reference and a five-digit price or weight.

Parameters ​

format ​

string

Format.

rcn ​

string

RCN.

Returns ​

RCNReference

RCN reference.


createRCN() ​

static createRCN(format, itemReference, priceOrWeight): string

Defined in: src/variable-measure.ts:169

Create a Restricted Circulation Number (RCN) using a variable measure trade item format. See parseRCN for format details.

Parameters ​

format ​

string

Format.

itemReference ​

number

Item reference.

priceOrWeight ​

number

Price or weight (whole number only).

Returns ​

string

RCN-12 or RCN-13.