-
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
Rui Marinho
committed
Apr 14, 2016
1 parent
8667234
commit 8ef0abd
Showing
4 changed files
with
66 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,49 @@ | ||
'use strict'; | ||
|
||
/** | ||
* Module dependencies. | ||
*/ | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
exports.default = function () { | ||
/** | ||
* Optional peer dependency. | ||
*/ | ||
|
||
const tin = require('tin-validator'); | ||
|
||
/** | ||
* Class name. | ||
*/ | ||
|
||
this.__class__ = 'TaxpayerIdentificationNumber'; | ||
|
||
/** | ||
* Validation algorithm. | ||
*/ | ||
|
||
this.validate = function (value) { | ||
if (typeof value !== 'string') { | ||
throw new _validator.Violation(this, value, { value: _validator.Validator.errorCode.must_be_a_string }); | ||
} | ||
|
||
if (!tin.isValid(value)) { | ||
throw new _validator.Violation(this, value); | ||
} | ||
|
||
return true; | ||
}; | ||
|
||
return this; | ||
}; | ||
|
||
var _validator = require('validator.js'); | ||
|
||
module.exports = exports['default']; | ||
|
||
/** | ||
* Export `TaxpayerIdentificationNumberAssert`. | ||
*/ |
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