acha-framework
Version:
is a modular framework on both client (angular.js) and server (node.js) side, it provides security, orm, ioc, obfuscation and ...
20 lines • 658 B
JavaScript
(function (undefined) {
Ioc.define('backend.stringHelper', [], function (provide) {
provide({
isEmail: function (email) {
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
},
isMobile: function (str) {
str = str || '';
return str.length === 11 && str[0] === '0';
},
isAlphanumeric: function (str) {
return /^([a-zA-Z0-9_]+)$/.test(str || '');
},
isNumber: function (str) {
return /^\d+$/.test(str);
}
});
});
}());