Skip to content
This repository was archived by the owner on Jan 17, 2020. It is now read-only.

Commit 10db7c3

Browse files
committed
regex validacao novos cartoes
1 parent 1678aef commit 10db7c3

File tree

4 files changed

+68
-42
lines changed

4 files changed

+68
-42
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "pling-ui-lite",
33
"description": "Lightweight Pling Framework",
4-
"version": "0.1.2",
4+
"version": "0.1.3",
55
"main": "pling-ui-lite.js",
66
"moduleType": "amd",
77
"license": "UNLICENSED",

pling-ui-lite.js

100755100644
Lines changed: 65 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
'prefixPattern' : /^4$/,
110110
'exactPattern' : /^4\d*$/,
111111
'gaps' : [4, 8, 12],
112-
'lengths' : [16],
112+
'lengths' : [13, 16],
113113
'code' : {
114114
'name' : 'CVV',
115115
'size' : 3
@@ -129,6 +129,32 @@
129129
}
130130
});
131131

132+
types.push({
133+
'niceType' : 'Diners Club',
134+
'type' : 3,
135+
'prefixPattern' : /^(36|38|30[0-5])$/,
136+
'exactPattern' : /^(36|38|30[0-5])\d*$/,
137+
'gaps' : [4, 8, 12],
138+
'lengths' : [14, 16],
139+
'code' : {
140+
'name' : 'CVV',
141+
'size' : 3
142+
}
143+
});
144+
145+
types.push({
146+
'niceType' : 'Elo',
147+
'type' : 4,
148+
'prefixPattern' : /^(636368|636369|438935|504175|451416|636297|5067|4576|4011|506699)$/,
149+
'exactPattern' : /^(636368|636369|438935|504175|451416|636297|5067|4576|4011|506699)\d*$/,
150+
'gaps' : [4, 8, 12],
151+
'lengths' : [16],
152+
'code' : {
153+
'name' : 'CVV',
154+
'size' : 3
155+
}
156+
});
157+
132158
function luhn10(identifier) {
133159
var sum = 0;
134160
var alt = false;
@@ -655,6 +681,44 @@
655681
}
656682

657683
}());
684+
(function() {
685+
'use strict';
686+
687+
angular
688+
.module('plingUiLite')
689+
.service('cacheService', CachingService);
690+
691+
CachingService.$inject = [ '$templateCache', '$route', '$http' ];
692+
693+
function CachingService($templateCache, $route, $http) {
694+
695+
696+
this.cacheViews = function (cacheObj, routeObj) {
697+
698+
// setting defaults
699+
var
700+
partial, route,
701+
viewCache = cacheObj || $templateCache,
702+
router = routeObj || $route;
703+
704+
// looping routes
705+
for (route in router.routes) {
706+
707+
if (router.routes.hasOwnProperty(route)) {
708+
709+
// evaluate partial
710+
partial = router.routes[route].templateUrl;
711+
712+
if (partial)
713+
// caching route
714+
$http.get(partial, {'cache': viewCache});
715+
}
716+
}
717+
};
718+
}
719+
720+
}());
721+
658722
(function (context, logger) {
659723
'use strict';
660724

@@ -916,44 +980,6 @@
916980
// creating instance
917981
context.loader = new ConfLoader();
918982
}(window.pling));
919-
(function() {
920-
'use strict';
921-
922-
angular
923-
.module('plingUiLite')
924-
.service('cacheService', CachingService);
925-
926-
CachingService.$inject = [ '$templateCache', '$route', '$http' ];
927-
928-
function CachingService($templateCache, $route, $http) {
929-
930-
931-
this.cacheViews = function (cacheObj, routeObj) {
932-
933-
// setting defaults
934-
var
935-
partial, route,
936-
viewCache = cacheObj || $templateCache,
937-
router = routeObj || $route;
938-
939-
// looping routes
940-
for (route in router.routes) {
941-
942-
if (router.routes.hasOwnProperty(route)) {
943-
944-
// evaluate partial
945-
partial = router.routes[route].templateUrl;
946-
947-
if (partial)
948-
// caching route
949-
$http.get(partial, {'cache': viewCache});
950-
}
951-
}
952-
};
953-
}
954-
955-
}());
956-
957983
(function() {
958984
'use strict';
959985

0 commit comments

Comments
 (0)