-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. 增加CMD/Seajs支持。 2. 增加cache缓存记录,避免重复运算。
- Loading branch information
Showing
10 changed files
with
154 additions
and
34 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,54 @@ | ||
define(function(require, exports, module) { | ||
|
||
var IDValidator = require('IDValidator'); | ||
var GB2260 = require('GB2260'); | ||
|
||
function log() { | ||
for(var i=0;i<arguments.length;i++){ | ||
var m = arguments[i]; | ||
if( typeof m == 'object' ){ | ||
for( var k in m ){ | ||
if( m.hasOwnProperty(k) ){ | ||
log(k+':',m[k]); | ||
} | ||
} | ||
}else{ | ||
var p = document.createElement('p'); | ||
p.innerText = m.toString(); | ||
document.body.appendChild(p); | ||
} | ||
} | ||
} | ||
|
||
var testId = "371001198010082394"; | ||
var fakeId = "345955198706122245"; | ||
var fifteenId = "431389760616601"; | ||
|
||
var Validator = new IDValidator(); | ||
|
||
//检测是否合法 | ||
log( '\nID:'+testId+'的合法性为:\n', Validator.isValid( testId ) ); | ||
log( '\n假ID:'+fakeId+'的合法性为:\n', Validator.isValid( fakeId ) ); | ||
//15位 | ||
log( '\n15位ID:'+fifteenId+'的合法性为:\n', Validator.isValid( fifteenId ) ); | ||
|
||
var Validator2 = new IDValidator( GB2260 ); | ||
|
||
//输出分析信息 | ||
log( '\nID:'+testId+'的信息为(带地址):\n', Validator2.getInfo( testId ) ); | ||
|
||
//伪造一个ID | ||
var makeID = Validator.makeID(); | ||
log( '\n制作的ID:'+makeID+'的信息为:\n',Validator2.getInfo( makeID ) ); | ||
|
||
|
||
//伪造一个15位ID | ||
var makeID2 = Validator.makeID(true); | ||
log( '\n制作的15位ID:'+makeID2+'的信息为:\n',Validator2.getInfo( makeID2 ) ); | ||
|
||
|
||
//随机地址码伪造一个ID | ||
var makeID3 = Validator2.makeID(); | ||
log( '\n随机地址码制作的ID:'+makeID3+'的信息为:\n',Validator2.getInfo( makeID3 ) ); | ||
|
||
}); |
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,21 @@ | ||
<!DOCTYPE html> | ||
<html lang="zh-cn"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>IDValidator AMD</title> | ||
<script type="text/javascript" src="lib/sea.js"></script> | ||
<script type="text/javascript"> | ||
seajs.config({ | ||
alias: { | ||
"IDValidator": "../../../src/IDValidator.js", | ||
"GB2260": "../../../src/GB2260.js" | ||
} | ||
}); | ||
|
||
seajs.use("seaJsApp"); | ||
</script> | ||
</head> | ||
<body> | ||
|
||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.