-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2603f38
commit a14724e
Showing
4 changed files
with
83 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = ukModulusCheckingAssert; | ||
|
||
var _validator = require('validator.js'); | ||
|
||
/** | ||
* Export `UkModulusCheckingAssert`. | ||
*/ | ||
|
||
function ukModulusCheckingAssert() { | ||
var _this = this; | ||
|
||
/** | ||
* Optional peer dependencies. | ||
*/ | ||
|
||
const UkModulusChecking = require('uk-modulus-checking'); | ||
|
||
/** | ||
* Class name. | ||
*/ | ||
|
||
this.__class__ = 'UkModulusChecking'; | ||
|
||
/** | ||
* Validation algorithm. | ||
*/ | ||
|
||
this.validate = function () { | ||
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; | ||
|
||
let accountNumber = _ref.accountNumber; | ||
let sortCode = _ref.sortCode; | ||
|
||
if (typeof accountNumber !== 'string') { | ||
throw new _validator.Violation(_this, accountNumber, { accountNumber: _validator.Validator.errorCode.must_be_a_string }); | ||
} | ||
|
||
if (typeof sortCode !== 'string') { | ||
throw new _validator.Violation(_this, sortCode, { sortCode: _validator.Validator.errorCode.must_be_a_string }); | ||
} | ||
|
||
const ukModulusChecking = new UkModulusChecking({ accountNumber: accountNumber, sortCode: sortCode }); | ||
|
||
if (!ukModulusChecking.isValid()) { | ||
throw new _validator.Violation(_this, { accountNumber: accountNumber, sortCode: sortCode }); | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
return this; | ||
} | ||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
module.exports = exports['default']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters