Skip to content

Commit 8ef0abd

Browse files
author
Rui Marinho
committed
Release 2.3.0
1 parent 8667234 commit 8ef0abd

File tree

4 files changed

+66
-5
lines changed

4 files changed

+66
-5
lines changed

CHANGELOG.md

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

3+
## [v2.3.0](https://github.com/seegno/validator.js-asserts/tree/v2.3.0) (2016-04-14)
4+
[Full Changelog](https://github.com/seegno/validator.js-asserts/compare/v2.2.0...v2.3.0)
5+
6+
**Implemented enhancements:**
7+
8+
- Add Taxpayer Identification Number assert [\#66](https://github.com/seegno/validator.js-asserts/pull/66) ([nunofgs](https://github.com/nunofgs))
9+
310
## [v2.2.0](https://github.com/seegno/validator.js-asserts/tree/v2.2.0) (2016-04-10)
411
[Full Changelog](https://github.com/seegno/validator.js-asserts/compare/v2.1.0...v2.2.0)
512

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
'use strict';
2+
3+
/**
4+
* Module dependencies.
5+
*/
6+
7+
Object.defineProperty(exports, "__esModule", {
8+
value: true
9+
});
10+
11+
exports.default = function () {
12+
/**
13+
* Optional peer dependency.
14+
*/
15+
16+
const tin = require('tin-validator');
17+
18+
/**
19+
* Class name.
20+
*/
21+
22+
this.__class__ = 'TaxpayerIdentificationNumber';
23+
24+
/**
25+
* Validation algorithm.
26+
*/
27+
28+
this.validate = function (value) {
29+
if (typeof value !== 'string') {
30+
throw new _validator.Violation(this, value, { value: _validator.Validator.errorCode.must_be_a_string });
31+
}
32+
33+
if (!tin.isValid(value)) {
34+
throw new _validator.Violation(this, value);
35+
}
36+
37+
return true;
38+
};
39+
40+
return this;
41+
};
42+
43+
var _validator = require('validator.js');
44+
45+
module.exports = exports['default'];
46+
47+
/**
48+
* Export `TaxpayerIdentificationNumberAssert`.
49+
*/

dist/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ var _ukModulusCheckingAssert = require('./asserts/uk-modulus-checking-assert.js'
108108

109109
var _ukModulusCheckingAssert2 = _interopRequireDefault(_ukModulusCheckingAssert);
110110

111+
var _taxpayerIdentificationNumberAssert = require('./asserts/taxpayer-identification-number-assert.js');
112+
113+
var _taxpayerIdentificationNumberAssert2 = _interopRequireDefault(_taxpayerIdentificationNumberAssert);
114+
111115
var _uriAssert = require('./asserts/uri-assert.js');
112116

113117
var _uriAssert2 = _interopRequireDefault(_uriAssert);
@@ -126,10 +130,6 @@ var _uuidAssert2 = _interopRequireDefault(_uuidAssert);
126130

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

129-
/**
130-
* Module dependencies.
131-
*/
132-
133133
/**
134134
* Module dependencies.
135135
*/
@@ -161,9 +161,14 @@ exports.default = {
161161
Phone: _phoneAssert2.default,
162162
PlainObject: _plainObjectAssert2.default,
163163
UkModulusChecking: _ukModulusCheckingAssert2.default,
164+
TaxpayerIdentificationNumber: _taxpayerIdentificationNumberAssert2.default,
164165
Uri: _uriAssert2.default,
165166
UsSubdivision: _usSubdivisionAssert2.default,
166167
UsZipCode: _usZipCodeAssert2.default,
167168
Uuid: _uuidAssert2.default
168169
};
170+
/**
171+
* Module dependencies.
172+
*/
173+
169174
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.2.0",
3+
"version": "2.3.0",
44
"description": "A set of extra asserts for validator.js.",
55
"license": "MIT",
66
"contributors": [

0 commit comments

Comments
 (0)