From 242c72581e95a69b90f4612e93277dfa34a7adee Mon Sep 17 00:00:00 2001 From: Blazej Kustra Date: Mon, 28 Aug 2023 18:53:06 +0200 Subject: [PATCH] [TS migration] Migrate 'hashCode.js' lib to TypeScript --- src/libs/{hashCode.js => hashCode.ts} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename src/libs/{hashCode.js => hashCode.ts} (80%) diff --git a/src/libs/hashCode.js b/src/libs/hashCode.ts similarity index 80% rename from src/libs/hashCode.js rename to src/libs/hashCode.ts index a95d0787a6e3..bb0522c25de0 100644 --- a/src/libs/hashCode.js +++ b/src/libs/hashCode.ts @@ -2,11 +2,11 @@ /** * Simple string hashing function obtained from: https://stackoverflow.com/a/8831937/16434681 * Returns a hash code from a string - * @param {String} str The string to hash. - * @return {Number} A 32bit integer (can be negative) + * @param str The string to hash. + * @return A 32bit integer (can be negative) * @see http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/ */ -function hashCode(str) { +function hashCode(str: string): number { let hash = 0; for (let i = 0, len = str.length; i < len; i++) { const chr = str.charCodeAt(i);