br-validations
Advanced tools
Comparing version 0.3.0 to 0.3.1
{ | ||
"name": "br-validations", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "A library of validations applicable to several Brazilian data like I.E., CNPJ, CPF and others", | ||
@@ -5,0 +5,0 @@ "homepage": "http://github.com/the-darc/br-validations", |
@@ -0,1 +1,11 @@ | ||
<a name="0.3.1"></a> | ||
## [0.3.1](https://github.com/the-darc/br-validations/compare/0.3.0...0.3.1) (2016-11-10) | ||
### Bug Fixes | ||
* **ie:** fix validation for IE of Rondonia ([f4eabf9](https://github.com/the-darc/br-validations/commit/f4eabf9)), closes [#11](https://github.com/the-darc/br-validations/issues/11) | ||
* **package.json** fixing installation problem through npm ([4050fd0](https://github.com/the-darc/br-validations/commit/4050fd0)), closes [#9](https://github.com/the-darc/br-validations/issues/9) | ||
<a name"0.3.0"></a> | ||
@@ -2,0 +12,0 @@ ## 0.3.0 (2015-07-15) |
@@ -6,5 +6,3 @@ var gulp = require('gulp'), | ||
config: path.join(__dirname, 'package.json') | ||
}), | ||
pkg = require('./package.json'), | ||
fs = require('fs'); | ||
}); | ||
@@ -19,3 +17,3 @@ var config = { | ||
} | ||
} | ||
}; | ||
@@ -33,2 +31,3 @@ gulp.task('build', function(done) { | ||
'(function (root, factory) {', | ||
' /* istanbul ignore next */', | ||
' if (typeof define === \'function\' && define.amd) {', | ||
@@ -128,19 +127,1 @@ ' // AMD. Register as an anonymous module.', | ||
}); | ||
gulp.task('changelog', function(done) { | ||
var changelog = require('conventional-changelog'); | ||
var options = { | ||
repository: pkg.homepage, | ||
version: pkg.version, | ||
file: path.join(__dirname, 'CHANGELOG.md') | ||
}; | ||
changelog(options, function(err, log) { | ||
if (err) { | ||
throw err; | ||
} | ||
fs.writeFile(options.file, log, done); | ||
}); | ||
}); |
{ | ||
"name": "br-validations", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "A library of validations applicable to several Brazilian data like I.E., CNPJ, CPF and others", | ||
@@ -17,3 +17,3 @@ "id": "/br-validations", | ||
"test": "gulp test-coverage", | ||
"postinstall": "gulp build" | ||
"release": "conventional-changelog -p angular -i CHANGELOG.md -s" | ||
}, | ||
@@ -35,16 +35,17 @@ "keywords": [ | ||
"devDependencies": { | ||
"conventional-changelog": "0.0.17", | ||
"gulp": "^3.9.0", | ||
"gulp-concat": "^2.3.4", | ||
"conventional-changelog": "1.1.0", | ||
"gulp": "^3.9.1", | ||
"gulp-concat": "^2.6.0", | ||
"gulp-coveralls": "^0.1.4", | ||
"gulp-footer": "^1.0.5", | ||
"gulp-header": "^1.0.5", | ||
"gulp-istanbul": "^0.10.0", | ||
"gulp-jshint": "^1.6.1", | ||
"gulp-load-plugins": "^0.5.3", | ||
"gulp-mocha": "^1.0.0", | ||
"gulp-uglify": "^0.3.2", | ||
"jshint-stylish": "^0.2.0", | ||
"should": "^4.0.1" | ||
"gulp-header": "^1.8.8", | ||
"gulp-istanbul": "^1.1.1", | ||
"gulp-jshint": "^2.0.2", | ||
"gulp-load-plugins": "^1.4.0", | ||
"gulp-mocha": "^3.0.1", | ||
"gulp-uglify": "^2.0.0", | ||
"jshint": "^2.9.4", | ||
"jshint-stylish": "^2.2.1", | ||
"should": "^11.1.1" | ||
} | ||
} |
@@ -1,6 +0,11 @@ | ||
[![NPM version](https://badge.fury.io/js/br-validations.svg)](http://badge.fury.io/js/br-validations) | ||
[![Build Status](https://travis-ci.org/the-darc/br-validations.svg?branch=master)](https://travis-ci.org/the-darc/br-validations) | ||
br-validations | ||
============== | ||
[![npm version](https://img.shields.io/npm/v/br-validations.svg)](https://www.npmjs.com/package/br-validations) | ||
[![Bower version](https://img.shields.io/bower/v/br-validations.svg)](https://bower.io/search/?q=br-validations) | ||
[![Build Status](https://travis-ci.org/the-darc/br-validations.svg)](https://travis-ci.org/the-darc/br-validations) | ||
[![Coverage Status](https://coveralls.io/repos/the-darc/br-validations/badge.svg)](https://coveralls.io/r/the-darc/br-validations) | ||
# br-validations # | ||
[![NPM](https://nodei.co/npm/br-validations.png?downloads=true&stars=true)](https://nodei.co/npm/br-validations/) | ||
A library of validations applicable to several Brazilian data like I.E., CNPJ, CPF and others. | ||
@@ -7,0 +12,0 @@ |
/** | ||
* br-validations | ||
* A library of validations applicable to several Brazilian data like I.E., CNPJ, CPF and others | ||
* @version v0.2.4 | ||
* @version v0.3.0 | ||
* @link http://github.com/the-darc/br-validations | ||
@@ -9,2 +9,3 @@ * @license MIT | ||
(function (root, factory) { | ||
/* istanbul ignore next */ | ||
if (typeof define === 'function' && define.amd) { | ||
@@ -220,5 +221,2 @@ // AMD. Register as an anonymous module. | ||
function validateIE(value, rule) { | ||
if (rule.match && !rule.match.test(value)) { | ||
return false; | ||
} | ||
for (var i = 0; i < rule.dvs.length; i++) { | ||
@@ -447,3 +445,3 @@ // console.log('>> >> dv'+i); | ||
pesos: [6,5,4,3,2,9,8,7,6,5,4,3,2], | ||
algorithmSteps: ['onlyNumbers', 'normalSum', 'mod11', 'minusRestOf11'] | ||
algorithmSteps: ['onlyNumbers', 'normalSum', 'mod11', 'minusRestOf11v2'] | ||
}], | ||
@@ -450,0 +448,0 @@ validate: function(value) { return validateIE(value, this); } |
@@ -1,1 +0,1 @@ | ||
!function(s,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():s.BrV=t()}(this,function(){function s(s,t){var r=t.algorithmSteps,e=m.handleStr[r[0]](s),o=m.sum[r[1]](e,t.pesos),n=m.rest[r[2]](o),u=parseInt(e[t.dvpos]),a=m.expectedDV[r[3]](n,e);return u===a}function t(t,r){if(r.match&&!r.match.test(t))return!1;for(var e=0;e<r.dvs.length;e++)if(!s(t,r.dvs[e]))return!1;return!0}var r={};r.validate=function(s){var t=[6,5,4,3,2,9,8,7,6,5,4,3,2];s=s.replace(/[^\d]/g,"");var r=/^(0{14}|1{14}|2{14}|3{14}|4{14}|5{14}|6{14}|7{14}|8{14}|9{14})$/;if(!s||14!==s.length||r.test(s))return!1;s=s.split("");for(var e=0,o=0;12>e;e++)o+=s[e]*t[e+1];if(o=11-o%11,o=o>=10?0:o,parseInt(s[12])!==o)return!1;for(e=0,o=0;12>=e;e++)o+=s[e]*t[e];return o=11-o%11,o=o>=10?0:o,parseInt(s[13])!==o?!1:!0};var e={};e.validate=function(s){function t(t){for(var r=0,e=t-9,o=0;9>o;o++)r+=parseInt(s.charAt(o+e))*(o+1);return r%11%10===parseInt(s.charAt(t))}s=s.replace(/[^\d]+/g,"");var r=/^(0{11}|1{11}|2{11}|3{11}|4{11}|5{11}|6{11}|7{11}|8{11}|9{11})$/;return!s||11!==s.length||r.test(s)?!1:t(9)&&t(10)};var o=function(s){return this instanceof o?(this.rules=n[s]||[],this.rule,o.prototype._defineRule=function(s){this.rule=void 0;for(var t=0;t<this.rules.length&&void 0===this.rule;t++){var r=s.replace(/[^\d]/g,""),e=this.rules[t];r.length!==e.chars||e.match&&!e.match.test(s)||(this.rule=e)}return!!this.rule},o.prototype.validate=function(s){return s&&this._defineRule(s)?this.rule.validate(s):!1},void 0):new o(s)},n={},m={handleStr:{onlyNumbers:function(s){return s.replace(/[^\d]/g,"").split("")},mgSpec:function(s){var t=s.replace(/[^\d]/g,"");return t=t.substr(0,3)+"0"+t.substr(3,t.length),t.split("")}},sum:{normalSum:function(s,t){for(var r=s,e=0,o=0;o<t.length;o++)e+=parseInt(r[o])*t[o];return e},individualSum:function(s,t){for(var r=s,e=0,o=0;o<t.length;o++){var n=parseInt(r[o])*t[o];e+=n%10+parseInt(n/10)}return e},apSpec:function(s,t){var r=this.normalSum(s,t),e=s.join("");return e>="030000010"&&"030170009">=e?r+5:e>="030170010"&&"030190229">=e?r+9:r}},rest:{mod11:function(s){return s%11},mod10:function(s){return s%10},mod9:function(s){return s%9}},expectedDV:{minusRestOf11:function(s){return 2>s?0:11-s},minusRestOf11v2:function(s){return 2>s?11-s-10:11-s},minusRestOf10:function(s){return 1>s?0:10-s},mod10:function(s){return s%10},goSpec:function(s,t){var r=t.join("");return 1===s?r>="101031050"&&"101199979">=r?1:0:0===s?0:11-s},apSpec:function(s,t){var r=t.join("");return 0===s?r>="030170010"&&"030190229">=r?1:0:1===s?0:11-s},voidFn:function(s){return s}}};n.PE=[{chars:9,dvs:[{dvpos:7,pesos:[8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]},{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}},{chars:14,pesos:[[1,2,3,4,5,9,8,7,6,5,4,3,2]],dvs:[{dvpos:13,pesos:[5,4,3,2,1,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11v2"]}],validate:function(s){return t(s,this)}}],n.RS=[{chars:10,dvs:[{dvpos:9,pesos:[2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.AC=[{chars:13,match:/^01/,dvs:[{dvpos:11,pesos:[4,3,2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]},{dvpos:12,pesos:[5,4,3,2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.MG=[{chars:13,dvs:[{dvpos:12,pesos:[1,2,1,2,1,2,1,2,1,2,1,2],algorithmSteps:["mgSpec","individualSum","mod10","minusRestOf10"]},{dvpos:12,pesos:[3,2,11,10,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.SP=[{chars:12,match:/^[0-9]/,dvs:[{dvpos:8,pesos:[1,3,4,5,6,7,8,10],algorithmSteps:["onlyNumbers","normalSum","mod11","mod10"]},{dvpos:11,pesos:[3,2,10,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","mod10"]}],validate:function(s){return t(s,this)}},{chars:12,match:/^P/i,dvs:[{dvpos:8,pesos:[1,3,4,5,6,7,8,10],algorithmSteps:["onlyNumbers","normalSum","mod11","mod10"]}],validate:function(s){return t(s,this)}}],n.DF=[{chars:13,dvs:[{dvpos:11,pesos:[4,3,2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]},{dvpos:12,pesos:[5,4,3,2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.ES=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.BA=[{chars:8,match:/^[0123458]/,dvs:[{dvpos:7,pesos:[7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod10","minusRestOf10"]},{dvpos:6,pesos:[8,7,6,5,4,3,0,2],algorithmSteps:["onlyNumbers","normalSum","mod10","minusRestOf10"]}],validate:function(s){return t(s,this)}},{chars:8,match:/^[679]/,dvs:[{dvpos:7,pesos:[7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]},{dvpos:6,pesos:[8,7,6,5,4,3,0,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}},{chars:9,match:/^[0-9][0123458]/,dvs:[{dvpos:8,pesos:[8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod10","minusRestOf10"]},{dvpos:7,pesos:[9,8,7,6,5,4,3,0,2],algorithmSteps:["onlyNumbers","normalSum","mod10","minusRestOf10"]}],validate:function(s){return t(s,this)}},{chars:9,match:/^[0-9][679]/,dvs:[{dvpos:8,pesos:[8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]},{dvpos:7,pesos:[9,8,7,6,5,4,3,0,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.AM=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.RN=[{chars:9,match:/^20/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}},{chars:10,match:/^20/,dvs:[{dvpos:8,pesos:[10,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.RO=[{chars:14,dvs:[{dvpos:13,pesos:[6,5,4,3,2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.PR=[{chars:10,dvs:[{dvpos:8,pesos:[3,2,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]},{dvpos:9,pesos:[4,3,2,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.SC=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.RJ=[{chars:8,dvs:[{dvpos:7,pesos:[2,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.PA=[{chars:9,match:/^15/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.SE=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.PB=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.CE=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.PI=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.MA=[{chars:9,match:/^12/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.MT=[{chars:11,dvs:[{dvpos:10,pesos:[3,2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.MS=[{chars:9,match:/^28/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.TO=[{chars:11,match:/^[0-9]{2}((0[123])|(99))/,dvs:[{dvpos:10,pesos:[9,8,0,0,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.AL=[{chars:9,match:/^24[03578]/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.RR=[{chars:9,match:/^24/,dvs:[{dvpos:8,pesos:[1,2,3,4,5,6,7,8],algorithmSteps:["onlyNumbers","normalSum","mod9","voidFn"]}],validate:function(s){return t(s,this)}}],n.GO=[{chars:9,match:/^1[015]/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","goSpec"]}],validate:function(s){return t(s,this)}}],n.AP=[{chars:9,match:/^03/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","apSpec","mod11","apSpec"]}],validate:function(s){return t(s,this)}}];var u={};return u.validate=function(s){function t(s){for(var t=[3,2,9,8,7,6,5,4,3,2],r=0,e=0;9>=e;e++)r+=parseInt(s.charAt(e))*t[e];var o=11-r%11;return 10===o||11===o?0:o}s=s.replace(/[^\d]+/g,"");var r=/^(0{11}|1{11}|2{11}|3{11}|4{11}|5{11}|6{11}|7{11}|8{11}|9{11})$/;if(!s||11!==s.length||r.test(s))return!1;var e=s.substring(0,10),o=s.substring(10);return Number(o)===t(e)},{ie:o,cpf:e,cnpj:r,pis:u}}); | ||
!function(s,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():s.BrV=t()}(this,function(){function s(s,t){var r=t.algorithmSteps,o=m.handleStr[r[0]](s),e=m.sum[r[1]](o,t.pesos),n=m.rest[r[2]](e),u=parseInt(o[t.dvpos]),a=m.expectedDV[r[3]](n,o);return u===a}function t(t,r){for(var o=0;o<r.dvs.length;o++)if(!s(t,r.dvs[o]))return!1;return!0}var r={};r.validate=function(s){var t=[6,5,4,3,2,9,8,7,6,5,4,3,2];s=s.replace(/[^\d]/g,"");var r=/^(0{14}|1{14}|2{14}|3{14}|4{14}|5{14}|6{14}|7{14}|8{14}|9{14})$/;if(!s||14!==s.length||r.test(s))return!1;s=s.split("");for(var o=0,e=0;o<12;o++)e+=s[o]*t[o+1];if(e=11-e%11,e=e>=10?0:e,parseInt(s[12])!==e)return!1;for(o=0,e=0;o<=12;o++)e+=s[o]*t[o];return e=11-e%11,e=e>=10?0:e,parseInt(s[13])===e};var o={};o.validate=function(s){function t(t){for(var r=0,o=t-9,e=0;e<9;e++)r+=parseInt(s.charAt(e+o))*(e+1);return r%11%10===parseInt(s.charAt(t))}s=s.replace(/[^\d]+/g,"");var r=/^(0{11}|1{11}|2{11}|3{11}|4{11}|5{11}|6{11}|7{11}|8{11}|9{11})$/;return!(!s||11!==s.length||r.test(s))&&(t(9)&&t(10))};var e=function(s){return this instanceof e?(this.rules=n[s]||[],this.rule,e.prototype._defineRule=function(s){this.rule=void 0;for(var t=0;t<this.rules.length&&void 0===this.rule;t++){var r=s.replace(/[^\d]/g,""),o=this.rules[t];r.length!==o.chars||o.match&&!o.match.test(s)||(this.rule=o)}return!!this.rule},void(e.prototype.validate=function(s){return!(!s||!this._defineRule(s))&&this.rule.validate(s)})):new e(s)},n={},m={handleStr:{onlyNumbers:function(s){return s.replace(/[^\d]/g,"").split("")},mgSpec:function(s){var t=s.replace(/[^\d]/g,"");return t=t.substr(0,3)+"0"+t.substr(3,t.length),t.split("")}},sum:{normalSum:function(s,t){for(var r=s,o=0,e=0;e<t.length;e++)o+=parseInt(r[e])*t[e];return o},individualSum:function(s,t){for(var r=s,o=0,e=0;e<t.length;e++){var n=parseInt(r[e])*t[e];o+=n%10+parseInt(n/10)}return o},apSpec:function(s,t){var r=this.normalSum(s,t),o=s.join("");return o>="030000010"&&o<="030170009"?r+5:o>="030170010"&&o<="030190229"?r+9:r}},rest:{mod11:function(s){return s%11},mod10:function(s){return s%10},mod9:function(s){return s%9}},expectedDV:{minusRestOf11:function(s){return s<2?0:11-s},minusRestOf11v2:function(s){return s<2?11-s-10:11-s},minusRestOf10:function(s){return s<1?0:10-s},mod10:function(s){return s%10},goSpec:function(s,t){var r=t.join("");return 1===s?r>="101031050"&&r<="101199979"?1:0:0===s?0:11-s},apSpec:function(s,t){var r=t.join("");return 0===s?r>="030170010"&&r<="030190229"?1:0:1===s?0:11-s},voidFn:function(s){return s}}};n.PE=[{chars:9,dvs:[{dvpos:7,pesos:[8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]},{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}},{chars:14,pesos:[[1,2,3,4,5,9,8,7,6,5,4,3,2]],dvs:[{dvpos:13,pesos:[5,4,3,2,1,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11v2"]}],validate:function(s){return t(s,this)}}],n.RS=[{chars:10,dvs:[{dvpos:9,pesos:[2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.AC=[{chars:13,match:/^01/,dvs:[{dvpos:11,pesos:[4,3,2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]},{dvpos:12,pesos:[5,4,3,2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.MG=[{chars:13,dvs:[{dvpos:12,pesos:[1,2,1,2,1,2,1,2,1,2,1,2],algorithmSteps:["mgSpec","individualSum","mod10","minusRestOf10"]},{dvpos:12,pesos:[3,2,11,10,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.SP=[{chars:12,match:/^[0-9]/,dvs:[{dvpos:8,pesos:[1,3,4,5,6,7,8,10],algorithmSteps:["onlyNumbers","normalSum","mod11","mod10"]},{dvpos:11,pesos:[3,2,10,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","mod10"]}],validate:function(s){return t(s,this)}},{chars:12,match:/^P/i,dvs:[{dvpos:8,pesos:[1,3,4,5,6,7,8,10],algorithmSteps:["onlyNumbers","normalSum","mod11","mod10"]}],validate:function(s){return t(s,this)}}],n.DF=[{chars:13,dvs:[{dvpos:11,pesos:[4,3,2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]},{dvpos:12,pesos:[5,4,3,2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.ES=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.BA=[{chars:8,match:/^[0123458]/,dvs:[{dvpos:7,pesos:[7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod10","minusRestOf10"]},{dvpos:6,pesos:[8,7,6,5,4,3,0,2],algorithmSteps:["onlyNumbers","normalSum","mod10","minusRestOf10"]}],validate:function(s){return t(s,this)}},{chars:8,match:/^[679]/,dvs:[{dvpos:7,pesos:[7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]},{dvpos:6,pesos:[8,7,6,5,4,3,0,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}},{chars:9,match:/^[0-9][0123458]/,dvs:[{dvpos:8,pesos:[8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod10","minusRestOf10"]},{dvpos:7,pesos:[9,8,7,6,5,4,3,0,2],algorithmSteps:["onlyNumbers","normalSum","mod10","minusRestOf10"]}],validate:function(s){return t(s,this)}},{chars:9,match:/^[0-9][679]/,dvs:[{dvpos:8,pesos:[8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]},{dvpos:7,pesos:[9,8,7,6,5,4,3,0,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.AM=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.RN=[{chars:9,match:/^20/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}},{chars:10,match:/^20/,dvs:[{dvpos:8,pesos:[10,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.RO=[{chars:14,dvs:[{dvpos:13,pesos:[6,5,4,3,2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11v2"]}],validate:function(s){return t(s,this)}}],n.PR=[{chars:10,dvs:[{dvpos:8,pesos:[3,2,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]},{dvpos:9,pesos:[4,3,2,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.SC=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.RJ=[{chars:8,dvs:[{dvpos:7,pesos:[2,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.PA=[{chars:9,match:/^15/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.SE=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.PB=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.CE=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.PI=[{chars:9,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.MA=[{chars:9,match:/^12/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.MT=[{chars:11,dvs:[{dvpos:10,pesos:[3,2,9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.MS=[{chars:9,match:/^28/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.TO=[{chars:11,match:/^[0-9]{2}((0[123])|(99))/,dvs:[{dvpos:10,pesos:[9,8,0,0,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.AL=[{chars:9,match:/^24[03578]/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","minusRestOf11"]}],validate:function(s){return t(s,this)}}],n.RR=[{chars:9,match:/^24/,dvs:[{dvpos:8,pesos:[1,2,3,4,5,6,7,8],algorithmSteps:["onlyNumbers","normalSum","mod9","voidFn"]}],validate:function(s){return t(s,this)}}],n.GO=[{chars:9,match:/^1[015]/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","normalSum","mod11","goSpec"]}],validate:function(s){return t(s,this)}}],n.AP=[{chars:9,match:/^03/,dvs:[{dvpos:8,pesos:[9,8,7,6,5,4,3,2],algorithmSteps:["onlyNumbers","apSpec","mod11","apSpec"]}],validate:function(s){return t(s,this)}}];var u={};return u.validate=function(s){function t(s){for(var t=[3,2,9,8,7,6,5,4,3,2],r=0,o=0;o<=9;o++)r+=parseInt(s.charAt(o))*t[o];var e=11-r%11;return 10===e||11===e?0:e}s=s.replace(/[^\d]+/g,"");var r=/^(0{11}|1{11}|2{11}|3{11}|4{11}|5{11}|6{11}|7{11}|8{11}|9{11})$/;if(!s||11!==s.length||r.test(s))return!1;var o=s.substring(0,10),e=s.substring(10);return Number(e)===t(o)},{ie:e,cpf:o,cnpj:r,pis:u}}); |
@@ -119,5 +119,2 @@ var IErules = {}; | ||
function validateIE(value, rule) { | ||
if (rule.match && !rule.match.test(value)) { | ||
return false; | ||
} | ||
for (var i = 0; i < rule.dvs.length; i++) { | ||
@@ -346,3 +343,3 @@ // console.log('>> >> dv'+i); | ||
pesos: [6,5,4,3,2,9,8,7,6,5,4,3,2], | ||
algorithmSteps: ['onlyNumbers', 'normalSum', 'mod11', 'minusRestOf11'] | ||
algorithmSteps: ['onlyNumbers', 'normalSum', 'mod11', 'minusRestOf11v2'] | ||
}], | ||
@@ -349,0 +346,0 @@ validate: function(value) { return validateIE(value, this); } |
@@ -9,11 +9,11 @@ var should = require('should'), | ||
it('should ivalidate for unknown UF', function(done) { | ||
should(BrV.ie('XX').validate('0321418-40')).be.false; | ||
should(BrV.ie('XX').validate('0321418-40')).be.false(); | ||
done(); | ||
}); | ||
it('should ivalidate for undefined uf', function(done) { | ||
should(BrV.ie(undefined).validate('0321418-40')).be.false; | ||
should(BrV.ie(undefined).validate('0321418-40')).be.false(); | ||
done(); | ||
}); | ||
it('should ivalidate for NULL uf', function(done) { | ||
should(BrV.ie(null).validate('0321418-40')).be.false; | ||
should(BrV.ie(null).validate('0321418-40')).be.false(); | ||
done(); | ||
@@ -25,15 +25,15 @@ }); | ||
it('should validate 0321418-40', function(done) { | ||
should(BrV.ie(uf).validate('0321418-40')).be.true; | ||
should(BrV.ie(uf).validate('0321418-40')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 1321418-40', function(done) { | ||
should(BrV.ie(uf).validate('1321418-40')).be.false; | ||
should(BrV.ie(uf).validate('1321418-40')).be.false(); | ||
done(); | ||
}); | ||
it('should validate 18.1.001.0000004-9', function(done) { | ||
should(BrV.ie(uf).validate('18.1.001.0000004-9')).be.true; | ||
should(BrV.ie(uf).validate('18.1.001.0000004-9')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 18.1.001.0000005-9', function(done) { | ||
should(BrV.ie(uf).validate('18.1.001.0000005-9')).be.false; | ||
should(BrV.ie(uf).validate('18.1.001.0000005-9')).be.false(); | ||
done(); | ||
@@ -45,7 +45,7 @@ }); | ||
it('should validate 224/3658792', function(done) { | ||
should(BrV.ie(uf).validate('224/3658792')).be.true; | ||
should(BrV.ie(uf).validate('224/3658792')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 224/4658792', function(done) { | ||
should(BrV.ie(uf).validate('224/4658792')).be.false; | ||
should(BrV.ie(uf).validate('224/4658792')).be.false(); | ||
done(); | ||
@@ -57,11 +57,11 @@ }); | ||
it('should validate 01.004.823/001-12', function(done) { | ||
should(BrV.ie(uf).validate('01.004.823/001-12')).be.true; | ||
should(BrV.ie(uf).validate('01.004.823/001-12')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 01.004.923/201-12', function(done) { | ||
should(BrV.ie(uf).validate('01.004.923/201-12')).be.false; | ||
should(BrV.ie(uf).validate('01.004.923/201-12')).be.false(); | ||
done(); | ||
}); | ||
it('should invalidate 02.004.923/201-55', function(done) { | ||
should(BrV.ie(uf).validate('02.004.923/201-55')).be.false; | ||
should(BrV.ie(uf).validate('02.004.923/201-55')).be.false(); | ||
done(); | ||
@@ -73,7 +73,7 @@ }); | ||
it('should validate 062.307.904/0081', function(done) { | ||
should(BrV.ie(uf).validate('062.307.904/0081')).be.true; | ||
should(BrV.ie(uf).validate('062.307.904/0081')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 062.347.934/0081', function(done) { | ||
should(BrV.ie(uf).validate('062.347.934/0081')).be.false; | ||
should(BrV.ie(uf).validate('062.347.934/0081')).be.false(); | ||
done(); | ||
@@ -85,27 +85,27 @@ }); | ||
it('should validate 110.042.490.114', function(done) { | ||
should(BrV.ie(uf).validate('110.042.490.114')).be.true; | ||
should(BrV.ie(uf).validate('110.042.490.114')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 110.045.490.124', function(done) { | ||
should(BrV.ie(uf).validate('110.045.490.124')).be.false; | ||
should(BrV.ie(uf).validate('110.045.490.124')).be.false(); | ||
done(); | ||
}); | ||
it('should invalidate 011.004.243.002', function(done) { | ||
should(BrV.ie(uf).validate('011.004.243.002')).be.false; | ||
should(BrV.ie(uf).validate('011.004.243.002')).be.false(); | ||
done(); | ||
}); | ||
it('should validate P-01100424.3/002', function(done) { | ||
should(BrV.ie(uf).validate('P-01100424.3/002')).be.true; | ||
should(BrV.ie(uf).validate('P-01100424.3/002')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate P-358874770.9/710', function(done) { | ||
should(BrV.ie(uf).validate('P-358874770.9/710')).be.false; | ||
should(BrV.ie(uf).validate('P-358874770.9/710')).be.false(); | ||
done(); | ||
}); | ||
it('should validate p-01100524.3/002', function(done) { | ||
should(BrV.ie(uf).validate('p-01100524.0/002')).be.true; | ||
should(BrV.ie(uf).validate('p-01100524.0/002')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate A-01100524.3/002', function(done) { | ||
should(BrV.ie(uf).validate('A-01100524.0/002')).be.false; | ||
should(BrV.ie(uf).validate('A-01100524.0/002')).be.false(); | ||
done(); | ||
@@ -117,7 +117,7 @@ }); | ||
it('should validate 07300001001-09', function(done) { | ||
should(BrV.ie(uf).validate('07300001001-09')).be.true; | ||
should(BrV.ie(uf).validate('07300001001-09')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 07301002001-09', function(done) { | ||
should(BrV.ie(uf).validate('07301002001-09')).be.false; | ||
should(BrV.ie(uf).validate('07301002001-09')).be.false(); | ||
done(); | ||
@@ -129,11 +129,11 @@ }); | ||
it('should validate 99999999-0', function(done) { | ||
should(BrV.ie(uf).validate('99999999-0')).be.true; | ||
should(BrV.ie(uf).validate('99999999-0')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 19871230-8', function(done) { | ||
should(BrV.ie(uf).validate('19871230-8')).be.true; | ||
should(BrV.ie(uf).validate('19871230-8')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 99912999-0', function(done) { | ||
should(BrV.ie(uf).validate('99912999-0')).be.false; | ||
should(BrV.ie(uf).validate('99912999-0')).be.false(); | ||
done(); | ||
@@ -146,31 +146,31 @@ }); | ||
it('should validate 090493-87', function(done) { | ||
should(BrV.ie(uf).validate('090493-87')).be.true; | ||
should(BrV.ie(uf).validate('090493-87')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 123456-63', function(done) { | ||
should(BrV.ie(uf).validate('123456-63')).be.true; | ||
should(BrV.ie(uf).validate('123456-63')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 290493-30', function(done) { | ||
should(BrV.ie(uf).validate('290493-03')).be.true; | ||
should(BrV.ie(uf).validate('290493-03')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 390493-60', function(done) { | ||
should(BrV.ie(uf).validate('390493-66')).be.true; | ||
should(BrV.ie(uf).validate('390493-66')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 490493-29', function(done) { | ||
should(BrV.ie(uf).validate('490493-29')).be.true; | ||
should(BrV.ie(uf).validate('490493-29')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 590493-20', function(done) { | ||
should(BrV.ie(uf).validate('590493-82')).be.true; | ||
should(BrV.ie(uf).validate('590493-82')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 890493-10', function(done) { | ||
should(BrV.ie(uf).validate('890493-61')).be.true; | ||
should(BrV.ie(uf).validate('890493-61')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 026456-63', function(done) { | ||
should(BrV.ie(uf).validate('026456-63')).be.false; | ||
should(BrV.ie(uf).validate('026456-63')).be.false(); | ||
done(); | ||
@@ -180,15 +180,15 @@ }); | ||
it('should validate 612345-57', function(done) { | ||
should(BrV.ie(uf).validate('612345-57')).be.true; | ||
should(BrV.ie(uf).validate('612345-57')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 723024-69', function(done) { | ||
should(BrV.ie(uf).validate('723024-69')).be.true; | ||
should(BrV.ie(uf).validate('723024-69')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 923024-76', function(done) { | ||
should(BrV.ie(uf).validate('923024-76')).be.true; | ||
should(BrV.ie(uf).validate('923024-76')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 602355-57', function(done) { | ||
should(BrV.ie(uf).validate('602355-57')).be.false; | ||
should(BrV.ie(uf).validate('602355-57')).be.false(); | ||
done(); | ||
@@ -199,31 +199,31 @@ }); | ||
it('should validate 0629333-16', function(done) { | ||
should(BrV.ie(uf).validate('0629333-16')).be.true; | ||
should(BrV.ie(uf).validate('0629333-16')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 1000003-06', function(done) { | ||
should(BrV.ie(uf).validate('1000003-06')).be.true; | ||
should(BrV.ie(uf).validate('1000003-06')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 2190493-84', function(done) { | ||
should(BrV.ie(uf).validate('2190493-84')).be.true; | ||
should(BrV.ie(uf).validate('2190493-84')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 3190493-56', function(done) { | ||
should(BrV.ie(uf).validate('3190493-56')).be.true; | ||
should(BrV.ie(uf).validate('3190493-56')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 4190493-28', function(done) { | ||
should(BrV.ie(uf).validate('4190493-28')).be.true; | ||
should(BrV.ie(uf).validate('4190493-28')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 5190493-00', function(done) { | ||
should(BrV.ie(uf).validate('5190493-90')).be.true; | ||
should(BrV.ie(uf).validate('5190493-90')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 8190493-06', function(done) { | ||
should(BrV.ie(uf).validate('8190493-06')).be.true; | ||
should(BrV.ie(uf).validate('8190493-06')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 1010203-06', function(done) { | ||
should(BrV.ie(uf).validate('1010203-06')).be.false; | ||
should(BrV.ie(uf).validate('1010203-06')).be.false(); | ||
done(); | ||
@@ -233,15 +233,15 @@ }); | ||
it('should validate 6112345-05', function(done) { | ||
should(BrV.ie(uf).validate('6112345-35')).be.true; | ||
should(BrV.ie(uf).validate('6112345-35')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 7123024-06', function(done) { | ||
should(BrV.ie(uf).validate('7123024-56')).be.true; | ||
should(BrV.ie(uf).validate('7123024-56')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 9123024-90', function(done) { | ||
should(BrV.ie(uf).validate('9123024-90')).be.true; | ||
should(BrV.ie(uf).validate('9123024-90')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 6102355-57', function(done) { | ||
should(BrV.ie(uf).validate('6102355-57')).be.false; | ||
should(BrV.ie(uf).validate('6102355-57')).be.false(); | ||
done(); | ||
@@ -254,11 +254,11 @@ }); | ||
it('should validate 99.999.999-0', function(done) { | ||
should(BrV.ie(uf).validate('99.999.999-0')).be.true; | ||
should(BrV.ie(uf).validate('99.999.999-0')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 19.871.230-8', function(done) { | ||
should(BrV.ie(uf).validate('19.871.230-8')).be.true; | ||
should(BrV.ie(uf).validate('19.871.230-8')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 99.912.999-0', function(done) { | ||
should(BrV.ie(uf).validate('99.912.999-0')).be.false; | ||
should(BrV.ie(uf).validate('99.912.999-0')).be.false(); | ||
done(); | ||
@@ -270,19 +270,19 @@ }); | ||
it('should validate 20.040.040-1', function(done) { | ||
should(BrV.ie(uf).validate('20.040.040-1')).be.true; | ||
should(BrV.ie(uf).validate('20.040.040-1')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 20.042.140-1', function(done) { | ||
should(BrV.ie(uf).validate('20.042.140-1')).be.false; | ||
should(BrV.ie(uf).validate('20.042.140-1')).be.false(); | ||
done(); | ||
}); | ||
it('should validate 20.0.040.040-0', function(done) { | ||
should(BrV.ie(uf).validate('20.0.040.040-0')).be.true; | ||
should(BrV.ie(uf).validate('20.0.040.040-0')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 20.0.340.040-0', function(done) { | ||
should(BrV.ie(uf).validate('20.0.340.040-0')).be.true; | ||
should(BrV.ie(uf).validate('20.0.340.040-0')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 20.0.341.140-0', function(done) { | ||
should(BrV.ie(uf).validate('20.0.341.140-0')).be.false; | ||
should(BrV.ie(uf).validate('20.0.341.140-0')).be.false(); | ||
done(); | ||
@@ -294,13 +294,21 @@ }); | ||
it('should validate 0000000062521-3', function(done) { | ||
should(BrV.ie(uf).validate('0000000062521-3')).be.true; | ||
should(BrV.ie(uf).validate('0000000062521-3')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 0601230662521-7', function(done) { | ||
should(BrV.ie(uf).validate('0601230662521-7')).be.true; | ||
should(BrV.ie(uf).validate('0601230662521-7')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 0601230662521-3', function(done) { | ||
should(BrV.ie(uf).validate('0601230662521-3')).be.false; | ||
should(BrV.ie(uf).validate('0601230662521-3')).be.false(); | ||
done(); | ||
}); | ||
it('should validate 0000000126566-1', function(done) { | ||
should(BrV.ie(uf).validate('0000000126566-1')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 0000101126566-1', function(done) { | ||
should(BrV.ie(uf).validate('0000101126566-1')).be.true(); | ||
done(); | ||
}); | ||
}); | ||
@@ -310,11 +318,11 @@ describe('- PR', function() { | ||
it('should validate 123.45678-50', function(done) { | ||
should(BrV.ie(uf).validate('123.45678-50')).be.true; | ||
should(BrV.ie(uf).validate('123.45678-50')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 153.07274-47', function(done) { | ||
should(BrV.ie(uf).validate('153.07274-47')).be.true; | ||
should(BrV.ie(uf).validate('153.07274-47')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 153.07274-50', function(done) { | ||
should(BrV.ie(uf).validate('153.07274-50')).be.false; | ||
should(BrV.ie(uf).validate('153.07274-50')).be.false(); | ||
done(); | ||
@@ -328,11 +336,11 @@ }); | ||
it('should validate 251.040.852', function(done) { | ||
should(BrV.ie(uf).validate('251.040.852')).be.true; | ||
should(BrV.ie(uf).validate('251.040.852')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 251.341.852', function(done) { | ||
should(BrV.ie(uf).validate('251.341.852')).be.true; | ||
should(BrV.ie(uf).validate('251.341.852')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 251.321.852', function(done) { | ||
should(BrV.ie(uf).validate('251.321.852')).be.false; | ||
should(BrV.ie(uf).validate('251.321.852')).be.false(); | ||
done(); | ||
@@ -344,11 +352,11 @@ }); | ||
it('should validate 99.999.99-3', function(done) { | ||
should(BrV.ie(uf).validate('99.999.99-3')).be.true; | ||
should(BrV.ie(uf).validate('99.999.99-3')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 40.732.12-8', function(done) { | ||
should(BrV.ie(uf).validate('40.732.12-8')).be.true; | ||
should(BrV.ie(uf).validate('40.732.12-8')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 40.732.12-3', function(done) { | ||
should(BrV.ie(uf).validate('40.732.12-3')).be.false; | ||
should(BrV.ie(uf).validate('40.732.12-3')).be.false(); | ||
done(); | ||
@@ -360,15 +368,15 @@ }); | ||
it('should validate 15-999999-5', function(done) { | ||
should(BrV.ie(uf).validate('15-999999-5')).be.true; | ||
should(BrV.ie(uf).validate('15-999999-5')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 15-740351-3', function(done) { | ||
should(BrV.ie(uf).validate('15-740351-3')).be.true; | ||
should(BrV.ie(uf).validate('15-740351-3')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 15-740351-5', function(done) { | ||
should(BrV.ie(uf).validate('15-740351-5')).be.false; | ||
should(BrV.ie(uf).validate('15-740351-5')).be.false(); | ||
done(); | ||
}); | ||
it('should invalidate 14-740351-0', function(done) { | ||
should(BrV.ie(uf).validate('14-740351-0')).be.false; | ||
should(BrV.ie(uf).validate('14-740351-0')).be.false(); | ||
done(); | ||
@@ -380,11 +388,11 @@ }); | ||
it('should validate 27123456-3', function(done) { | ||
should(BrV.ie(uf).validate('27123456-3')).be.true; | ||
should(BrV.ie(uf).validate('27123456-3')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 14740351-0', function(done) { | ||
should(BrV.ie(uf).validate('14-740351-0')).be.true; | ||
should(BrV.ie(uf).validate('14-740351-0')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 15740351-5', function(done) { | ||
should(BrV.ie(uf).validate('15740351-5')).be.false; | ||
should(BrV.ie(uf).validate('15740351-5')).be.false(); | ||
done(); | ||
@@ -396,11 +404,11 @@ }); | ||
it('should validate 06000001-5', function(done) { | ||
should(BrV.ie(uf).validate('06000001-5')).be.true; | ||
should(BrV.ie(uf).validate('06000001-5')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 14740351-0', function(done) { | ||
should(BrV.ie(uf).validate('14-740351-0')).be.true; | ||
should(BrV.ie(uf).validate('14-740351-0')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 15740351-5', function(done) { | ||
should(BrV.ie(uf).validate('15740351-5')).be.false; | ||
should(BrV.ie(uf).validate('15740351-5')).be.false(); | ||
done(); | ||
@@ -412,11 +420,11 @@ }); | ||
it('should validate 06000001-5', function(done) { | ||
should(BrV.ie(uf).validate('06000001-5')).be.true; | ||
should(BrV.ie(uf).validate('06000001-5')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 14740351-0', function(done) { | ||
should(BrV.ie(uf).validate('14-740351-0')).be.true; | ||
should(BrV.ie(uf).validate('14-740351-0')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 15740351-5', function(done) { | ||
should(BrV.ie(uf).validate('15740351-5')).be.false; | ||
should(BrV.ie(uf).validate('15740351-5')).be.false(); | ||
done(); | ||
@@ -428,15 +436,15 @@ }); | ||
it('should validate 012345679', function(done) { | ||
should(BrV.ie(uf).validate('012345679')).be.true; | ||
should(BrV.ie(uf).validate('012345679')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 060000015', function(done) { | ||
should(BrV.ie(uf).validate('060000015')).be.true; | ||
should(BrV.ie(uf).validate('060000015')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 147403510', function(done) { | ||
should(BrV.ie(uf).validate('147403510')).be.true; | ||
should(BrV.ie(uf).validate('147403510')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 157403515', function(done) { | ||
should(BrV.ie(uf).validate('157403515')).be.false; | ||
should(BrV.ie(uf).validate('157403515')).be.false(); | ||
done(); | ||
@@ -448,15 +456,15 @@ }); | ||
it('should validate 120000385', function(done) { | ||
should(BrV.ie(uf).validate('120000385')).be.true; | ||
should(BrV.ie(uf).validate('120000385')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 060000015', function(done) { | ||
should(BrV.ie(uf).validate('060000015')).be.false; | ||
should(BrV.ie(uf).validate('060000015')).be.false(); | ||
done(); | ||
}); | ||
it('should invalidate 127403510', function(done) { | ||
should(BrV.ie(uf).validate('127403510')).be.false; | ||
should(BrV.ie(uf).validate('127403510')).be.false(); | ||
done(); | ||
}); | ||
it('should validate 127403515', function(done) { | ||
should(BrV.ie(uf).validate('127403515')).be.true; | ||
should(BrV.ie(uf).validate('127403515')).be.true(); | ||
done(); | ||
@@ -468,11 +476,11 @@ }); | ||
it('should validate 0013000001-9', function(done) { | ||
should(BrV.ie(uf).validate('0013000001-9')).be.true; | ||
should(BrV.ie(uf).validate('0013000001-9')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 0013046011-7', function(done) { | ||
should(BrV.ie(uf).validate('0013046011-7')).be.true; | ||
should(BrV.ie(uf).validate('0013046011-7')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 0013046011-9', function(done) { | ||
should(BrV.ie(uf).validate('0013046011-9')).be.false; | ||
should(BrV.ie(uf).validate('0013046011-9')).be.false(); | ||
done(); | ||
@@ -484,11 +492,11 @@ }); | ||
it('should validate 285730383', function(done) { | ||
should(BrV.ie(uf).validate('280000383')).be.true; | ||
should(BrV.ie(uf).validate('280000383')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 127403515', function(done) { | ||
should(BrV.ie(uf).validate('127403515')).be.false; | ||
should(BrV.ie(uf).validate('127403515')).be.false(); | ||
done(); | ||
}); | ||
it('should invalidate 280000015', function(done) { | ||
should(BrV.ie(uf).validate('280000015')).be.false; | ||
should(BrV.ie(uf).validate('280000015')).be.false(); | ||
done(); | ||
@@ -500,11 +508,11 @@ }); | ||
it('should validate 29010227836', function(done) { | ||
should(BrV.ie(uf).validate('29010227836')).be.true; | ||
should(BrV.ie(uf).validate('29010227836')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 29010237336', function(done) { | ||
should(BrV.ie(uf).validate('29010237336')).be.false; | ||
should(BrV.ie(uf).validate('29010237336')).be.false(); | ||
done(); | ||
}); | ||
it('should invalidate 29090227836', function(done) { | ||
should(BrV.ie(uf).validate('29090227836')).be.false; | ||
should(BrV.ie(uf).validate('29090227836')).be.false(); | ||
done(); | ||
@@ -516,19 +524,19 @@ }); | ||
it('should validate 240000048', function(done) { | ||
should(BrV.ie(uf).validate('240000048')).be.true; | ||
should(BrV.ie(uf).validate('240000048')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 240273044', function(done) { | ||
should(BrV.ie(uf).validate('240273044')).be.true; | ||
should(BrV.ie(uf).validate('240273044')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 241178045', function(done) { | ||
should(BrV.ie(uf).validate('241178045')).be.false; | ||
should(BrV.ie(uf).validate('241178045')).be.false(); | ||
done(); | ||
}); | ||
it('should invalidate 213178044', function(done) { | ||
should(BrV.ie(uf).validate('213178044')).be.false; | ||
should(BrV.ie(uf).validate('213178044')).be.false(); | ||
done(); | ||
}); | ||
it('should invalidate 240178040', function(done) { | ||
should(BrV.ie(uf).validate('240178040')).be.false; | ||
should(BrV.ie(uf).validate('240178040')).be.false(); | ||
done(); | ||
@@ -540,23 +548,23 @@ }); | ||
it('should validate 24006628-1', function(done) { | ||
should(BrV.ie(uf).validate('24006628-1')).be.true; | ||
should(BrV.ie(uf).validate('24006628-1')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 24001755-6', function(done) { | ||
should(BrV.ie(uf).validate('24001755-6')).be.true; | ||
should(BrV.ie(uf).validate('24001755-6')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 24003429-0', function(done) { | ||
should(BrV.ie(uf).validate('24003429-0')).be.true; | ||
should(BrV.ie(uf).validate('24003429-0')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 24001360-3', function(done) { | ||
should(BrV.ie(uf).validate('24001360-3')).be.true; | ||
should(BrV.ie(uf).validate('24001360-3')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 24008266-8', function(done) { | ||
should(BrV.ie(uf).validate('24008266-8')).be.true; | ||
should(BrV.ie(uf).validate('24008266-8')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 24002676-8', function(done) { | ||
should(BrV.ie(uf).validate('24002676-8')).be.false; | ||
should(BrV.ie(uf).validate('24002676-8')).be.false(); | ||
done(); | ||
@@ -568,19 +576,19 @@ }); | ||
it('should validate 10.987.654-7', function(done) { | ||
should(BrV.ie(uf).validate('10.987.654-7')).be.true; | ||
should(BrV.ie(uf).validate('10.987.654-7')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 11.094.402-0', function(done) { | ||
should(BrV.ie(uf).validate('11.094.402-0')).be.true; | ||
should(BrV.ie(uf).validate('11.094.402-0')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 10.115.996-1', function(done) { | ||
should(BrV.ie(uf).validate('10.115.996-1')).be.true; | ||
should(BrV.ie(uf).validate('10.115.996-1')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 10.113.995-0', function(done) { | ||
should(BrV.ie(uf).validate('10.113.995-0')).be.true; | ||
should(BrV.ie(uf).validate('10.113.995-0')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 10.957.654-7', function(done) { | ||
should(BrV.ie(uf).validate('10.957.654-7')).be.false; | ||
should(BrV.ie(uf).validate('10.957.654-7')).be.false(); | ||
done(); | ||
@@ -592,31 +600,47 @@ }); | ||
it('should validate 030123459', function(done) { | ||
should(BrV.ie(uf).validate('030123459')).be.true; | ||
should(BrV.ie(uf).validate('030123459')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 030183458', function(done) { | ||
should(BrV.ie(uf).validate('030183458')).be.true; | ||
should(BrV.ie(uf).validate('030183458')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 030173452', function(done) { | ||
should(BrV.ie(uf).validate('030173452')).be.true; | ||
should(BrV.ie(uf).validate('030173452')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 030153455', function(done) { | ||
should(BrV.ie(uf).validate('030153455')).be.true; | ||
should(BrV.ie(uf).validate('030153455')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 030193451', function(done) { | ||
should(BrV.ie(uf).validate('030193451')).be.true; | ||
should(BrV.ie(uf).validate('030193451')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 030223458', function(done) { | ||
should(BrV.ie(uf).validate('030223458')).be.true; | ||
should(BrV.ie(uf).validate('030223458')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 037123459', function(done) { | ||
should(BrV.ie(uf).validate('037123459')).be.true; | ||
should(BrV.ie(uf).validate('037123459')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 038608910', function(done) { | ||
should(BrV.ie(uf).validate('038608910')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 030177041', function(done) { | ||
should(BrV.ie(uf).validate('030177041')).be.true(); | ||
done(); | ||
}); | ||
it('should validate 030077090', function(done) { | ||
should(BrV.ie(uf).validate('030077090')).be.true(); | ||
done(); | ||
}); | ||
it('should invalidate 040077098', function(done) { | ||
should(BrV.ie(uf).validate('040077098')).be.false(); | ||
done(); | ||
}); | ||
it('should invalidate 031123459', function(done) { | ||
should(BrV.ie(uf).validate('031123459')).be.false; | ||
should(BrV.ie(uf).validate('031123459')).be.false(); | ||
done(); | ||
@@ -623,0 +647,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
81197
2054
81
0
2
14