fix tests

This commit is contained in:
Alexander Zobnin
2020-05-15 14:14:06 +03:00
parent 1ae4b86ca9
commit c4f8b5bf2b

View File

@@ -98,17 +98,17 @@ function cacheRequest(func, funcName, funcScope, self) {
function getRequestHash(args) { function getRequestHash(args) {
const argsJson = JSON.stringify(args); const argsJson = JSON.stringify(args);
return argsJson.getHash(); return getHash(argsJson);
} }
String.prototype.getHash = function() { function getHash(str: string): number {
let hash = 0, i, chr, len; let hash = 0, i, chr, len;
if (this.length !== 0) { if (str.length !== 0) {
for (i = 0, len = this.length; i < len; i++) { for (i = 0, len = str.length; i < len; i++) {
chr = this.charCodeAt(i); chr = str.charCodeAt(i);
hash = ((hash << 5) - hash) + chr; hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer hash |= 0; // Convert to 32bit integer
} }
} }
return hash; return hash;
}; }