Skip to content

Commit a14724e

Browse files
committed
Release 2.2.0
1 parent 2603f38 commit a14724e

File tree

4 files changed

+83
-5
lines changed

4 files changed

+83
-5
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## [v2.2.0](https://github.com/seegno/validator.js-asserts/tree/v2.2.0) (2016-04-10)
4+
[Full Changelog](https://github.com/seegno/validator.js-asserts/compare/v2.1.0...v2.2.0)
5+
6+
**Implemented enhancements:**
7+
8+
- Add note about `Date` assert requiring `moment` for format validation [\#97](https://github.com/seegno/validator.js-asserts/pull/97) ([ruimarinho](https://github.com/ruimarinho))
9+
10+
**Merged pull requests:**
11+
12+
- Add UkModulusChecking assert [\#79](https://github.com/seegno/validator.js-asserts/pull/79) ([franciscocardoso](https://github.com/franciscocardoso))
13+
314
## [v2.1.0](https://github.com/seegno/validator.js-asserts/tree/v2.1.0) (2016-04-10)
415
[Full Changelog](https://github.com/seegno/validator.js-asserts/compare/v2.0.2...v2.1.0)
516

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
exports.default = ukModulusCheckingAssert;
7+
8+
var _validator = require('validator.js');
9+
10+
/**
11+
* Export `UkModulusCheckingAssert`.
12+
*/
13+
14+
function ukModulusCheckingAssert() {
15+
var _this = this;
16+
17+
/**
18+
* Optional peer dependencies.
19+
*/
20+
21+
const UkModulusChecking = require('uk-modulus-checking');
22+
23+
/**
24+
* Class name.
25+
*/
26+
27+
this.__class__ = 'UkModulusChecking';
28+
29+
/**
30+
* Validation algorithm.
31+
*/
32+
33+
this.validate = function () {
34+
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
35+
36+
let accountNumber = _ref.accountNumber;
37+
let sortCode = _ref.sortCode;
38+
39+
if (typeof accountNumber !== 'string') {
40+
throw new _validator.Violation(_this, accountNumber, { accountNumber: _validator.Validator.errorCode.must_be_a_string });
41+
}
42+
43+
if (typeof sortCode !== 'string') {
44+
throw new _validator.Violation(_this, sortCode, { sortCode: _validator.Validator.errorCode.must_be_a_string });
45+
}
46+
47+
const ukModulusChecking = new UkModulusChecking({ accountNumber: accountNumber, sortCode: sortCode });
48+
49+
if (!ukModulusChecking.isValid()) {
50+
throw new _validator.Violation(_this, { accountNumber: accountNumber, sortCode: sortCode });
51+
}
52+
53+
return true;
54+
};
55+
56+
return this;
57+
}
58+
/**
59+
* Module dependencies.
60+
*/
61+
62+
module.exports = exports['default'];

dist/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ var _plainObjectAssert = require('./asserts/plain-object-assert.js');
104104

105105
var _plainObjectAssert2 = _interopRequireDefault(_plainObjectAssert);
106106

107+
var _ukModulusCheckingAssert = require('./asserts/uk-modulus-checking-assert.js');
108+
109+
var _ukModulusCheckingAssert2 = _interopRequireDefault(_ukModulusCheckingAssert);
110+
107111
var _uriAssert = require('./asserts/uri-assert.js');
108112

109113
var _uriAssert2 = _interopRequireDefault(_uriAssert);
@@ -122,6 +126,10 @@ var _uuidAssert2 = _interopRequireDefault(_uuidAssert);
122126

123127
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
124128

129+
/**
130+
* Module dependencies.
131+
*/
132+
125133
/**
126134
* Module dependencies.
127135
*/
@@ -152,13 +160,10 @@ exports.default = {
152160
NullOrString: _nullOrStringAssert2.default,
153161
Phone: _phoneAssert2.default,
154162
PlainObject: _plainObjectAssert2.default,
163+
UkModulusChecking: _ukModulusCheckingAssert2.default,
155164
Uri: _uriAssert2.default,
156165
UsSubdivision: _usSubdivisionAssert2.default,
157166
UsZipCode: _usZipCodeAssert2.default,
158167
Uuid: _uuidAssert2.default
159168
};
160-
/**
161-
* Module dependencies.
162-
*/
163-
164169
module.exports = exports['default'];

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "validator.js-asserts",
3-
"version": "2.1.0",
3+
"version": "2.2.0",
44
"description": "A set of extra asserts for validator.js.",
55
"license": "MIT",
66
"contributors": [

0 commit comments

Comments
 (0)