File tree Expand file tree Collapse file tree 4 files changed +66
-5
lines changed Expand file tree Collapse file tree 4 files changed +66
-5
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
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
+
3
10
## [ v2.2.0] ( https://github.com/seegno/validator.js-asserts/tree/v2.2.0 ) (2016-04-10)
4
11
[ Full Changelog] ( https://github.com/seegno/validator.js-asserts/compare/v2.1.0...v2.2.0 )
5
12
Original file line number Diff line number Diff line change
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
+ */
Original file line number Diff line number Diff line change @@ -108,6 +108,10 @@ var _ukModulusCheckingAssert = require('./asserts/uk-modulus-checking-assert.js'
108
108
109
109
var _ukModulusCheckingAssert2 = _interopRequireDefault ( _ukModulusCheckingAssert ) ;
110
110
111
+ var _taxpayerIdentificationNumberAssert = require ( './asserts/taxpayer-identification-number-assert.js' ) ;
112
+
113
+ var _taxpayerIdentificationNumberAssert2 = _interopRequireDefault ( _taxpayerIdentificationNumberAssert ) ;
114
+
111
115
var _uriAssert = require ( './asserts/uri-assert.js' ) ;
112
116
113
117
var _uriAssert2 = _interopRequireDefault ( _uriAssert ) ;
@@ -126,10 +130,6 @@ var _uuidAssert2 = _interopRequireDefault(_uuidAssert);
126
130
127
131
function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
128
132
129
- /**
130
- * Module dependencies.
131
- */
132
-
133
133
/**
134
134
* Module dependencies.
135
135
*/
@@ -161,9 +161,14 @@ exports.default = {
161
161
Phone : _phoneAssert2 . default ,
162
162
PlainObject : _plainObjectAssert2 . default ,
163
163
UkModulusChecking : _ukModulusCheckingAssert2 . default ,
164
+ TaxpayerIdentificationNumber : _taxpayerIdentificationNumberAssert2 . default ,
164
165
Uri : _uriAssert2 . default ,
165
166
UsSubdivision : _usSubdivisionAssert2 . default ,
166
167
UsZipCode : _usZipCodeAssert2 . default ,
167
168
Uuid : _uuidAssert2 . default
168
169
} ;
170
+ /**
171
+ * Module dependencies.
172
+ */
173
+
169
174
module . exports = exports [ 'default' ] ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " validator.js-asserts" ,
3
- "version" : " 2.2 .0" ,
3
+ "version" : " 2.3 .0" ,
4
4
"description" : " A set of extra asserts for validator.js." ,
5
5
"license" : " MIT" ,
6
6
"contributors" : [
You can’t perform that action at this time.
0 commit comments