@bbitgmbh/bbit.banking-utils
Advanced tools
Comparing version 1.0.9 to 1.1.1
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BbitBankingReference = void 0; | ||
const mod10_1 = require("./mod10"); | ||
const iso11649 = __importStar(require("node-iso11649")); | ||
class BbitBankingReference { | ||
@@ -10,5 +30,3 @@ isReferenceValid(reference) { | ||
} | ||
const check = reference.substr(reference.length - 1); | ||
const calculated = mod10_1.BbitMod10.calc(reference.substr(0, reference.length - 1)); | ||
return check === calculated.toString(); | ||
return iso11649.validate(reference); | ||
} | ||
@@ -39,3 +57,3 @@ isQRReferenceValid(reference) { | ||
else { | ||
return 'TODO'; | ||
return reference.replace(/ /g, '').replace(/(.{4})(?!$)/g, '$1 '); | ||
} | ||
@@ -42,0 +60,0 @@ } |
@@ -7,3 +7,3 @@ "use strict"; | ||
it('isQRReference should work', () => { | ||
expect(validator.isQRReference('RF000000000000012312312316')).toBeFalsy(); | ||
expect(validator.isQRReference('RF4714508655422864')).toBeFalsy(); | ||
expect(validator.isQRReference('000000000000000012312312315')).toBeTruthy(); | ||
@@ -22,4 +22,6 @@ }); | ||
it('validateReference should work', () => { | ||
expect(validator.isReferenceValid('0000000000000012312312316')).toBeTruthy(); | ||
expect(validator.isReferenceValid('0000000000000012312312315')).toBeFalsy(); | ||
expect(validator.isReferenceValid('000000000000000012312312316')).toBeFalsy(); | ||
expect(validator.isReferenceValid('000000000000000012312312315')).toBeFalsy(); | ||
expect(validator.isReferenceValid('RF00TEST')).toBeFalsy(); | ||
expect(validator.isReferenceValid('RF4714508655422864')).toBeTruthy(); | ||
}); | ||
@@ -34,3 +36,4 @@ it('validateReference should fail without reference', () => { | ||
expect(validator.format('000000000000000012312312316')).toBe('00 00000 00000 00001 23123 12316'); | ||
expect(validator.format('RF4714508655422864')).toBe('RF47 1450 8655 4228 64'); | ||
}); | ||
}); |
{ | ||
"name": "@bbitgmbh/bbit.banking-utils", | ||
"version": "1.0.9", | ||
"version": "1.1.1", | ||
"license": "SEE LICENSE IN LICENSE.md", | ||
@@ -14,14 +14,14 @@ "types": "dist/index.d.js", | ||
"devDependencies": { | ||
"@types/jest": "^26.0.20", | ||
"@types/node": "^14.14.25", | ||
"@typescript-eslint/eslint-plugin": "^4.15.0", | ||
"@typescript-eslint/parser": "^4.15.0", | ||
"eslint": "^7.19.0", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"jest": "^26.6.3", | ||
"prettier": "^2.2.1", | ||
"ts-jest": "^26.5.1", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.1.3" | ||
"@types/jest": "^27.0.3", | ||
"@types/node": "^16.11.9", | ||
"@typescript-eslint/eslint-plugin": "^5.4.0", | ||
"@typescript-eslint/parser": "^5.4.0", | ||
"eslint": "^8.3.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"jest": "^27.3.1", | ||
"prettier": "^2.4.1", | ||
"ts-jest": "^27.0.7", | ||
"ts-node": "^10.4.0", | ||
"typescript": "^4.5.2" | ||
}, | ||
@@ -31,3 +31,6 @@ "files": [ | ||
"readme.md" | ||
] | ||
], | ||
"dependencies": { | ||
"node-iso11649": "^2.1.2" | ||
} | ||
} |
33480
671
1
+ Addednode-iso11649@^2.1.2
+ Addednode-iso11649@2.1.2(transitive)