tibia-signatures
Advanced tools
Comparing version 0.0.2 to 0.0.3
18
index.js
@@ -387,3 +387,3 @@ var clients, _findBy; | ||
_findBy = function(type, value) { | ||
_findBy = function(type, value, returnVersion) { | ||
value = value.toUpperCase(); | ||
@@ -395,3 +395,3 @@ for(var version in clients) { | ||
if(client[rev][type] == value) { | ||
return true; | ||
return (returnVersion) ? version : true; | ||
} | ||
@@ -401,3 +401,3 @@ } | ||
if(client[type] == value) { | ||
return true; | ||
return (returnVersion) ? version : true; | ||
} | ||
@@ -412,2 +412,14 @@ } | ||
getSignatureByVersion: function(version) { | ||
return (version in clients) ? clients[version] : false; | ||
}, | ||
getVersionBySprSignature: function(value) { | ||
return _findBy('spr', value, true); | ||
}, | ||
getVersionByDatSignature: function(value) { | ||
return _findBy('dat', value, true); | ||
}, | ||
isValidSprSignature: function(value) { | ||
@@ -414,0 +426,0 @@ return _findBy('spr', value); |
{ | ||
"name": "tibia-signatures", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Repository to store signatures of the Tibia files", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,7 +10,17 @@ # tibia-signatures | ||
## API | ||
* getSignatureByVersion(version) | ||
* version - required - Client Version without dots | ||
* returns Array or Object | ||
* getVersionBySprSignature(hexSign) | ||
* hexSign - required - First 4 bytes from Spr file | ||
* returns Integer | ||
* getVersionByDatSignature(hexSign) | ||
* hexSign - required - First 4 bytes reversed from Dat file | ||
* returns Integer | ||
* isValidSprSignature(hexSign) | ||
* hexSign - required - First 4 bytes from Spr file | ||
* hexSign - required - First 4 bytes from Spr file | ||
* return Boolean | ||
* isValidDatSignature(hexSign) | ||
* hexSign - required - First 4 bytes reversed from Dat file | ||
* return Boolean | ||
@@ -17,0 +27,0 @@ ## References |
9395
419
59