Comparing version 1.0.2 to 1.1.0
{ | ||
"name": "iso-7064", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "Implementation of ISO 7064 used in validation of format like IBAN, LEI, ...", | ||
@@ -8,7 +8,6 @@ "main": "./src/iso-7064.js", | ||
"scripts": { | ||
"coverage": "./node_modules/.bin/nyc --reporter=json --reporter=lcov ./node_modules/.bin/mocha --recursive-test", | ||
"coverage:codacy": "cat ./coverage/lcov.info | ./node_modules/.bin/codacy-coverage -t $CODACY_TOKEN", | ||
"coverage:codecov": "./node_modules/.bin/codecov -t $CODECOV_TOKEN -f coverage/*.json", | ||
"lint": "./node_modules/.bin/eslint .", | ||
"test": "./node_modules/.bin/mocha --recursive-test" | ||
"coverage": "jest --coverage", | ||
"lint": "eslint . --ext .js", | ||
"lint-fix": "eslint --fix . --ext .js", | ||
"test": "jest" | ||
}, | ||
@@ -34,14 +33,9 @@ "repository": { | ||
"devDependencies": { | ||
"chai": "4.1.2", | ||
"codacy-coverage": "^3.4.0", | ||
"codecov": "^3.6.1", | ||
"eslint": "4.18.2", | ||
"eslint-config-standard": "10.2.1", | ||
"eslint-plugin-import": "2.7.0", | ||
"eslint-plugin-node": "5.2.0", | ||
"eslint-plugin-promise": "3.6.0", | ||
"eslint-plugin-standard": "3.0.1", | ||
"mocha": "6.2.2", | ||
"nyc": "^14.1.1" | ||
"eslint": "^8.17.0", | ||
"eslint-config-standard": "^17.0.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jest": "^26.5.3", | ||
"eslint-plugin-node": "^11.1.0", | ||
"jest": "^28.1.0" | ||
} | ||
} |
'use strict'; | ||
const CHARCODE_0 = '0'.charCodeAt(0); | ||
const CHARCODE_0_MULTIPLIER = 10; | ||
const CHARCODE_0_OFFSET = CHARCODE_0; | ||
const CHARCODE_A = 'A'.charCodeAt(0); | ||
const CHARCODE_0 = '0'.charCodeAt(0); | ||
const CHARCODE_A_MULTIPLIER = 100; | ||
const CHARCODE_A_OFFSET = CHARCODE_A - 10; | ||
const BUFFER_INITIAL_VALUE = 0; | ||
const MODULATOR_97 = 97; | ||
const FORMAT = /^[0-9A-Z]{1,}$/; | ||
function mod97(value) { | ||
var buffer = 0; | ||
var charCode; | ||
const length = value.length; | ||
var buffer = BUFFER_INITIAL_VALUE; | ||
for (var i = 0; i < value.length; ++i) { | ||
charCode = value.charCodeAt(i); | ||
for (var i = 0; i < length; ++i) { | ||
const charCode = value.charCodeAt(i); | ||
let multiplier; | ||
let offset; | ||
buffer = charCode + (charCode >= CHARCODE_A ? buffer * 100 - CHARCODE_A + 10 : buffer * 10 - CHARCODE_0); | ||
if (charCode >= CHARCODE_A) { | ||
multiplier = CHARCODE_A_MULTIPLIER; | ||
offset = CHARCODE_A_OFFSET; | ||
} else { | ||
multiplier = CHARCODE_0_MULTIPLIER; | ||
offset = CHARCODE_0_OFFSET; | ||
} | ||
if (buffer > 1000000) { | ||
buffer %= 97; | ||
} | ||
buffer *= multiplier; | ||
buffer -= offset; | ||
buffer += charCode; | ||
buffer %= MODULATOR_97; | ||
} | ||
return buffer % 97; | ||
return buffer; | ||
} | ||
@@ -24,0 +40,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
99
8484
10