export declare class ModAlg { /** * PT-BR: Calcula o digito verificador de uma string numérica usando o algoritmo Mod11. * * EN: Calculates the check digit of a numeric string using the Mod11 algorithm. * * @param modAlg PT-BR: O módulo a ser usado no cálculo. Útil para casos onde o dígito verificador é calculado utilizando apenas o resto da divisão. EN: The module to be used in the calculation. Useful for cases where the check digit is calculated using only the remainder of the division. * @param modStrategy PT-BR: O tipo de retorno do algoritmo. EN: The algorithm return type. * @param digits PT-BR: O número a ser calculado. EN: The number to be calculated. * @param weights PT-BR: Os pesos a serem usados no cálculo. EN: The weights to be used in the calculation. * @param direction PT-BR: A direção do cálculo. EN: The calculation direction. Default: "left". * @param transform PT-BR: Um objeto que mapeia o resultado do módulo para um valor específico. Útil pois em diversos casos certos valores não são aceitos como dígito verificador. EN: An object that maps the module result to a specific value. Useful because in several cases certain values are not accepted as a check digit. * @param sumStrategy PT-BR: A estratégia de soma a ser usada. Útil para casos onde a soma é feita utilizando os digitos do resultado, exemplo: 12 -> 1 + 2 = 3. EN: The sum strategy to be used. Useful for cases where the sum is done using the digits of the result, example: 12 -> 1 + 2 = 3. * @param additionalSum PT-BR: Um array de valores a serem somados ao resultado final. Útil para casos onde o dígito verificador é calculado de forma diferente. EN: An array of values to be added to the final result. Useful for cases where the check digit is calculated differently. * @returns PT-BR: O digito verificador calculado. EN: The calculated check digit. * * @example * ``` * ModAlg.calculateCheckDigit({ * modStrategy: "modComplement", * modAlg: 11, * direction: "fromLeft", * digits: "20359338", * weights: [2, 3, 4, 5, 6, 7, 8, 9], * }); // "8" * ``` * * @author Pietro Bondioli */ static calculateCheckDigit({ modAlg, modStrategy, digits, weights, direction, transform, sumStrategy, transformSum, }: { modAlg: number; modStrategy: "mod" | "modComplement"; digits: string; weights: number[]; direction: "fromLeft" | "fromRight"; transform?: { [k: number]: string; }; sumStrategy?: "sum" | "sumNumerals"; transformSum?: (sum: number) => number; }): string; /** * PT-BR: Multiplica os dígitos de uma string numérica pelos pesos especificados. * * EN: Multiplies the digits of a numeric string by the specified weights. * * @param digits PT-BR: A string numérica a ser multiplicada. EN: The numeric string to be multiplied. * @param weights PT-BR: Os pesos a serem usados na multiplicação. EN: The weights to be used in the multiplication. * @returns PT-BR: Um array com os resultados da multiplicação. EN: An array with the multiplication results. * * @example * ``` * ModAlg.multiplyByWeights("203593", [1, 2, 3, 4, 5, 6], "fromLeft"); // [2, 0, 9, 20, 45, 18] * ``` */ static multiplyByWeights(digits: string, weights: number[], direction?: "fromLeft" | "fromRight"): number[]; /** * PT-BR: Soma os valores de um array de números. * * EN: Sums the values of an array of numbers. * * @param results PT-BR: O array de números a serem somados. EN: The array of numbers to be summed. * @returns PT-BR: A soma dos valores. EN: The sum of the values. * * @example * ``` * ModAlg.sum([1, 2, 3]); // 6 * ``` */ static sum(results: number[]): number; /** * PT-BR: Soma os dígitos de um array de números. * * EN: Sums the digits of an array of numbers. * * @param results PT-BR: O array de números a serem somados. EN: The array of numbers to be summed. * @returns PT-BR: A soma dos dígitos. EN: The sum of the digits. * * @example * ``` * ModAlg.sumNumerals([1, 24, 3]); // 10 * ``` */ static sumNumerals(results: number[]): number; /** * PT-BR: Calcula o resto da divisão de um número por um módulo. * * EN: Calculates the remainder of a number divided by a module. * * @param modAlg PT-BR: O módulo a ser usado no cálculo. EN: The module to be used in the calculation. * @param sum PT-BR: O número a ser dividido. EN: The number to be divided. * @returns PT-BR: O resto da divisão. EN: The remainder of the division. * * @example * ``` * ModAlg.mod(11, 100); // 1 * ``` */ static mod(modAlg: number, sum: number): number; /** * PT-BR: Calcula o complemento de um número por um módulo. * * EN: Calculates the complement of a number by a module. * * @param modAlg PT-BR: O módulo a ser usado no cálculo. EN: The module to be used in the calculation. * @param sum PT-BR: O número a ser complementado. EN: The number to be complemented. * @returns PT-BR: O complemento. EN: The complement. * * @example * ``` * ModAlg.modComplement(11, 100); // 10 * ``` */ static modComplement(modAlg: number, sum: number): number; } //# sourceMappingURL=ModAlg.d.ts.map