ng2-validators
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -152,20 +152,2 @@ System.registerDynamic("src/password-validators", ["./util"], true, function($__require, exports, module) { | ||
System.registerDynamic("src/util", [], true, function($__require, exports, module) { | ||
"use strict"; | ||
; | ||
var define, | ||
global = this, | ||
GLOBAL = this; | ||
var Util = (function() { | ||
function Util() {} | ||
Util.isNotPresent = function(control) { | ||
return control.value !== '' ? false : true; | ||
}; | ||
; | ||
return Util; | ||
}()); | ||
exports.Util = Util; | ||
return module.exports; | ||
}); | ||
System.registerDynamic("src/universal-validators", ["@angular/core/src/facade/lang", "./util"], true, function($__require, exports, module) { | ||
@@ -247,3 +229,3 @@ "use strict"; | ||
System.registerDynamic("ng2-validators", ["./src/password-validators", "./src/email-validators", "./src/universal-validators"], true, function($__require, exports, module) { | ||
System.registerDynamic("src/util", [], true, function($__require, exports, module) { | ||
"use strict"; | ||
@@ -254,2 +236,122 @@ ; | ||
GLOBAL = this; | ||
var Util = (function() { | ||
function Util() {} | ||
Util.isNotPresent = function(control) { | ||
return control.value !== '' ? false : true; | ||
}; | ||
; | ||
return Util; | ||
}()); | ||
exports.Util = Util; | ||
return module.exports; | ||
}); | ||
System.registerDynamic("src/creditcard-validators", ["./util"], true, function($__require, exports, module) { | ||
"use strict"; | ||
; | ||
var define, | ||
global = this, | ||
GLOBAL = this; | ||
var util_1 = $__require('./util'); | ||
var visa = '(?:4[0-9]{12})(?:[0-9]{3})?$'; | ||
var americanExpress = '(?:3[47][0-9]{13})$'; | ||
var maestro = '(?:(?:5[0678]\\d\\d|6304|6390|67\\d\\d)\\d{8,15})$'; | ||
var jcb = '(?:(?:2131|1800|35\\d{3})\\d{11})$'; | ||
var discover = '(?:6(?:011|5[0-9]{2})(?:[0-9]{12}))$'; | ||
var dinersclub = '(?:3(?:0[0-5]|[68][0-9])[0-9]{11})$'; | ||
var mastercard = '(?:5[1-5][0-9]{14})$'; | ||
var CreditCardValidators = (function() { | ||
function CreditCardValidators() {} | ||
CreditCardValidators.isCreditCard = function() { | ||
return function validate(control) { | ||
if (util_1.Util.isNotPresent(control)) | ||
return undefined; | ||
if (new RegExp(americanExpress + '|' + visa + '|' + maestro + '|' + jcb + '|' + discover + '|' + mastercard + '|' + dinersclub).test(control.value)) { | ||
return undefined; | ||
} | ||
return {'creditcard': true}; | ||
}; | ||
}; | ||
CreditCardValidators.americanExpress = function() { | ||
return function validate(control) { | ||
if (util_1.Util.isNotPresent(control)) | ||
return undefined; | ||
if (new RegExp(americanExpress).test(control.value)) { | ||
return undefined; | ||
} | ||
return {'americanExpress': true}; | ||
}; | ||
}; | ||
CreditCardValidators.dinersclub = function() { | ||
return function validate(control) { | ||
if (util_1.Util.isNotPresent(control)) | ||
return undefined; | ||
if (new RegExp(dinersclub).test(control.value)) { | ||
return undefined; | ||
} | ||
return {'dinersclub': true}; | ||
}; | ||
}; | ||
CreditCardValidators.discover = function() { | ||
return function validate(control) { | ||
if (util_1.Util.isNotPresent(control)) | ||
return undefined; | ||
if (new RegExp(discover).test(control.value)) { | ||
return undefined; | ||
} | ||
return {'discover': true}; | ||
}; | ||
}; | ||
CreditCardValidators.jcb = function() { | ||
return function validate(control) { | ||
if (util_1.Util.isNotPresent(control)) | ||
return undefined; | ||
if (new RegExp(jcb).test(control.value)) { | ||
return undefined; | ||
} | ||
return {'jcb': true}; | ||
}; | ||
}; | ||
CreditCardValidators.maestro = function() { | ||
return function validate(control) { | ||
if (util_1.Util.isNotPresent(control)) | ||
return undefined; | ||
if (new RegExp(maestro).test(control.value)) { | ||
return undefined; | ||
} | ||
return {'maestro': true}; | ||
}; | ||
}; | ||
CreditCardValidators.mastercard = function() { | ||
return function validate(control) { | ||
if (util_1.Util.isNotPresent(control)) | ||
return undefined; | ||
if (new RegExp(mastercard).test(control.value)) { | ||
return undefined; | ||
} | ||
return {'mastercard': true}; | ||
}; | ||
}; | ||
CreditCardValidators.visa = function() { | ||
return function validate(control) { | ||
if (util_1.Util.isNotPresent(control)) | ||
return undefined; | ||
if (new RegExp(visa).test(control.value)) { | ||
return undefined; | ||
} | ||
return {'visa': true}; | ||
}; | ||
}; | ||
return CreditCardValidators; | ||
}()); | ||
exports.CreditCardValidators = CreditCardValidators; | ||
return module.exports; | ||
}); | ||
System.registerDynamic("ng2-validators", ["./src/password-validators", "./src/email-validators", "./src/universal-validators", "./src/creditcard-validators"], true, function($__require, exports, module) { | ||
"use strict"; | ||
; | ||
var define, | ||
global = this, | ||
GLOBAL = this; | ||
function __export(m) { | ||
@@ -263,3 +365,4 @@ for (var p in m) | ||
__export($__require('./src/universal-validators')); | ||
__export($__require('./src/creditcard-validators')); | ||
return module.exports; | ||
}); |
export * from './src/password-validators'; | ||
export * from './src/email-validators'; | ||
export * from './src/universal-validators'; | ||
export * from './src/creditcard-validators'; |
@@ -8,2 +8,3 @@ "use strict"; | ||
__export(require('./src/universal-validators')); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmcyLXZhbGlkYXRvcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJuZzItdmFsaWRhdG9ycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsaUJBQWMsMkJBQTJCLENBQUMsRUFBQTtBQUMxQyxpQkFBYyx3QkFBd0IsQ0FBQyxFQUFBO0FBQ3ZDLGlCQUFjLDRCQUE0QixDQUFDLEVBQUEiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3NyYy9wYXNzd29yZC12YWxpZGF0b3JzJztcbmV4cG9ydCAqIGZyb20gJy4vc3JjL2VtYWlsLXZhbGlkYXRvcnMnO1xuZXhwb3J0ICogZnJvbSAnLi9zcmMvdW5pdmVyc2FsLXZhbGlkYXRvcnMnO1xuXG4iXX0= | ||
__export(require('./src/creditcard-validators')); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmcyLXZhbGlkYXRvcnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJuZzItdmFsaWRhdG9ycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBQUEsaUJBQWMsMkJBQTJCLENBQUMsRUFBQTtBQUMxQyxpQkFBYyx3QkFBd0IsQ0FBQyxFQUFBO0FBQ3ZDLGlCQUFjLDRCQUE0QixDQUFDLEVBQUE7QUFDM0MsaUJBQWMsNkJBQTZCLENBQUMsRUFBQSIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vc3JjL3Bhc3N3b3JkLXZhbGlkYXRvcnMnO1xuZXhwb3J0ICogZnJvbSAnLi9zcmMvZW1haWwtdmFsaWRhdG9ycyc7XG5leHBvcnQgKiBmcm9tICcuL3NyYy91bml2ZXJzYWwtdmFsaWRhdG9ycyc7XG5leHBvcnQgKiBmcm9tICcuL3NyYy9jcmVkaXRjYXJkLXZhbGlkYXRvcnMnOyJdfQ== |
@@ -37,24 +37,24 @@ { | ||
"@angular/platform-browser": "2.0.0-rc.1", | ||
"commitizen": "~2.8.1", | ||
"cz-conventional-changelog": "~1.1.6", | ||
"es6-promise": "^3.0.2", | ||
"es6-shim": "^0.35.0", | ||
"gulp": "^3.9.1", | ||
"gulp-git": "^1.7.1", | ||
"jasmine-core": "~2.4.1", | ||
"karma": "~0.13.15", | ||
"karma-chrome-launcher": "~0.2.2", | ||
"karma-firefox-launcher": "~0.1.7", | ||
"karma-jasmine": "~0.3.8", | ||
"karma-mocha-reporter": "^2.0.3", | ||
"commitizen": "2.8.1", | ||
"cz-conventional-changelog": "1.1.6", | ||
"es6-promise": "3.0.2", | ||
"es6-shim": "0.35.0", | ||
"gulp": "3.9.1", | ||
"gulp-git": "1.7.1", | ||
"jasmine-core": "2.4.1", | ||
"karma": "0.13.19", | ||
"karma-chrome-launcher": "0.2.2", | ||
"karma-firefox-launcher": "0.1.7", | ||
"karma-jasmine": "0.3.8", | ||
"karma-mocha-reporter": "2.0.3", | ||
"karma-typescript-preprocessor": "0.0.21", | ||
"reflect-metadata": "0.1.2", | ||
"rxjs": "5.0.0-beta.6", | ||
"semantic-release": "^4.3.5", | ||
"systemjs": "~0.19.24", | ||
"systemjs-builder": "^0.15.13", | ||
"tsd": "^0.6.5", | ||
"typescript": "^1.8.9", | ||
"typings": "^0.6.8", | ||
"zone.js": "^0.6.10" | ||
"semantic-release": "4.3.5", | ||
"systemjs": "0.19.24", | ||
"systemjs-builder": "0.15.13", | ||
"tsd": "0.6.5", | ||
"typescript": "1.8.9", | ||
"typings": "0.6.8", | ||
"zone.js": "0.6.12" | ||
}, | ||
@@ -64,3 +64,3 @@ "czConfig": { | ||
}, | ||
"version": "1.1.0" | ||
"version": "1.2.0" | ||
} |
@@ -9,2 +9,4 @@ # ng2-validators [![Build Status](https://travis-ci.org/Nightapes/ng2-validators.svg?branch=master)](https://travis-ci.org/Nightapes/ng2-validators.svg?branch=master) | ||
1. Email | ||
1. Universal | ||
1. Creditcards | ||
@@ -39,3 +41,12 @@ ## Password validators | ||
## Creditcard validators | ||
* americanexpress | ||
* visa | ||
* dinersclub | ||
* discover | ||
* jcb | ||
* maestro | ||
* mastercard | ||
## Install | ||
@@ -70,3 +81,2 @@ | ||
* Add more password rules | ||
* Add credit card validators | ||
* Add phone validators | ||
@@ -73,0 +83,0 @@ * Add address validator |
@@ -21,2 +21,4 @@ { | ||
"./src/universal-validators.ts", | ||
"./src/creditcard-validators.ts", | ||
"./tests/creditcard-validators.spec.ts", | ||
"./tests/universal-validators.spec.ts", | ||
@@ -23,0 +25,0 @@ "./src/util.ts", |
66421
23
894
84