Function checkDigitSum

  • Calculate the check digit sum for a numeric string as per section 7.9.1 of the GS1 General Specifications.

    Parameters

    • exchangeWeights: boolean

      If true, start the weights at 1 instead of 3 on the right.

    • s: string

      Numeric string.

    Returns number

    Accumulated sum of each digit multiplied by the weight at its position.