Skip to content

Commit

Permalink
Release 2.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ruimarinho committed Apr 10, 2016
1 parent 2603f38 commit a14724e
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 5 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Changelog

## [v2.2.0](https://github.com/seegno/validator.js-asserts/tree/v2.2.0) (2016-04-10)
[Full Changelog](https://github.com/seegno/validator.js-asserts/compare/v2.1.0...v2.2.0)

**Implemented enhancements:**

- 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))

**Merged pull requests:**

- Add UkModulusChecking assert [\#79](https://github.com/seegno/validator.js-asserts/pull/79) ([franciscocardoso](https://github.com/franciscocardoso))

## [v2.1.0](https://github.com/seegno/validator.js-asserts/tree/v2.1.0) (2016-04-10)
[Full Changelog](https://github.com/seegno/validator.js-asserts/compare/v2.0.2...v2.1.0)

Expand Down
62 changes: 62 additions & 0 deletions dist/asserts/uk-modulus-checking-assert.js
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'];
13 changes: 9 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ var _plainObjectAssert = require('./asserts/plain-object-assert.js');

var _plainObjectAssert2 = _interopRequireDefault(_plainObjectAssert);

var _ukModulusCheckingAssert = require('./asserts/uk-modulus-checking-assert.js');

var _ukModulusCheckingAssert2 = _interopRequireDefault(_ukModulusCheckingAssert);

var _uriAssert = require('./asserts/uri-assert.js');

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

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

/**
* Module dependencies.
*/

/**
* Module dependencies.
*/
Expand Down Expand Up @@ -152,13 +160,10 @@ exports.default = {
NullOrString: _nullOrStringAssert2.default,
Phone: _phoneAssert2.default,
PlainObject: _plainObjectAssert2.default,
UkModulusChecking: _ukModulusCheckingAssert2.default,
Uri: _uriAssert2.default,
UsSubdivision: _usSubdivisionAssert2.default,
UsZipCode: _usZipCodeAssert2.default,
Uuid: _uuidAssert2.default
};
/**
* Module dependencies.
*/

module.exports = exports['default'];
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "validator.js-asserts",
"version": "2.1.0",
"version": "2.2.0",
"description": "A set of extra asserts for validator.js.",
"license": "MIT",
"contributors": [
Expand Down

0 comments on commit a14724e

Please sign in to comment.